RedisAI / JRedisAI

Java client for RedisAI

Home Page:https://redisai.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Exception with retrieving output tensors from TorchScript model

bsbodden opened this issue · comments

Version

 <dependency>
    <groupId>com.redislabs</groupId>
    <artifactId>jredisai</artifactId>
    <version>1.0.0-SNAPSHOT</version>
 </dependency>

Reproducer Project

Project containing a test to replicate the issue: [https://github.com/bsbodden/redisai-torch-test](https://github.com/bsbodden/redisai-torch-test)

Issue/Exception with retrieving output tensors

The test class RunModelsTest has two test methods:

🟢 testRunTensorFlowModel: original method from JRedisAI test suite - PASS
🔴 testRunTorchScriptModel: the method in question - FAIL

Using RedisAI docker image edge

docker run -p 6379:6379 --name redisai redislabs/redisai:edge-cpu

Module List

127.0.0.1:6379> MODULE LIST
1) 1) "name"
   2) "ai"
   3) "ver"
   4) (integer) 999999

Docker Image info

edge-cpu | 30b1cdcdbd52

Run with

./mvnw clean verify

The method loads a TorchScript pre-trained model that was created using https://github.com/redis-developer/redisai-iris

[ERROR] testRunTorchScriptModel  Time elapsed: 0.081 s  <<< ERROR!
java.lang.ClassCastException: java.lang.Long incompatible with [B
	at com.redislabs.ai.RunModelsTest.testRunTorchScriptModel(RunModelsTest.java:63)

The error happens on this line:

// AI.TENSORGET iris:inferences VALUES
Tensor inferences = client.getTensor("iris:inferences"); // 💥

@bsbodden Did you try the test on redisai:edge-cpu-bionic image?

-cpu-bionic

Just did. Same result.