46
46
47
47
TEST_MODES = ['IP' , # test_inferring_pretrained_model
48
48
'TI' , # test_consecutive_training_and_inferring
49
- 'SR' , # test_serialization
50
49
]
51
50
52
- ALL_MODES = ('IP' , 'TI' , 'SR' )
51
+ ALL_MODES = ('IP' , 'TI' )
53
52
54
53
ONE_ARGUMENT_INFER_CHECK = ('Dummy text' , None )
55
54
TWO_ARGUMENTS_INFER_CHECK = ('Dummy text' , 'Dummy text' , None )
@@ -376,11 +375,6 @@ def teardown_module():
376
375
shutil .rmtree (str (cache_dir ), ignore_errors = True )
377
376
378
377
379
- def _serialize (config ):
380
- chainer = build_model (config , download = True )
381
- return chainer .serialize ()
382
-
383
-
384
378
def _infer (config , inputs , download = False ):
385
379
chainer = build_model (config , download = download )
386
380
if inputs :
@@ -392,18 +386,6 @@ def _infer(config, inputs, download=False):
392
386
return prediction
393
387
394
388
395
- def _deserialize (config , raw_bytes , examples ):
396
- chainer = build_model (config , serialized = raw_bytes )
397
- for * query , expected_response in examples :
398
- query = [[q ] for q in query ]
399
- actual_response = chainer (* query )
400
- if expected_response is not None :
401
- if actual_response is not None and len (actual_response ) > 0 :
402
- actual_response = actual_response [0 ]
403
- assert expected_response == str (actual_response ), \
404
- f"Error in interacting with { model_dir } ({ conf_file } ): { query } "
405
-
406
-
407
389
@pytest .mark .parametrize ("model,conf_file,model_dir,mode" , TEST_GRID , scope = 'class' )
408
390
class TestQuickStart (object ):
409
391
@staticmethod
@@ -555,28 +537,6 @@ def test_inferring_pretrained_model_socket(self, model, conf_file, model_dir, mo
555
537
else :
556
538
pytest .skip (f"Unsupported mode: { mode } " )
557
539
558
- def test_serialization (self , model , conf_file , model_dir , mode ):
559
- if 'SR' not in mode :
560
- return pytest .skip ("Unsupported mode: {}" .format (mode ))
561
-
562
- config_file_path = test_configs_path / conf_file
563
-
564
- with ProcessPoolExecutor (max_workers = 1 ) as executor :
565
- f = executor .submit (_serialize , config_file_path )
566
- raw_bytes = f .result ()
567
-
568
- serialized : list = pickle .loads (raw_bytes )
569
- if not any (serialized ):
570
- pytest .skip ("Serialization not supported: {}" .format (conf_file ))
571
- return
572
- serialized .clear ()
573
-
574
- with ProcessPoolExecutor (max_workers = 1 ) as executor :
575
- f = executor .submit (_deserialize , config_file_path , raw_bytes , PARAMS [model ][(conf_file , model_dir , mode )])
576
-
577
- exc = f .exception ()
578
- if exc is not None :
579
- raise exc
580
540
581
541
def test_consecutive_training_and_inferring (self , model , conf_file , model_dir , mode ):
582
542
if 'TI' in mode :
0 commit comments