RedisAI 无法将模型加载为 blob。我该如何排除故障?
RedisAI fails to load a model as a blob. How do I troubleshoot?
我正在 运行 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)
出现错误:
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)
查看调试器,我可以看到模型,它看起来像这样:
b'version https://git-lfs.github.com/spec/v1\noid
sha256:5a48ca053cf228a10023f11f92274efdaac7a0f991d7f15066add62523612137\nsize
63481382\n'
有人知道发生了什么事吗?也许我加载模型的方式有问题?格式?
我相信你忘记了 BLOB
关键字。见这里docs。
所以你的代码应该是这样的
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)
我正在 运行 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)
出现错误:
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)
查看调试器,我可以看到模型,它看起来像这样:
b'version https://git-lfs.github.com/spec/v1\noid sha256:5a48ca053cf228a10023f11f92274efdaac7a0f991d7f15066add62523612137\nsize 63481382\n'
有人知道发生了什么事吗?也许我加载模型的方式有问题?格式?
我相信你忘记了 BLOB
关键字。见这里docs。
所以你的代码应该是这样的
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)