-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeploy_local.py
33 lines (23 loc) · 1.21 KB
/
deploy_local.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
from sagemaker.local import LocalSession
from sagemaker.sklearn.estimator import SKLearnModel
import logging
sagemaker_session = LocalSession()
sagemaker_session.config = {'local': {'local_code': True}}
sagemaker_config_logger = logging.getLogger("sagemaker.config")
sagemaker_config_logger.setLevel(logging.DEBUG)
role = 'acgirish'
#source_dir = "s3://sagemaker-us-east-2-482523031755/sagemaker-scikit-learn-2023-01-02-00-16-10-673/source/sourcedir.tar.gz"
source_dir = "./"
aws_sklearn_model = SKLearnModel(model_data="s3://sagemaker-us-east-2-482523031755/sagemaker-scikit-learn-2023-01-02-00-16-10-673/output/model.tar.gz",
role=role,
entry_point="aws_training.py",
source_dir=source_dir,
framework_version="1.0-1")
aws_sklearn_predictor = aws_sklearn_model.deploy(instance_type='local',
initial_instance_count=1)
# instance_type = 'local'
print(aws_sklearn_predictor.endpoint)
# Tears down the endpoint container and deletes the corresponding endpoint configuration
aws_sklearn_predictor.delete_endpoint()
# Deletes the model
aws_sklearn_predictor.delete_model()