RedisAI/redisai-py

ValueError

tatsuiman opened this issue · 2 comments

It becomes an error because a byte type response is returned

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-120-dc676108d415> in <module>
      1 client.tensorset('input', Tensor(DType.float, [1, 11], [1.47574819401444, 160.8588351431392, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 3.0, 0.0]))
      2 client.modelrun('model', ['input'], ['output'])
----> 3 output = client.tensorget('output')

/opt/conda/lib/python3.7/site-packages/redisai/client.py in tensorget(self, key, as_type, meta_only)
    242             return as_type(dtype, shape, [])
    243         else:
--> 244             return as_type.from_resp(dtype, shape, res[2])
    245 
    246     def scriptset(self, name, device, script):

/opt/conda/lib/python3.7/site-packages/redisai/client.py in from_resp(cls, dtype, shape, value)
     98         # recurse value, replacing each element of b'' with the
     99         # appropriate element
--> 100         _convert_to_num(dtype, value)
    101         return cls(dtype, shape, value)
    102 

/opt/conda/lib/python3.7/site-packages/redisai/client.py in _convert_to_num(dt, arr)
     58                 arr[ix] = float(obj)
     59             else:
---> 60                 arr[ix] = int(obj)
     61 
     62 

ValueError: invalid literal for int() with base 10: b'0.88191938400268555'

@tatsu-i Thank you so much for raising the issue. My gut says this has been fixed in the master. We will be pushing the new release soon. Meanwhile, can you check master and verify whether the issue still exists or not? ->

pip install git+https://github.com/RedisAI/redisai-py.git

Closing this issue considering this being fixed in master. Feel free to re-open if you have further concerns.