Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

120
Views
How to load trained model in amazon sagemaker?

I am following this example on how to train a machine learning model in Amazon-sagemaker.

data_location = 's3://{}/kmeans_highlevel_example/data'.format(bucket)
output_location = 's3://{}/kmeans_highlevel_example/output'.format(bucket)

print('training data will be uploaded to: {}'.format(data_location))
print('training artifacts will be uploaded to: {}'.format(output_location))

kmeans = KMeans(role=role,
                train_instance_count=2,
                train_instance_type='ml.c4.8xlarge',
                output_path=output_location,
                k=10,
                epochs=100,
                data_location=data_location)

So after calling the fit function the model should be saved in the S3 bucket?? How can you load this model next time?

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

This can be done by using the sagemaker library combined with the Inference Model.

model = sagemaker.model.Model(
    image=image
    model_data='s3://bucket/model.tar.gz',
    role=role_arn)

The options you're passing in are:

  • image - This is the ECR image you're using for inference (which should be for the algorithm you're trying to use). Paths are available here.
  • model_data - This is the path of where your model is stored (in a tar.gz compressed archive).
  • role - This is the arn of a role that is capable of both pulling the image from ECR and getting the s3 archive.

Once you've successfully done this you will need to setup an endpoint, this can be done by performing the following in your notebook through the deploy function.

model.deploy(
   initial_instance_count=1,
   instance_type='ml.p2.xlarge'
)
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!