I have trained a sagemaker model successfully and the model.tar.gz
file is on s3.
Now I want to "reconstruct" the model from that file and then deploy it. I used the following code:
containers = {'us-west-2': '174872318107.dkr.ecr.us-west-2.amazonaws.com/factorization-machines:latest',
'us-east-1': '382416733822.dkr.ecr.us-east-1.amazonaws.com/factorization-machines:latest',
'us-east-2': '404615174143.dkr.ecr.us-east-2.amazonaws.com/factorization-machines:latest',
'eu-west-1': '438346466558.dkr.ecr.eu-west-1.amazonaws.com/factorization-machines:latest'}
fm = sagemaker.model.Model(model_s3_path, containers['eu-west-1'], role=sagemaker.get_execution_role())
I get back an object of type sagemaker.model.Model
.
I then seek to deploy the model via
fm_predictor = fm.deploy(instance_type='ml.c4.xlarge', initial_instance_count=1)
The output of this call is
--------------------------------------------------------------------------------------!
But this returns a NoneType
object that does not have a predict method. However, the model's endpoint is created.
What am I doing wrong?
In my code samples, the deployment also does not have a relevant return value. But after the deployment, I have to create the predictor with the endpoint name:
endpoint_name = 'rf-scikit-endpoint-xxx'
model.deploy(
instance_type='ml.c5.large',
initial_instance_count=1,
endpoint_name=endpoint_name)
predictor = sagemaker.sklearn.model.SKLearnPredictor(endpoint_name=endpoint_name)
Can you proceed in a similar way?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.