Skip to content

Commit 328d717

Browse files
committed
[fix] fixed modelset. added onnx and tf larger models
1 parent 5c7376c commit 328d717

File tree

6 files changed

+187
-47
lines changed

6 files changed

+187
-47
lines changed

package-lock.json

+110-10
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+3-2
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,15 @@
3636
},
3737
"homepage": "https://github.com/RedisAI/redisai-js#readme",
3838
"dependencies": {
39-
"@types/redis": "^2.8.18",
40-
"redis": "^3.0.2"
39+
"redis": "^3.0.2",
40+
"@types/redis": "^2.8.21"
4141
},
4242
"devDependencies": {
4343
"@istanbuljs/nyc-config-typescript": "^1.0.1",
4444
"@types/chai": "^4.2.11",
4545
"@types/mocha": "^7.0.2",
4646
"@types/node": "^13.13.4",
47+
"@types/redis": "^2.8.21",
4748
"chai": "^4.2.0",
4849
"codecov": "^3.6.5",
4950
"coveralls": "^3.1.0",

src/backend.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export enum Backend {
44
// Torch represents a Torch backend
55
Torch = 'TORCH',
66
// ONNX represents an ONNX backend
7-
ONNX = 'ORT',
7+
ONNX = 'ONNX',
88
// TFLite represents a TensorFlow backend
99
TFLite = 'TFLITE',
1010
}

src/client.ts

+14-14
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { RedisClient } from 'redis';
1+
import { Callback, RedisClient } from 'redis';
22
import { Tensor } from './tensor';
33
import { Model } from './model';
44
import * as util from 'util';
@@ -26,7 +26,7 @@ export class Client {
2626
}
2727

2828
public tensorset(keName: string, t: Tensor): Promise<any> {
29-
const args = [keName, t.dtype];
29+
const args: any[] = [keName, t.dtype];
3030
t.shape.forEach((value) => args.push(value.toString()));
3131
if (t.data != null) {
3232
args.push('VALUES');
@@ -36,7 +36,7 @@ export class Client {
3636
}
3737

3838
public tensorget(keName: string): Promise<any> {
39-
const args = [keName, 'META', 'VALUES'];
39+
const args: any[] = [keName, 'META', 'VALUES'];
4040
return this._sendCommand('ai.tensorget', args)
4141
.then((reply: any[]) => {
4242
let dt = null;
@@ -69,7 +69,7 @@ export class Client {
6969
}
7070

7171
public modelset(keName: string, m: Model): Promise<any> {
72-
const args = [keName, m.backend, m.device];
72+
let args: any[] = [keName, m.backend.toString(), m.device];
7373
if (m.tag !== undefined) {
7474
args.push('TAG');
7575
args.push(m.tag.toString());
@@ -83,25 +83,25 @@ export class Client {
8383
m.outputs.forEach((value) => args.push(value));
8484
}
8585
args.push('BLOB');
86-
args.push(m.blob.toString());
86+
args.push(m.blob);
8787
return this._sendCommand('ai.modelset', args);
8888
}
8989

9090
public modelrun(modelName: string, inputs: string[], outputs: string[]): Promise<any> {
91-
const args = [modelName, 'INPUTS'];
91+
const args: any[] = [modelName, 'INPUTS'];
9292
inputs.forEach((value) => args.push(value));
9393
args.push('OUTPUTS');
9494
outputs.forEach((value) => args.push(value));
9595
return this._sendCommand('ai.modelrun', args);
9696
}
9797

9898
public modeldel(modelName: string): Promise<any> {
99-
const args = [modelName];
99+
const args: any[] = [modelName];
100100
return this._sendCommand('ai.modeldel', args);
101101
}
102102

103103
public modelget(modelName: string): Promise<any> {
104-
const args = [modelName, 'META', 'BLOB'];
104+
const args: any[] = [modelName, 'META', 'BLOB'];
105105
return this._sendCommand('ai.modelget', args)
106106
.then((reply: any[]) => {
107107
let backend = null;
@@ -143,7 +143,7 @@ export class Client {
143143
}
144144

145145
public scriptset(keName: string, s: Script): Promise<any> {
146-
const args = [keName, s.device];
146+
const args: any[] = [keName, s.device];
147147
if (s.tag !== undefined) {
148148
args.push('TAG');
149149
args.push(s.tag);
@@ -154,20 +154,20 @@ export class Client {
154154
}
155155

156156
public scriptrun(scriptName: string, functionName: string, inputs: string[], outputs: string[]): Promise<any> {
157-
const args = [scriptName, functionName, 'INPUTS'];
157+
const args: any[] = [scriptName, functionName, 'INPUTS'];
158158
inputs.forEach((value) => args.push(value));
159159
args.push('OUTPUTS');
160160
outputs.forEach((value) => args.push(value));
161161
return this._sendCommand('ai.scriptrun', args);
162162
}
163163

164164
public scriptdel(scriptName: string): Promise<any> {
165-
const args = [scriptName];
165+
const args: any[] = [scriptName];
166166
return this._sendCommand('ai.scriptdel', args);
167167
}
168168

169169
public scriptget(scriptName: string): Promise<any> {
170-
const args = [scriptName, 'META', 'SOURCE'];
170+
const args: any[] = [scriptName, 'META', 'SOURCE'];
171171
return this._sendCommand('ai.scriptget', args)
172172
.then((reply: any[]) => {
173173
let device = null;
@@ -208,7 +208,7 @@ export class Client {
208208
* @param keyName
209209
*/
210210
public infoResetStat(keyName: string): Promise<any> {
211-
const args = [keyName, 'RESETSTAT'];
211+
const args: any[] = [keyName, 'RESETSTAT'];
212212
return this._sendCommand('ai.info', args);
213213
}
214214

@@ -217,7 +217,7 @@ export class Client {
217217
* @param keyName
218218
*/
219219
public info(keyName: string): Promise<any> {
220-
const args = [keyName];
220+
const args: any[] = [keyName];
221221
return this._sendCommand('ai.info', args)
222222
.then((reply: any[]) => {
223223
let keystr: string | null = null;

0 commit comments

Comments
 (0)