122
122
}
123
123
TFLITE_FORMAT_2 = ml .TFLiteFormat .from_dict (TFLITE_FORMAT_JSON_2 )
124
124
125
- AUTOML_MODEL_NAME = 'projects/111111111111/locations/us-central1/models/ICN7683346839371803263'
126
- AUTOML_MODEL_SOURCE = ml .TFLiteAutoMlSource (AUTOML_MODEL_NAME )
127
- TFLITE_FORMAT_JSON_3 = {
128
- 'automlModel' : AUTOML_MODEL_NAME ,
129
- 'sizeBytes' : '3456789'
130
- }
131
- TFLITE_FORMAT_3 = ml .TFLiteFormat .from_dict (TFLITE_FORMAT_JSON_3 )
132
-
133
- AUTOML_MODEL_NAME_2 = 'projects/2222222222/locations/us-central1/models/ICN2222222222222222222'
134
- AUTOML_MODEL_NAME_JSON_2 = {'automlModel' : AUTOML_MODEL_NAME_2 }
135
- AUTOML_MODEL_SOURCE_2 = ml .TFLiteAutoMlSource (AUTOML_MODEL_NAME_2 )
136
-
137
125
CREATED_UPDATED_MODEL_JSON_1 = {
138
126
'name' : MODEL_NAME_1 ,
139
127
'displayName' : DISPLAY_NAME_1 ,
@@ -417,14 +405,6 @@ def test_model_keyword_based_creation_and_setters(self):
417
405
'tfliteModel' : TFLITE_FORMAT_JSON_2
418
406
}
419
407
420
- model .model_format = TFLITE_FORMAT_3
421
- assert model .as_dict () == {
422
- 'displayName' : DISPLAY_NAME_2 ,
423
- 'tags' : TAGS_2 ,
424
- 'tfliteModel' : TFLITE_FORMAT_JSON_3
425
- }
426
-
427
-
428
408
def test_gcs_tflite_model_format_source_creation (self ):
429
409
model_source = ml .TFLiteGCSModelSource (gcs_tflite_uri = GCS_TFLITE_URI )
430
410
model_format = ml .TFLiteFormat (model_source = model_source )
@@ -436,17 +416,6 @@ def test_gcs_tflite_model_format_source_creation(self):
436
416
}
437
417
}
438
418
439
- def test_auto_ml_tflite_model_format_source_creation (self ):
440
- model_source = ml .TFLiteAutoMlSource (auto_ml_model = AUTOML_MODEL_NAME )
441
- model_format = ml .TFLiteFormat (model_source = model_source )
442
- model = ml .Model (display_name = DISPLAY_NAME_1 , model_format = model_format )
443
- assert model .as_dict () == {
444
- 'displayName' : DISPLAY_NAME_1 ,
445
- 'tfliteModel' : {
446
- 'automlModel' : AUTOML_MODEL_NAME
447
- }
448
- }
449
-
450
419
def test_source_creation_from_tflite_file (self ):
451
420
model_source = ml .TFLiteGCSModelSource .from_tflite_model_file (
452
421
"my_model.tflite" , "my_bucket" )
@@ -460,13 +429,6 @@ def test_gcs_tflite_model_source_setters(self):
460
429
assert model_source .gcs_tflite_uri == GCS_TFLITE_URI_2
461
430
assert model_source .as_dict () == GCS_TFLITE_URI_JSON_2
462
431
463
- def test_auto_ml_tflite_model_source_setters (self ):
464
- model_source = ml .TFLiteAutoMlSource (AUTOML_MODEL_NAME )
465
- model_source .auto_ml_model = AUTOML_MODEL_NAME_2
466
- assert model_source .auto_ml_model == AUTOML_MODEL_NAME_2
467
- assert model_source .as_dict () == AUTOML_MODEL_NAME_JSON_2
468
-
469
-
470
432
def test_model_format_setters (self ):
471
433
model_format = ml .TFLiteFormat (model_source = GCS_TFLITE_MODEL_SOURCE )
472
434
model_format .model_source = GCS_TFLITE_MODEL_SOURCE_2
@@ -477,14 +439,6 @@ def test_model_format_setters(self):
477
439
}
478
440
}
479
441
480
- model_format .model_source = AUTOML_MODEL_SOURCE
481
- assert model_format .model_source == AUTOML_MODEL_SOURCE
482
- assert model_format .as_dict () == {
483
- 'tfliteModel' : {
484
- 'automlModel' : AUTOML_MODEL_NAME
485
- }
486
- }
487
-
488
442
def test_model_as_dict_for_upload (self ):
489
443
model_source = ml .TFLiteGCSModelSource (gcs_tflite_uri = GCS_TFLITE_URI )
490
444
model_format = ml .TFLiteFormat (model_source = model_source )
@@ -570,23 +524,6 @@ def test_gcs_tflite_source_validation_errors(self, uri, exc_type):
570
524
ml .TFLiteGCSModelSource (gcs_tflite_uri = uri )
571
525
check_error (excinfo , exc_type )
572
526
573
- @pytest .mark .parametrize ('auto_ml_model, exc_type' , [
574
- (123 , TypeError ),
575
- ('abc' , ValueError ),
576
- ('/projects/123456/locations/us-central1/models/noLeadingSlash' , ValueError ),
577
- ('projects/123546/models/ICN123456' , ValueError ),
578
- ('projects//locations/us-central1/models/ICN123456' , ValueError ),
579
- ('projects/123456/locations//models/ICN123456' , ValueError ),
580
- ('projects/123456/locations/us-central1/models/' , ValueError ),
581
- ('projects/ABC/locations/us-central1/models/ICN123456' , ValueError ),
582
- ('projects/123456/locations/us-central1/models/@#$%^&' , ValueError ),
583
- ('projects/123456/locations/us-cent/ral1/models/ICN123456' , ValueError ),
584
- ])
585
- def test_auto_ml_tflite_source_validation_errors (self , auto_ml_model , exc_type ):
586
- with pytest .raises (exc_type ) as excinfo :
587
- ml .TFLiteAutoMlSource (auto_ml_model = auto_ml_model )
588
- check_error (excinfo , exc_type )
589
-
590
527
def test_wait_for_unlocked_not_locked (self ):
591
528
model = ml .Model (display_name = "not_locked" )
592
529
model .wait_for_unlocked ()
0 commit comments