RedisAI fails to load a model as a blob. How do I troubleshoot?

I am working on running this code in Python:

import redis 
conn = redis.Redis(host=url.hostname, port=url.port)

with open('models/tiny-yolo-voc.pb', 'rb') as f:
        model = f.read()
        res = conn.execute_command('AI.MODELSET', 'yolo:model', 'TF', args.device, 'INPUTS', 'input', 'OUTPUTS', 'output', model)

and getting an error:

Exception has occurred: ResponseError Insufficient arguments, missing model BLOB File “/home/baruchk/EdgeRealtimeVideoAnalytics/app/init.py”, line 36, in res = conn.execute_command(‘AI.MODELSET’, ‘yolo:model’, ‘TF’, args.device, ‘INPUTS’, ‘input’, ‘OUTPUTS’, ‘output’, model)

Looking at the debugger, I can see the model, which looks like this:

b’version https://git-lfs.github.com/spec/v1noid sha256:5a48ca053cf228a10023f11f92274efdaac7a0f991d7f15066add62523612137nsize 63481382n’

Does anyone have an idea of what is going on? Is there an issue with the way I’m loading the model, perhaps? The format?

Answer

I believe you forgot the BLOB keyword. See here in the docs. So your code should be something like

import redis 
conn = redis.Redis(host=url.hostname, port=url.port)

with open('models/tiny-yolo-voc.pb', 'rb') as f:
        model = f.read()
        res = conn.execute_command('AI.MODELSET', 'yolo:model', 'TF', args.device, 'INPUTS', 'input', 'OUTPUTS', 'output', 'BLOB', model)