- Mais recentes
- Mais votos
- Mais comentários
If you trained your model in SageMaker, the model artifacts are saved as a single compressed tar file in Amazon S3. If you trained your model outside SageMaker, you need to create this single compressed tar file and save it in a S3 location. SageMaker decompresses this tar file into /opt/ml/model directory before your container starts.
Reference : https://docs.aws.amazon.com/sagemaker/latest/dg/your-algorithms-inference-code.html
Just to add a bit more detail to Nitin's answer since you raised a couple of interesting secondary questions:
First, to be picky, your artifact does need to be a compressed .tar.gz file as mentioned here. Plain .tar files (which you mentioned a couple of times) likely won't have this compression and won't work. From my recent tests the filename extension itself in S3 doesn't matter though - so if your object is in the correct format but just happens to be called .tar
, this should be fine.
Second, yes today you can simply update the saved model artifact in S3 and continue referencing the same SageMaker model - but when can you do it and should you?
One important caveat to bear in mind is that if you're deploying your models to online inference endpoints, there's no API available to force running instances to re-fetch an updated model tarball. If you update your artifact while an endpoint is live (especially if auto-scaling is enabled or some endpoint update is in progress) you could end up with endpoint instances running a mixture of old vs new model.
The second is that, even if you only run defined batch jobs and can guarantee the timing of artifact updates won't overlap with job start-up, keeping track of your model versions is a pretty important best practice to help keep your operations in order.
So even though it's possible to just update the artifact in S3, I'd usually suggest users track their historical models: For example by treating the S3 prefix as immutable, re-creating Models for new artifact versions, and using SageMaker Model Registry to track the history of versions. It's worth mentioning that storing your history of versions ("ModelPackages") in Model Registry doesn't necessarily have to balloon the number of "Models" in SageMaker: As discussed here, a ModelPackage isn't necessarily tied to a Model, and you need to create a Model from it to be able to use in deployment/inference.
Conteúdo relevante
- AWS OFICIALAtualizada há um ano
- AWS OFICIALAtualizada há 3 anos
- AWS OFICIALAtualizada há um ano
- AWS OFICIALAtualizada há um ano