Skip to content

Conversation

alonre24
Copy link
Collaborator

@alonre24 alonre24 commented Jun 16, 2021

This PR extends the external commands that torch script already supports through RedisAI (executing unblocking Redis commands), to support the execution of RedisAI models as well by adding a new redisAI.execute_model command to torch script. This command receives a model name that is stored in RedisAI, a list of the input tensors and the outputs number, and returns the output tensors.

This is tested by running models from torch script in all 3 backends.
This PR includes a unified arrangement of the device_id field in dl_tensor - this should be -1 whenever tensor is created for default CPU, otherwise torch interpreters it as if it should be sent to a different device (for device_id=0, the device is considered as CPU:0 insread of CPU).

Todo: figure out how (or if) to pass error message from torch extension back to RedisAI, to have more informative failing (currently a generic error message is returned)

alonre24 added 30 commits May 26, 2021 10:41
… multiple devices). Tests pass (new feature hasn't tested yet)
…w device is introduced and use rwlock to synchronise.
…'t overflows than the tensor type in TENSORSET.
…om backend len (supported only for onnx now) in INFO MODULES command.
- Add a state flag to every entry in the onnx run sessions array and update it atomically, to avoid situations where main threads and bg thread both access the runOptions field.
- Refactor the info_modules section, and change AI.INFO command so it must receive a module/script key. The other info will be accessible as part of the info modules command.
@alonre24 alonre24 requested review from lantiga and DvirDukhan June 16, 2021 11:28
@codecov
Copy link

codecov bot commented Jun 17, 2021

Codecov Report

Merging #787 (10988d3) into master (0000228) will increase coverage by 6.28%.
The diff coverage is 81.75%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #787      +/-   ##
==========================================
+ Coverage   74.11%   80.40%   +6.28%     
==========================================
  Files          39       52      +13     
  Lines        6081     7883    +1802     
==========================================
+ Hits         4507     6338    +1831     
+ Misses       1574     1545      -29     
Impacted Files Coverage Δ
src/redis_ai_types/model_type.c 70.00% <ø> (ø)
src/redis_ai_types/script_type.c 70.00% <ø> (+5.00%) ⬆️
src/redis_ai_types/tensor_type.c 73.33% <ø> (ø)
src/serialization/AOF/rai_aof_rewrite.c 0.00% <0.00%> (ø)
tests/module/DAG_utils.c 88.23% <ø> (ø)
tests/module/LLAPI.c 74.46% <ø> (ø)
tests/unit/rmalloc.h 100.00% <ø> (ø)
tests/unit/unit_tests_err.cpp 100.00% <ø> (ø)
src/backends/libtflite_c/tflite_c.cpp 57.60% <35.71%> (ø)
src/backends/tflite.c 66.01% <57.14%> (+2.19%) ⬆️
... and 77 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 7a5d18d...10988d3. Read the comment docs.

Copy link

@DvirDukhan DvirDukhan left a comment

Choose a reason for hiding this comment

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

looks very good
few comments

Copy link

@DvirDukhan DvirDukhan left a comment

Choose a reason for hiding this comment

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

few comments

@alonre24 alonre24 added ci-test and removed ci-test labels Jun 24, 2021
@alonre24 alonre24 merged commit 406b337 into master Jun 24, 2021
@alonre24 alonre24 deleted the run_model_from_script branch June 24, 2021 10:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants