@@ -330,11 +330,8 @@ def _upload_model_bundle(
330
330
self ,
331
331
load_model_fn : Callable ,
332
332
load_predict_fn : Callable ,
333
- bundle_metadata : Dict [str , Any ],
334
333
):
335
334
bundle = dict (load_model_fn = load_model_fn , load_predict_fn = load_predict_fn )
336
- bundle_metadata ["load_predict_fn" ] = inspect .getsource (load_predict_fn ) # type: ignore
337
- bundle_metadata ["load_model_fn" ] = inspect .getsource (load_model_fn ) # type: ignore
338
335
serialized_bundle = cloudpickle .dumps (bundle )
339
336
bundle_location = self ._upload_data (data = serialized_bundle )
340
337
return bundle_location
@@ -361,6 +358,7 @@ def create_model_bundle_from_callable_v2(
361
358
custom_base_image_repository : Optional [str ] = None ,
362
359
custom_base_image_tag : Optional [str ] = None ,
363
360
app_config : Optional [Union [Dict [str , Any ], str ]] = None ,
361
+ metadata : Optional [Dict [str , Any ]] = None ,
364
362
) -> CreateModelBundleV2Response :
365
363
"""
366
364
Uploads and registers a model bundle to Scale Launch.
@@ -420,14 +418,15 @@ def predict_fn(input):
420
418
bundle when it is run. These values can be accessed by the bundle via the
421
419
``app_config`` global variable.
422
420
421
+ metadata: Metadata to record with the bundle.
422
+
423
423
Returns:
424
424
An object containing the following keys:
425
425
426
426
- ``model_bundle_id``: The ID of the created model bundle.
427
427
"""
428
428
nonnull_requirements = requirements or []
429
- bundle_metadata : Dict [str , Any ] = {}
430
- bundle_location = self ._upload_model_bundle (load_model_fn , load_predict_fn , bundle_metadata )
429
+ bundle_location = self ._upload_model_bundle (load_model_fn , load_predict_fn )
431
430
schema_location = self ._upload_schemas (request_schema = request_schema , response_schema = response_schema )
432
431
framework = _get_model_bundle_framework (
433
432
pytorch_image_tag = pytorch_image_tag ,
@@ -447,9 +446,12 @@ def predict_fn(input):
447
446
)
448
447
)
449
448
create_model_bundle_request = CreateModelBundleV2Request (
450
- name = model_bundle_name ,
451
- schema_location = schema_location ,
452
- flavor = flavor ,
449
+ ** dict_not_none (
450
+ name = model_bundle_name ,
451
+ schema_location = schema_location ,
452
+ flavor = flavor ,
453
+ metadata = metadata ,
454
+ )
453
455
)
454
456
with ApiClient (self .configuration ) as api_client :
455
457
api_instance = DefaultApi (api_client )
@@ -476,6 +478,7 @@ def create_model_bundle_from_dirs_v2(
476
478
custom_base_image_repository : Optional [str ] = None ,
477
479
custom_base_image_tag : Optional [str ] = None ,
478
480
app_config : Optional [Dict [str , Any ]] = None ,
481
+ metadata : Optional [Dict [str , Any ]] = None ,
479
482
) -> CreateModelBundleV2Response :
480
483
"""
481
484
Packages up code from one or more local filesystem folders and uploads them as a bundle
@@ -556,6 +559,8 @@ def create_model_bundle_from_dirs_v2(
556
559
bundle when it is run. These values can be accessed by the bundle via the
557
560
``app_config`` global variable.
558
561
562
+ metadata: Metadata to record with the bundle.
563
+
559
564
Returns:
560
565
An object containing the following keys:
561
566
@@ -585,9 +590,12 @@ def create_model_bundle_from_dirs_v2(
585
590
)
586
591
)
587
592
create_model_bundle_request = CreateModelBundleV2Request (
588
- name = model_bundle_name ,
589
- schema_location = schema_location ,
590
- flavor = flavor ,
593
+ ** dict_not_none (
594
+ name = model_bundle_name ,
595
+ schema_location = schema_location ,
596
+ flavor = flavor ,
597
+ metadata = metadata ,
598
+ )
591
599
)
592
600
with ApiClient (self .configuration ) as api_client :
593
601
api_instance = DefaultApi (api_client )
@@ -610,6 +618,7 @@ def create_model_bundle_from_runnable_image_v2(
610
618
command : List [str ],
611
619
env : Dict [str , str ],
612
620
readiness_initial_delay_seconds : int ,
621
+ metadata : Optional [Dict [str , Any ]] = None ,
613
622
) -> CreateModelBundleV2Response :
614
623
"""
615
624
Create a model bundle from a runnable image. The specified ``command`` must start a process
@@ -636,6 +645,7 @@ def create_model_bundle_from_runnable_image_v2(
636
645
readiness_initial_delay_seconds: The number of seconds to wait for the HTTP server to become ready and
637
646
successfully respond on its healthcheck.
638
647
648
+ metadata: Metadata to record with the bundle.
639
649
640
650
Returns:
641
651
An object containing the following keys:
@@ -655,9 +665,12 @@ def create_model_bundle_from_runnable_image_v2(
655
665
)
656
666
)
657
667
create_model_bundle_request = CreateModelBundleV2Request (
658
- name = model_bundle_name ,
659
- schema_location = schema_location ,
660
- flavor = flavor ,
668
+ ** dict_not_none (
669
+ name = model_bundle_name ,
670
+ schema_location = schema_location ,
671
+ flavor = flavor ,
672
+ metadata = metadata ,
673
+ )
661
674
)
662
675
663
676
with ApiClient (self .configuration ) as api_client :
@@ -688,6 +701,7 @@ def create_model_bundle_from_triton_enhanced_runnable_image_v2(
688
701
triton_storage : Optional [str ],
689
702
triton_memory : Optional [str ],
690
703
triton_readiness_initial_delay_seconds : int ,
704
+ metadata : Optional [Dict [str , Any ]] = None ,
691
705
) -> CreateModelBundleV2Response :
692
706
"""
693
707
Create a model bundle from a runnable image and a tritonserver image.
@@ -732,6 +746,8 @@ def create_model_bundle_from_triton_enhanced_runnable_image_v2(
732
746
triton_readiness_initial_delay_seconds: Like readiness_initial_delay_seconds, but for
733
747
tritonserver's own healthcheck.
734
748
749
+ metadata: Metadata to record with the bundle.
750
+
735
751
Returns:
736
752
An object containing the following keys:
737
753
@@ -757,9 +773,12 @@ def create_model_bundle_from_triton_enhanced_runnable_image_v2(
757
773
)
758
774
)
759
775
create_model_bundle_request = CreateModelBundleV2Request (
760
- name = model_bundle_name ,
761
- schema_location = schema_location ,
762
- flavor = flavor ,
776
+ ** dict_not_none (
777
+ name = model_bundle_name ,
778
+ schema_location = schema_location ,
779
+ flavor = flavor ,
780
+ metadata = metadata ,
781
+ )
763
782
)
764
783
765
784
with ApiClient (self .configuration ) as api_client :
0 commit comments