Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/model.c
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ static void *RAI_Model_RdbLoad(struct RedisModuleIO *io, int encver) {
model->infokey =
RAI_AddStatsEntry(stats_ctx, stats_keystr, RAI_MODEL, backend, stats_devicestr, stats_tag);

RedisModule_Free(stats_keystr);
RedisModule_FreeString(NULL, stats_keystr);

return model;
}
Expand Down
11 changes: 8 additions & 3 deletions src/redisai.c
Original file line number Diff line number Diff line change
Expand Up @@ -471,8 +471,9 @@ int RedisAI_ModelGet_RedisCommand(RedisModuleCtx *ctx, RedisModuleString **argv,
RedisModule_ReplyWithCString(ctx, mto->devicestr);

RedisModule_ReplyWithCString(ctx, "tag");
RedisModuleString *empty_tag = RedisModule_CreateString(ctx, "", 0);
RedisModuleString *empty_tag = RedisModule_CreateString(NULL, "", 0);
RedisModule_ReplyWithString(ctx, mto->tag ? mto->tag : empty_tag);
RedisModule_FreeString(NULL, empty_tag);

RedisModule_ReplyWithCString(ctx, "batchsize");
RedisModule_ReplyWithLongLong(ctx, (long)mto->opts.batchsize);
Expand Down Expand Up @@ -546,11 +547,13 @@ int RedisAI_ModelScan_RedisCommand(RedisModuleCtx *ctx, RedisModuleString **argv

RedisModule_ReplyWithArray(ctx, nkeys);

RedisModuleString *empty_tag = RedisModule_CreateString(NULL, "", 0);
for (long long i = 0; i < nkeys; i++) {
RedisModule_ReplyWithArray(ctx, 2);
RedisModule_ReplyWithString(ctx, keys[i]);
RedisModule_ReplyWithString(ctx, tags[i]);
RedisModule_ReplyWithString(ctx, tags[i] ? tags[i] : empty_tag);
}
RedisModule_FreeString(NULL, empty_tag);

RedisModule_Free(keys);
RedisModule_Free(tags);
Expand Down Expand Up @@ -787,11 +790,13 @@ int RedisAI_ScriptScan_RedisCommand(RedisModuleCtx *ctx, RedisModuleString **arg

RedisModule_ReplyWithArray(ctx, nkeys);

RedisModuleString *empty_tag = RedisModule_CreateString(NULL, "", 0);
for (long long i = 0; i < nkeys; i++) {
RedisModule_ReplyWithArray(ctx, 2);
RedisModule_ReplyWithString(ctx, keys[i]);
RedisModule_ReplyWithString(ctx, tags[i]);
RedisModule_ReplyWithString(ctx, tags[i] ? tags[i] : empty_tag);
}
RedisModule_FreeString(NULL, empty_tag);

RedisModule_Free(keys);
RedisModule_Free(tags);
Expand Down
4 changes: 2 additions & 2 deletions tests/flow/tests_pytorch.py
Original file line number Diff line number Diff line change
Expand Up @@ -859,7 +859,7 @@ def test_pytorch_modelscan_scriptscan(env):
ret = con.execute_command('AI.MODELSET', 'm1', 'TORCH', DEVICE, 'TAG', 'm:v1', 'BLOB', model_pb)
env.assertEqual(ret, b'OK')

ret = con.execute_command('AI.MODELSET', 'm2', 'TORCH', DEVICE, 'TAG', 'm:v1', 'BLOB', model_pb)
ret = con.execute_command('AI.MODELSET', 'm2', 'TORCH', DEVICE, 'BLOB', model_pb)
env.assertEqual(ret, b'OK')

script_filename = os.path.join(test_data_path, 'script.txt')
Expand All @@ -870,7 +870,7 @@ def test_pytorch_modelscan_scriptscan(env):
ret = con.execute_command('AI.SCRIPTSET', 's1', DEVICE, 'TAG', 's:v1', 'SOURCE', script)
env.assertEqual(ret, b'OK')

ret = con.execute_command('AI.SCRIPTSET', 's2', DEVICE, 'TAG', 's:v1', 'SOURCE', script)
ret = con.execute_command('AI.SCRIPTSET', 's2', DEVICE, 'SOURCE', script)
env.assertEqual(ret, b'OK')

ensureSlaveSynced(con, env)
Expand Down