121
121
}
122
122
TFLITE_FORMAT_2 = ml .TFLiteFormat .from_dict (TFLITE_FORMAT_JSON_2 )
123
123
124
- AUTOML_MODEL_NAME = 'projects/111111111111/locations/us-central1/models/ICN7683346839371803263'
125
- AUTOML_MODEL_SOURCE = ml .TFLiteAutoMlSource (AUTOML_MODEL_NAME )
126
- TFLITE_FORMAT_JSON_3 = {
127
- 'automlModel' : AUTOML_MODEL_NAME ,
128
- 'sizeBytes' : '3456789'
129
- }
130
- TFLITE_FORMAT_3 = ml .TFLiteFormat .from_dict (TFLITE_FORMAT_JSON_3 )
131
-
132
- AUTOML_MODEL_NAME_2 = 'projects/2222222222/locations/us-central1/models/ICN2222222222222222222'
133
- AUTOML_MODEL_NAME_JSON_2 = {'automlModel' : AUTOML_MODEL_NAME_2 }
134
- AUTOML_MODEL_SOURCE_2 = ml .TFLiteAutoMlSource (AUTOML_MODEL_NAME_2 )
135
-
136
124
CREATED_UPDATED_MODEL_JSON_1 = {
137
125
'name' : MODEL_NAME_1 ,
138
126
'displayName' : DISPLAY_NAME_1 ,
@@ -423,14 +411,6 @@ def test_model_keyword_based_creation_and_setters(self):
423
411
'tfliteModel' : TFLITE_FORMAT_JSON_2
424
412
}
425
413
426
- model .model_format = TFLITE_FORMAT_3
427
- assert model .as_dict () == {
428
- 'displayName' : DISPLAY_NAME_2 ,
429
- 'tags' : TAGS_2 ,
430
- 'tfliteModel' : TFLITE_FORMAT_JSON_3
431
- }
432
-
433
-
434
414
def test_gcs_tflite_model_format_source_creation (self ):
435
415
model_source = ml .TFLiteGCSModelSource (gcs_tflite_uri = GCS_TFLITE_URI )
436
416
model_format = ml .TFLiteFormat (model_source = model_source )
@@ -442,17 +422,6 @@ def test_gcs_tflite_model_format_source_creation(self):
442
422
}
443
423
}
444
424
445
- def test_auto_ml_tflite_model_format_source_creation (self ):
446
- model_source = ml .TFLiteAutoMlSource (auto_ml_model = AUTOML_MODEL_NAME )
447
- model_format = ml .TFLiteFormat (model_source = model_source )
448
- model = ml .Model (display_name = DISPLAY_NAME_1 , model_format = model_format )
449
- assert model .as_dict () == {
450
- 'displayName' : DISPLAY_NAME_1 ,
451
- 'tfliteModel' : {
452
- 'automlModel' : AUTOML_MODEL_NAME
453
- }
454
- }
455
-
456
425
def test_source_creation_from_tflite_file (self ):
457
426
model_source = ml .TFLiteGCSModelSource .from_tflite_model_file (
458
427
"my_model.tflite" , "my_bucket" )
@@ -466,13 +435,6 @@ def test_gcs_tflite_model_source_setters(self):
466
435
assert model_source .gcs_tflite_uri == GCS_TFLITE_URI_2
467
436
assert model_source .as_dict () == GCS_TFLITE_URI_JSON_2
468
437
469
- def test_auto_ml_tflite_model_source_setters (self ):
470
- model_source = ml .TFLiteAutoMlSource (AUTOML_MODEL_NAME )
471
- model_source .auto_ml_model = AUTOML_MODEL_NAME_2
472
- assert model_source .auto_ml_model == AUTOML_MODEL_NAME_2
473
- assert model_source .as_dict () == AUTOML_MODEL_NAME_JSON_2
474
-
475
-
476
438
def test_model_format_setters (self ):
477
439
model_format = ml .TFLiteFormat (model_source = GCS_TFLITE_MODEL_SOURCE )
478
440
model_format .model_source = GCS_TFLITE_MODEL_SOURCE_2
@@ -483,14 +445,6 @@ def test_model_format_setters(self):
483
445
}
484
446
}
485
447
486
- model_format .model_source = AUTOML_MODEL_SOURCE
487
- assert model_format .model_source == AUTOML_MODEL_SOURCE
488
- assert model_format .as_dict () == {
489
- 'tfliteModel' : {
490
- 'automlModel' : AUTOML_MODEL_NAME
491
- }
492
- }
493
-
494
448
def test_model_as_dict_for_upload (self ):
495
449
model_source = ml .TFLiteGCSModelSource (gcs_tflite_uri = GCS_TFLITE_URI )
496
450
model_format = ml .TFLiteFormat (model_source = model_source )
@@ -576,23 +530,6 @@ def test_gcs_tflite_source_validation_errors(self, uri, exc_type):
576
530
ml .TFLiteGCSModelSource (gcs_tflite_uri = uri )
577
531
check_error (excinfo , exc_type )
578
532
579
- @pytest .mark .parametrize ('auto_ml_model, exc_type' , [
580
- (123 , TypeError ),
581
- ('abc' , ValueError ),
582
- ('/projects/123456/locations/us-central1/models/noLeadingSlash' , ValueError ),
583
- ('projects/123546/models/ICN123456' , ValueError ),
584
- ('projects//locations/us-central1/models/ICN123456' , ValueError ),
585
- ('projects/123456/locations//models/ICN123456' , ValueError ),
586
- ('projects/123456/locations/us-central1/models/' , ValueError ),
587
- ('projects/ABC/locations/us-central1/models/ICN123456' , ValueError ),
588
- ('projects/123456/locations/us-central1/models/@#$%^&' , ValueError ),
589
- ('projects/123456/locations/us-cent/ral1/models/ICN123456' , ValueError ),
590
- ])
591
- def test_auto_ml_tflite_source_validation_errors (self , auto_ml_model , exc_type ):
592
- with pytest .raises (exc_type ) as excinfo :
593
- ml .TFLiteAutoMlSource (auto_ml_model = auto_ml_model )
594
- check_error (excinfo , exc_type )
595
-
596
533
def test_wait_for_unlocked_not_locked (self ):
597
534
model = ml .Model (display_name = "not_locked" )
598
535
model .wait_for_unlocked ()
0 commit comments