File tree Expand file tree Collapse file tree 2 files changed +24
-0
lines changed Expand file tree Collapse file tree 2 files changed +24
-0
lines changed Original file line number Diff line number Diff line change 31
31
LocalModelInvocationException ,
32
32
LocalModelLoadException ,
33
33
SkipTuningComboException ,
34
+ JumpStartGatedModelNotSupported ,
34
35
)
35
36
from sagemaker .serve .utils .predictors import (
36
37
DjlLocalModePredictor ,
@@ -443,6 +444,11 @@ def _build_for_jumpstart(self):
443
444
444
445
logger .info ("JumpStart ID %s is packaged with Image URI: %s" , self .model , image_uri )
445
446
447
+ if self ._is_gated_model () and self .mode != Mode .SAGEMAKER_ENDPOINT :
448
+ raise JumpStartGatedModelNotSupported (
449
+ "JumpStart Gated Models are only supported in SAGEMAKER_ENDPOINT mode"
450
+ )
451
+
446
452
if "djl-inference" in image_uri :
447
453
logger .info ("Building for DJL JumpStart Model ID..." )
448
454
self .model_server = ModelServer .DJL_SERVING
@@ -469,3 +475,12 @@ def _build_for_jumpstart(self):
469
475
)
470
476
471
477
return self .pysdk_model
478
+
479
+ def _is_gated_model (self ) -> bool :
480
+ """Determine if ``this`` Model is Gated"""
481
+
482
+ s3_uri = self .pysdk_model .model_data
483
+ if isinstance (s3_uri , dict ):
484
+ s3_uri = s3_uri .get ("S3DataSource" ).get ("S3Uri" )
485
+
486
+ return "private" in s3_uri
Original file line number Diff line number Diff line change @@ -69,3 +69,12 @@ class TaskNotFoundException(ModelBuilderException):
69
69
70
70
def __init__ (self , message ):
71
71
super ().__init__ (message = message )
72
+
73
+
74
+ class JumpStartGatedModelNotSupported (ModelBuilderException ):
75
+ """Raise when deploying JumpStart gated model locally"""
76
+
77
+ fmt = "Error Message: {message}"
78
+
79
+ def __init__ (self , message ):
80
+ super ().__init__ (message = message )
You can’t perform that action at this time.
0 commit comments