File tree Expand file tree Collapse file tree 2 files changed +41
-1
lines changed Expand file tree Collapse file tree 2 files changed +41
-1
lines changed Original file line number Diff line number Diff line change @@ -1641,7 +1641,11 @@ def remove_env_var_from_estimator_kwargs_if_model_access_config_present(
16411641 init_kwargs (dict): Dictionary of kwargs when Estimator is instantiated.
16421642 accept_eula (Optional[bool]): Whether or not the EULA was accepted, optionally passed in to Estimator.fit().
16431643 """
1644- if model_access_config is not None and init_kwargs .get ("environment" ) is not None and init_kwargs .get ("model_uri" ) is not None :
1644+ if (
1645+ model_access_config is not None
1646+ and init_kwargs .get ("environment" ) is not None
1647+ and init_kwargs .get ("model_uri" ) is not None
1648+ ):
16451649 if (
16461650 constants .SAGEMAKER_GATED_MODEL_S3_URI_TRAINING_ENV_VAR_KEY
16471651 in init_kwargs ["environment" ]
Original file line number Diff line number Diff line change 1+ from sagemaker .jumpstart .hub .hub import Hub
2+ from sagemaker import hyperparameters
3+ from sagemaker .session import Session
4+ from sagemaker .jumpstart .estimator import JumpStartEstimator
5+
6+
7+ hub = Hub (hub_name = "temp-bencrab-hub" , sagemaker_session = Session ())
8+
9+ # hub.create(description="hello haha")
10+
11+ model_id = "meta-vlm-llama-3-2-11b-vision"
12+ model_version = "*"
13+ hub_arn = hub .hub_name
14+
15+ my_hyperparameters = hyperparameters .retrieve_default (
16+ model_id = model_id , model_version = model_version , hub_arn = hub_arn
17+ )
18+ print (my_hyperparameters )
19+ hyperparameters .validate (
20+ model_id = model_id ,
21+ model_version = model_version ,
22+ hyperparameters = my_hyperparameters ,
23+ hub_arn = hub_arn ,
24+ )
25+ estimator = JumpStartEstimator (
26+ model_id = model_id ,
27+ hub_name = hub_arn ,
28+ model_version = model_version ,
29+ environment = {"accept_eula" : "true" }, # Please change {"accept_eula": "true"}
30+ disable_output_compression = True ,
31+ instance_type = "ml.p4d.24xlarge" ,
32+ hyperparameters = my_hyperparameters ,
33+ )
34+ estimator .fit (
35+ {"training" : "s3://jumpstart-cache-prod-us-west-2/training-datasets/docVQA-small-3000ex/" }
36+ )
You can’t perform that action at this time.
0 commit comments