Skip to content

Create model execute command #680

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 13 commits into from
Apr 20, 2021
Merged

Create model execute command #680

merged 13 commits into from
Apr 20, 2021

Conversation

alonre24
Copy link
Collaborator

AI.MODELRUN command is now deprecated by AI.MODELEXECUTE.
In enterprise cluster, only AI.MODELEXECUTE will be available.

@alonre24 alonre24 requested a review from DvirDukhan April 12, 2021 12:58
@codecov
Copy link

codecov bot commented Apr 12, 2021

Codecov Report

Merging #680 (a4cceeb) into master (96b5761) will increase coverage by 0.52%.
The diff coverage is 83.29%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #680      +/-   ##
==========================================
+ Coverage   78.37%   78.90%   +0.52%     
==========================================
  Files          41       43       +2     
  Lines        6535     6850     +315     
==========================================
+ Hits         5122     5405     +283     
- Misses       1413     1445      +32     
Impacted Files Coverage Δ
src/execution/DAG/dag_parser.c 95.32% <ø> (ø)
src/execution/utils.c 71.42% <71.42%> (ø)
src/redis_ai_objects/tensor.c 86.20% <75.00%> (-0.12%) ⬇️
src/execution/deprecated.c 78.06% <78.06%> (ø)
src/backends/onnxruntime.c 75.79% <79.59%> (+2.68%) ⬆️
src/redisai.c 85.65% <87.71%> (+0.51%) ⬆️
src/execution/command_parser.c 88.12% <93.50%> (+4.78%) ⬆️
src/redis_ai_objects/model.c 78.68% <97.14%> (+1.53%) ⬆️
src/redis_ai_objects/script.c 82.50% <100.00%> (ø)
src/redismodule.h 100.00% <100.00%> (ø)
... and 8 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 96b5761...a4cceeb. Read the comment docs.

 Moved RAI_GetTensoe/ModelFromKeyspace functions to execution/utils, and call the function that validates that this key is located in the current shard from within (relevant to enterprise only).
Comment on lines +58 to +61
extern int rlecMajorVersion;
extern int rlecMinorVersion;
extern int rlecPatchVersion;
extern int rlecBuild;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do you need those here after they moved to utils?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because we use them in the onLoad function also...

return false;
}
}
RedisModule_Log(ctx, "warning", "could not load %s from keyspace, key doesn't exist",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

notice that you log this message in RAI_GetModelFromKeyspace
please consolidate the error messages

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You right, the logging in RAI_GetModelFromKeyspace should occur only in LITE version where we don't call VerifyKeyInThisShard

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so why we have it two places?

Comment on lines +148 to +151
if (!VerifyKeyInThisShard(ctx, outkeys[i])) { // Relevant for enterprise cluster.
RAI_SetError(err, RAI_EMODELRUN,
"ERR CROSSSLOT Keys in request don't hash to the same slot");
return REDISMODULE_ERR;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

move this to the actual parsing phase. fail as soon as possible when you can

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can't because the parsing function is used from dag command as well (and in DAG we do not take the keys from key space...)
But ModelRunCtx_SetParams is called only from "pure" AI.MODELEXECUTE.

alonre24 and others added 4 commits April 13, 2021 16:55
… to depracted.c

- Replace modelrun and modelset with modelexecute and modelstroe in onnx and pytorch tests.
- Create a new test file (currently still empty) for testing deprcated APIs.
…Use "tests_commands" to test the new commands syntax (not for a specific backend), and test the deprecated commands only in "test_deprecated".

Update AI.MODELSTORE documentation.
@@ -150,42 +74,30 @@ def test_onnx_modelrun_batchdim_mismatch(env):
return

con = env.getConnection()
model_pb = load_from_file('batchdim_mismatch.onnx')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove enitre test

Comment on lines 506 to 508
array_new_on_stack(const char *, 5, input_names)
array_new_on_stack(const char *, 5, output_names) array_new_on_stack(OrtValue *, 5, inputs)
array_new_on_stack(OrtValue *, 5, outputs) OrtTensorTypeAndShapeInfo *info = NULL;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
array_new_on_stack(const char *, 5, input_names)
array_new_on_stack(const char *, 5, output_names) array_new_on_stack(OrtValue *, 5, inputs)
array_new_on_stack(OrtValue *, 5, outputs) OrtTensorTypeAndShapeInfo *info = NULL;
int stack_arr_size = 5;
array_new_on_stack(const char *, stack_arr_size , input_names);
array_new_on_stack(const char *, stack_arr_size , output_names);
array_new_on_stack(OrtValue *, stack_arr_size , inputs);
array_new_on_stack(OrtValue *, stack_arr_size , outputs);
OrtTensorTypeAndShapeInfo *info = NULL;

you also need to free inputs and outputs in the end

@alonre24 alonre24 merged commit a874faf into master Apr 20, 2021
@alonre24 alonre24 deleted the MODELEXECUTE_command branch April 20, 2021 08:12
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants