Skip to content

Non-tensor models #249

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

Open
irthomasthomas opened this issue Nov 21, 2019 · 13 comments
Open

Non-tensor models #249

irthomasthomas opened this issue Nov 21, 2019 · 13 comments
Assignees

Comments

@irthomasthomas
Copy link

Hi
I uploaded an example of a non-tensor output model. It produces two warnings. "UserWarning: Tensor APIs are depricated and will be removed from the future release." and on the server I get "ERR: non-tensor output from ONNX models, ignoring (currently unsupported)"

When I use the redisai python client it seems to predict ok despite the error. So I then tried to do the same in gears and I managed to get a segfault on model run, but I don't know if that's my fault or a separate gears issue, or the same issue.

Here's the scripts you need to test. https://github.com/irthomasthomas/redisai-non-tensor-model Just change the vectorizer path in the gears file. I commented out the line which segfaults.

Cheers
Thomas

@irthomasthomas
Copy link
Author

Here's the error using non-tensor output, and the segfault I get when I run the model in gears.

21273:M 21 Nov 2019 15:20:25.319 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
21273:M 21 Nov 2019 15:20:25.319 # Server initialized
21273:M 21 Nov 2019 15:20:25.319 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
21273:M 21 Nov 2019 15:20:25.320 * Module 'ai' loaded from /root/dev/redis-5.0.5/RedisAI/install-cpu/redisai.so
21273:M 21 Nov 2019 15:20:25.323 * RedisGears version 0.4.0, git_sha=1cf91d26cfe7c3875c3c1e318fa3071fb73e94ae
21273:M 21 Nov 2019 15:20:25.323 * PythonHomeDir:/opt/redislabs/lib/modules/python3/
21273:M 21 Nov 2019 15:20:25.323 * MaxExecutions:10000000
21273:M 21 Nov 2019 15:20:25.323 * ProfileExecutions:0
21273:M 21 Nov 2019 15:20:25.323 * PythonAttemptTraceback:1
21273:M 21 Nov 2019 15:20:25.323 * RedisAI api loaded successfully.
could not initialize RediSearch_CheckApiVersionCompatibility
21273:M 21 Nov 2019 15:20:25.323 # could not initialize RediSearch api, running without Search support.
21273:M 21 Nov 2019 15:20:25.341 * Initializing Python environment with: exec(open('/opt/redislabs/lib/modules/python3/.venv/bin/activate_this.py').read(), {'file': '/opt/redislabs/lib/modules/python3/.venv/bin/activate_this.py'})
21273:M 21 Nov 2019 15:20:25.436 * Module 'rg' loaded from /root/dev/redis-5.0.5/RedisGears/redisgears.so
21273:M 21 Nov 2019 15:20:25.436 * Module 'timeseries' loaded from /root/dev/redis-5.0.5/RedisTimeSeries/bin/linux-x64-release/redistimeseries.so
21273:M 21 Nov 2019 15:20:25.436 * DB loaded from disk: 0.000 seconds
21273:M 21 Nov 2019 15:20:25.436 * Ready to accept connections
21273:M 21 Nov 2019 15:20:37.455 # Backend ONNX not loaded, will try loading default backend

21273:M 21 Nov 2019 15:20:37.457 * ONNX backend loaded from /root/dev/redis-5.0.5/RedisAI/install-cpu/backends/redisai_onnxruntime/redisai_onnxruntime.so
ERR: non-tensor output from ONNX models, ignoring (currently unsupported).
1574349641974-0
apples
ERR: non-tensor output from ONNX models, ignoring (currently unsupported).

=== REDIS BUG REPORT START: Cut & paste starting from here ===
21273:M 21 Nov 2019 15:20:42.478 # Redis 5.0.5 crashed by signal: 11
21273:M 21 Nov 2019 15:20:42.478 # Crashed running the instruction at: 0x7f32b21f0d23
21273:M 21 Nov 2019 15:20:42.478 # Accessing address: 0x40
21273:M 21 Nov 2019 15:20:42.478 # Failed assertion: (:0)

------ STACK TRACE ------
EIP:
/root/dev/redis-5.0.5/RedisAI/install-cpu/redisai.so(RAI_TensorGetShallowCopy+0x3)[0x7f32b21f0d23]

Backtrace:
./src/redis-server 127.0.0.1:6379(logStackTrace+0x5a)[0x55fbd05cf37a]
./src/redis-server 127.0.0.1:6379(sigsegvHandler+0xb1)[0x55fbd05cfb31]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x12890)[0x7f32b497e890]
/root/dev/redis-5.0.5/RedisAI/install-cpu/redisai.so(RAI_TensorGetShallowCopy+0x3)[0x7f32b21f0d23]
/root/dev/redis-5.0.5/RedisGears/redisgears.so(+0xa14f0)[0x7f32b14784f0]
/root/dev/redis-5.0.5/RedisGears/redisgears.so(_PyMethodDef_RawFastCallKeywords+0xfb)[0x7f32b14a486b]
/root/dev/redis-5.0.5/RedisGears/redisgears.so(_PyCFunction_FastCallKeywords+0x25)[0x7f32b14a4a95]
/root/dev/redis-5.0.5/RedisGears/redisgears.so(_PyEval_EvalFrameDefault+0x86da)[0x7f32b14645da]
/root/dev/redis-5.0.5/RedisGears/redisgears.so(+0x83dff)[0x7f32b145adff]
/root/dev/redis-5.0.5/RedisGears/redisgears.so(_PyFunction_FastCallDict+0x2b7)[0x7f32b14a44b7]
/root/dev/redis-5.0.5/RedisGears/redisgears.so(RedisGearsPy_PyCallbackForEach+0x6d)[0x7f32b147b5ad]
/root/dev/redis-5.0.5/RedisGears/redisgears.so(+0x93cfb)[0x7f32b146acfb]
/root/dev/redis-5.0.5/RedisGears/redisgears.so(+0x93c7b)[0x7f32b146ac7b]
/root/dev/redis-5.0.5/RedisGears/redisgears.so(EPStatus_RunningAction+0x62)[0x7f32b146c9d2]
/root/dev/redis-5.0.5/RedisGears/redisgears.so(+0x958c4)[0x7f32b146c8c4]
/root/dev/redis-5.0.5/RedisGears/redisgears.so(+0x974d8)[0x7f32b146e4d8]
/root/dev/redis-5.0.5/RedisGears/redisgears.so(+0x283443)[0x7f32b165a443]
/root/dev/redis-5.0.5/RedisGears/redisgears.so(+0x283747)[0x7f32b165a747]
/root/dev/redis-5.0.5/RedisGears/redisgears.so(+0x283d85)[0x7f32b165ad85]
/root/dev/redis-5.0.5/RedisGears/redisgears.so(event_base_loop+0x2da)[0x7f32b165b508]
/root/dev/redis-5.0.5/RedisGears/redisgears.so(+0x954ee)[0x7f32b146c4ee]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x76db)[0x7f32b49736db]
/lib/x86_64-linux-gnu/libc.so.6(clone+0x3f)[0x7f32b469c88f]

------ INFO OUTPUT ------

Server

redis_version:5.0.5
redis_git_sha1:00000000
redis_git_dirty:0
redis_build_id:66a3f867dd689ca0
redis_mode:standalone
os:Linux 4.15.0-22-generic x86_64
arch_bits:64
multiplexing_api:epoll
atomicvar_api:atomic-builtin
gcc_version:7.4.0
process_id:21273
run_id:a8128b5fc1999a09bdf797d1a0eae10276833c6f
tcp_port:6379
uptime_in_seconds:17
uptime_in_days:0
hz:10
configured_hz:10
lru_clock:14068554
executable:/root/dev/redis-5.0.5/./src/redis-server
config_file:/root/dev/redis-5.0.5/redis.conf

Clients

connected_clients:1
client_recent_max_input_buffer:2
client_recent_max_output_buffer:0
blocked_clients:0

Memory

used_memory:45603648
used_memory_human:43.49M
used_memory_rss:84058112
used_memory_rss_human:80.16M
used_memory_peak:45603648
used_memory_peak_human:43.49M
used_memory_peak_perc:105.84%
used_memory_overhead:808946
used_memory_startup:791832
used_memory_dataset:44794702
used_memory_dataset_perc:99.96%
allocator_allocated:43820368
allocator_active:44613632
allocator_resident:48537600
total_system_memory:8266579968
total_system_memory_human:7.70G
used_memory_lua:37888
used_memory_lua_human:37.00K
used_memory_scripts:0
used_memory_scripts_human:0B
number_of_cached_scripts:0
maxmemory:0
maxmemory_human:0B
maxmemory_policy:noeviction
allocator_frag_ratio:1.02
allocator_frag_bytes:793264
allocator_rss_ratio:1.09
allocator_rss_bytes:3923968
rss_overhead_ratio:1.73
rss_overhead_bytes:35520512
mem_fragmentation_ratio:1.95
mem_fragmentation_bytes:40968792
mem_not_counted_for_evict:0
mem_replication_backlog:0
mem_clients_slaves:0
mem_clients_normal:16922
mem_aof_buffer:0
mem_allocator:jemalloc-5.1.0
active_defrag_running:0
lazyfree_pending_objects:0

Persistence

loading:0
rdb_changes_since_last_save:4
rdb_bgsave_in_progress:0
rdb_last_save_time:1574349625
rdb_last_bgsave_status:ok
rdb_last_bgsave_time_sec:-1
rdb_current_bgsave_time_sec:-1
rdb_last_cow_size:0
aof_enabled:0
aof_rewrite_in_progress:0
aof_rewrite_scheduled:0
aof_last_rewrite_time_sec:-1
aof_current_rewrite_time_sec:-1
aof_last_bgrewrite_status:ok
aof_last_write_status:ok
aof_last_cow_size:0

Stats

total_connections_received:3
total_commands_processed:8
instantaneous_ops_per_sec:1
total_net_input_bytes:3709
total_net_output_bytes:81
instantaneous_input_kbps:0.03
instantaneous_output_kbps:0.01
rejected_connections:0
sync_full:0
sync_partial_ok:0
sync_partial_err:0
expired_keys:0
expired_stale_perc:0.00
expired_time_cap_reached_count:0
evicted_keys:0
keyspace_hits:6
keyspace_misses:0
pubsub_channels:0
pubsub_patterns:0
latest_fork_usec:0
migrate_cached_sockets:0
slave_expires_tracked_keys:0
active_defrag_hits:0
active_defrag_misses:0
active_defrag_key_hits:0
active_defrag_key_misses:0

Replication

role:master
connected_slaves:0
master_replid:c71536cd52bc0c8819b4594a2f680c7e732ce4ab
master_replid2:0000000000000000000000000000000000000000
master_repl_offset:0
second_repl_offset:-1
repl_backlog_active:0
repl_backlog_size:1048576
repl_backlog_first_byte_offset:0
repl_backlog_histlen:0

CPU

used_cpu_sys:0.279832
used_cpu_user:0.943436
used_cpu_sys_children:0.000000
used_cpu_user_children:0.000000

Commandstats

cmdstat_rg.pyexecute:calls=1,usec=324010,usec_per_call=324010.00
cmdstat_ai.tensorget:calls=1,usec=6,usec_per_call=6.00
cmdstat_ai.tensorset:calls=1,usec=17,usec_per_call=17.00
cmdstat_xadd:calls=1,usec=835,usec_per_call=835.00
cmdstat_ai.modelrun:calls=1,usec=22,usec_per_call=22.00
cmdstat_xread:calls=1,usec=50,usec_per_call=50.00
cmdstat_ai.modelset:calls=1,usec=9727,usec_per_call=9727.00
cmdstat_flushdb:calls=1,usec=4,usec_per_call=4.00

Cluster

cluster_enabled:0

Keyspace

db0:keys=4,expires=0,avg_ttl=0

------ CLIENT LIST OUTPUT ------
id=4 addr=127.0.0.1:58382 fd=17 name= age=13 idle=1 flags=N db=0 sub=0 psub=0 multi=-1 qbuf=0 qbuf-free=0 obl=0 oll=0 omem=0 events=r cmd=xadd

------ REGISTERS ------
21273:M 21 Nov 2019 15:20:42.479 #
RAX:0000000000000000 RBX:00007f3289db1d08
RCX:00007f3280000000 RDX:00007f32b19bb460
RDI:0000000000000000 RSI:00007f3294358d5c
RBP:0000000000000001 RSP:00007f32affcef38
R8 :0000000000000000 R9 :0000000000000188
R10:00007f32affcfef8 R11:0000000000000030
R12:00007f3289db1c88 R13:00007f3289d9f540
R14:00007f32b19dcea0 R15:00007f32b21f0d20
RIP:00007f32b21f0d23 EFL:0000000000010206
CSGSFS:002b000000000033
21273:M 21 Nov 2019 15:20:42.479 # (00007f32affcef47) -> 0000000000000000
21273:M 21 Nov 2019 15:20:42.479 # (00007f32affcef46) -> 00007f3200000001
21273:M 21 Nov 2019 15:20:42.479 # (00007f32affcef45) -> 00007f32ac5b6fd8
21273:M 21 Nov 2019 15:20:42.479 # (00007f32affcef44) -> 00007f32b14a486b
21273:M 21 Nov 2019 15:20:42.479 # (00007f32affcef43) -> 0000000000000001
21273:M 21 Nov 2019 15:20:42.479 # (00007f32affcef42) -> 0000000000000000
21273:M 21 Nov 2019 15:20:42.479 # (00007f32affcef41) -> 00007f32b1478440
21273:M 21 Nov 2019 15:20:42.479 # (00007f32affcef40) -> 00007f32b1951ae0
21273:M 21 Nov 2019 15:20:42.479 # (00007f32affcef3f) -> 00007f32ac54a2e0
21273:M 21 Nov 2019 15:20:42.479 # (00007f32affcef3e) -> 00007f32b19d8500
21273:M 21 Nov 2019 15:20:42.479 # (00007f32affcef3d) -> 00007f32affcf0a0
21273:M 21 Nov 2019 15:20:42.479 # (00007f32affcef3c) -> 5e083efb228fb000
21273:M 21 Nov 2019 15:20:42.479 # (00007f32affcef3b) -> 0000000000000000
21273:M 21 Nov 2019 15:20:42.479 # (00007f32affcef3a) -> 0000000000000000
21273:M 21 Nov 2019 15:20:42.479 # (00007f32affcef39) -> 0000000000000000
21273:M 21 Nov 2019 15:20:42.479 # (00007f32affcef38) -> 00007f32b14784f0

------ FAST MEMORY TEST ------
21273:M 21 Nov 2019 15:20:42.479 # Bio thread for job type #0 terminated
21273:M 21 Nov 2019 15:20:42.479 # Bio thread for job type #1 terminated
21273:M 21 Nov 2019 15:20:42.479 # Bio thread for job type #2 terminated
*** Preparing to test memory region 55fbd0905000 (2252800 bytes)
*** Preparing to test memory region 55fbd219a000 (2109440 bytes)
*** Preparing to test memory region 7f328821b000 (4096 bytes)
*** Preparing to test memory region 7f32884b8000 (8192 bytes)
*** Preparing to test memory region 7f32886e7000 (4096 bytes)
*** Preparing to test memory region 7f32888ff000 (1011712 bytes)
*** Preparing to test memory region 7f3288e6a000 (8192 bytes)
*** Preparing to test memory region 7f32890c4000 (8192 bytes)
*** Preparing to test memory region 7f328931c000 (4096 bytes)
*** Preparing to test memory region 7f3289562000 (4096 bytes)
*** Preparing to test memory region 7f3289a04000 (6291456 bytes)
*** Preparing to test memory region 7f328a21e000 (4096 bytes)
*** Preparing to test memory region 7f328a673000 (4096 bytes)
*** Preparing to test memory region 7f328aaac000 (4096 bytes)
*** Preparing to test memory region 7f328acdd000 (4096 bytes)
*** Preparing to test memory region 7f328b122000 (4096 bytes)
*** Preparing to test memory region 7f328b402000 (12288 bytes)
*** Preparing to test memory region 7f328b6c4000 (8192 bytes)
*** Preparing to test memory region 7f328b90c000 (4096 bytes)
*** Preparing to test memory region 7f328bf46000 (4096 bytes)
*** Preparing to test memory region 7f328cc00000 (4096 bytes)
*** Preparing to test memory region 7f328d058000 (4096 bytes)
*** Preparing to test memory region 7f328d269000 (5242880 bytes)
*** Preparing to test memory region 7f328d986000 (4096 bytes)
*** Preparing to test memory region 7f328dbb9000 (4096 bytes)
*** Preparing to test memory region 7f328ef77000 (36864 bytes)
*** Preparing to test memory region 7f328f219000 (8192 bytes)
*** Preparing to test memory region 7f328fbb3000 (4096 bytes)
*** Preparing to test memory region 7f328fdec000 (4096 bytes)
*** Preparing to test memory region 7f3290000000 (159744 bytes)
*** Preparing to test memory region 7f3294119000 (4194304 bytes)
*** Preparing to test memory region 7f3294884000 (4096 bytes)
*** Preparing to test memory region 7f3294d5b000 (8192 bytes)
*** Preparing to test memory region 7f3295370000 (3670016 bytes)
*** Preparing to test memory region 7f32958f4000 (3145728 bytes)
*** Preparing to test memory region 7f32964aa000 (4096 bytes)
*** Preparing to test memory region 7f3296b26000 (4096 bytes)
*** Preparing to test memory region 7f3296d8c000 (8192 bytes)
*** Preparing to test memory region 7f3296fff000 (8192 bytes)
*** Preparing to test memory region 7f3297210000 (2621440 bytes)
*** Preparing to test memory region 7f3298000000 (4194304 bytes)
*** Preparing to test memory region 7f32985bd000 (6291456 bytes)
*** Preparing to test memory region 7f3298e78000 (12288 bytes)
*** Preparing to test memory region 7f32996e0000 (4096 bytes)
*** Preparing to test memory region 7f3299d16000 (4096 bytes)
*** Preparing to test memory region 7f329a190000 (8192 bytes)
*** Preparing to test memory region 7f329a3cf000 (4096 bytes)
*** Preparing to test memory region 7f329a676000 (8192 bytes)
*** Preparing to test memory region 7f329b322000 (5242880 bytes)
*** Preparing to test memory region 7f329be69000 (4194304 bytes)
*** Preparing to test memory region 7f329c269000 (67108864 bytes)
*** Preparing to test memory region 7f32a0269000 (33554432 bytes)
*** Preparing to test memory region 7f32a3f7d000 (45056 bytes)
*** Preparing to test memory region 7f32a4000000 (135168 bytes)
*** Preparing to test memory region 7f32a8112000 (8388608 bytes)
*** Preparing to test memory region 7f32a8913000 (8388608 bytes)
*** Preparing to test memory region 7f32a9114000 (8388608 bytes)
*** Preparing to test memory region 7f32a9c05000 (4096 bytes)
*** Preparing to test memory region 7f32aa1d8000 (135168 bytes)
*** Preparing to test memory region 7f32aa200000 (4194304 bytes)
*** Preparing to test memory region 7f32aa607000 (8388608 bytes)
*** Preparing to test memory region 7f32ab5d3000 (16384 bytes)
*** Preparing to test memory region 7f32abea3000 (8192 bytes)
*** Preparing to test memory region 7f32ac4c5000 (3670016 bytes)
*** Preparing to test memory region 7f32ad73d000 (4096 bytes)
*** Preparing to test memory region 7f32ae64c000 (12288 bytes)
*** Preparing to test memory region 7f32aec7c000 (3145728 bytes)
*** Preparing to test memory region 7f32af180000 (4718592 bytes)
*** Preparing to test memory region 7f32af7d2000 (8388608 bytes)
*** Preparing to test memory region 7f32affd2000 (2097152 bytes)
*** Preparing to test memory region 7f32b01d3000 (8388608 bytes)
*** Preparing to test memory region 7f32b09d4000 (8388608 bytes)
*** Preparing to test memory region 7f32b19bc000 (139264 bytes)
*** Preparing to test memory region 7f32b19df000 (8388608 bytes)
*** Preparing to test memory region 7f32b23fe000 (8388608 bytes)
*** Preparing to test memory region 7f32b2bff000 (8388608 bytes)
*** Preparing to test memory region 7f32b3400000 (8388608 bytes)
*** Preparing to test memory region 7f32b3c00000 (8388608 bytes)
*** Preparing to test memory region 7f32b447a000 (1052672 bytes)
*** Preparing to test memory region 7f32b4968000 (16384 bytes)
*** Preparing to test memory region 7f32b4b87000 (16384 bytes)
*** Preparing to test memory region 7f32b552e000 (32768 bytes)
*** Preparing to test memory region 7f32b5554000 (4096 bytes)
*** Preparing to test memory region 7f32b555e000 (4096 bytes)
*** Preparing to test memory region 7ffe12a0b000 (8192 bytes)
.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.[1] 21273 segmentation fault ./src/redis-server /root/dev/redis-5.0.5/redis.conf

@lantiga
Copy link
Contributor

lantiga commented Nov 22, 2019

Hi @irthomasthomas,
FYI the two warnings are unrelated. The first

"UserWarning: Tensor APIs are depricated and will be removed from the future release."

(apart from the spelling issues that I just noted /cc @hhsecond ) only indicates that you are using a deprecated API for the RedisAI Python client. Things have gotten simpler since then, you can just set NumPy arrays directly to TENSORSET. In your code

tensor = redisai.BlobTensor.from_numpy(sample.astype(np.float32))
rai.tensorset('tensor', tensor)

becomes

rai.tensorset('tensor', sample.astype(np.float32))

The other warning is telling you that for the time being we do not support outputs from ONNX and ONNX-ML models that are not tensors. So if the model outputs a raw scalar, for instance, or a string, that output will not be returned. However, this is not a blocking error, and the remaining tensor outputs are returned to the client.

@gkorland @MeirShpilraien maybe more of a Gears issue, i.e. the way this situation is handled at the API level?

@irthomasthomas
Copy link
Author

irthomasthomas commented Nov 23, 2019 via email

@hhsecond
Copy link

@irthomasthomas That's an internal warning that says internally it's still using the tensor APIs. I would say don't bother about it for now and I understand how confusing that could be. So I am pushing another version of redisai-py soon with with APIs for the latest changes that came into RedisAI and will have a fix for this warning as well. I have also created another issue in redisai-py repo to track this.

Thanks,
S

@irthomasthomas
Copy link
Author

@hhsecond
Thanks for the help. Please can you take a look again at my example, I just updated it. https://github.com/irthomasthomas/redisai-non-tensor-model

It no longer crashes but produces "ERROR: type 0 is not supported in this function" and returns NONE. Am I doing something wrong in the gears version?

Cheers

@dsmanl
Copy link

dsmanl commented Jun 25, 2020

Dear all, I am using the latest version of the docker image redislabs/redismod:edge in order to learn more about RedisGears and RedisAI. It seems that I am facing the same issue as @irthomasthomas as I get the error when running a random forest classifier converted from scikit-learn to ONNX: ERR: non-tensor output from ONNX models, ignoring (currently unsupported). Are there any updates on this issue?

Thanks a lot!

@lantiga
Copy link
Contributor

lantiga commented Jun 25, 2020

Hi @dsmanl, we haven't looked into this recently as we are currently working at performance-oriented features, but it's something we'll need to solve soon.

The concept of a tensor is entrenched in RedisAI, but we could think about converting non-tensor output to Redis data structures (e.g. nested lists), for clients to consume.

You also might be interested in taking a look at https://github.com/microsoft/hummingbird, which converts scikit-learn models to PyTorch. It's probably not torch.jit exportable at the moment, but there's a recent issue on that: microsoft/hummingbird#115

@dsmanl
Copy link

dsmanl commented Jun 26, 2020

@lantiga thanks a lot! I have heard about `hummingbird, but have not used it yet.

@interesaaat
Copy link

Hey, FYI, we have just merged the PR and torch.jit is now supported in the latest Hummingbird release (0.0.5).

@bsbodden
Copy link

@interesaaat thanks, I just updated an example to use the torch.jit backend to convert a Scikit Learn model to load into RedisAI. The only gotcha is the new .ZIP format from PyTorch which required me to pull the protobuf blob out of the .ZIP

See redis-developer/redisai-iris#1

@interesaaat
Copy link

Ah this is because you only need the actual torch blob, not the Hummingbird zip, correct? I think you can achieve the same by pulling the actual model out of the Hummingbird container (i.e., torch_model.model) and just save that. Or you can convert the model and pass extra_config={"container": False} if you only want the torch model directly as a result.

@bsbodden
Copy link

Ah this is because you only need the actual torch blob, not the Hummingbird zip, correct? I think you can achieve the same by pulling the actual model out of the Hummingbird container (i.e., torch_model.model) and just save that. Or you can convert the model and pass extra_config={"container": False} if you only want the torch model directly as a result.

I tried the torch_model.model route but it did not work for some reason, could be how I save it. I think what I found was to do torch.save(torch_model,model) but I could load that into RedisAI.

@interesaaat
Copy link

Yes either that or torch_model.save(location). This is what we are doing inside Hummingbird actually.

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

7 participants