File tree Expand file tree Collapse file tree 2 files changed +20
-2
lines changed Expand file tree Collapse file tree 2 files changed +20
-2
lines changed Original file line number Diff line number Diff line change @@ -25,7 +25,10 @@ def modelstore(
25
25
) -> Sequence :
26
26
if name is None :
27
27
raise ValueError ("Model name was not given" )
28
- if device .upper () not in utils .allowed_devices :
28
+
29
+ # device format should be: "CPU | GPU [:<num>]"
30
+ device_type = device .split (":" )[0 ]
31
+ if device_type .upper () not in utils .allowed_devices :
29
32
raise ValueError (f"Device not allowed. Use any from { utils .allowed_devices } " )
30
33
if backend .upper () not in utils .allowed_backends :
31
34
raise ValueError (f"Backend not allowed. Use any from { utils .allowed_backends } " )
Original file line number Diff line number Diff line change @@ -342,7 +342,7 @@ def test_modelexecute_non_list_input_output(self):
342
342
ret = con .modelexecute ("m" , ["a" , "b" ], "out" )
343
343
self .assertEqual (ret , "OK" )
344
344
345
- def test_nonasciichar (self ):
345
+ def test_non_ascii_char (self ):
346
346
nonascii = "ĉ"
347
347
model_path = os .path .join (MODEL_DIR , tf_graph )
348
348
model_pb = load_model (model_path )
@@ -363,6 +363,21 @@ def test_nonasciichar(self):
363
363
tensor = con .tensorget ("c" + nonascii )
364
364
self .assertTrue ((np .allclose (tensor , [4.0 , 9.0 ])))
365
365
366
+ def test_device_with_id (self ):
367
+ model_path = os .path .join (MODEL_DIR , tf_graph )
368
+ model_pb = load_model (model_path )
369
+ con = self .get_client ()
370
+ ret = con .modelstore (
371
+ "m" ,
372
+ "tf" ,
373
+ "cpu:1" ,
374
+ model_pb ,
375
+ inputs = ["a" , "b" ],
376
+ outputs = ["mul" ],
377
+ tag = "v1.0" ,
378
+ )
379
+ self .assertEqual ('OK' , ret )
380
+
366
381
def test_run_tf_model (self ):
367
382
model_path = os .path .join (MODEL_DIR , tf_graph )
368
383
bad_model_path = os .path .join (MODEL_DIR , torch_graph )
You can’t perform that action at this time.
0 commit comments