- Newest
- Most votes
- Most comments
When AWS Sample - BERT sample using torch 1.4 was published, advance knowledge of the inference seems to be necessary. If you use the PyTorch SageMaker SDK to create or deploy the model after it is trained, it automatically re-packages the model.tar.gz to include the code files and the inference files. As an example, when you use the following script, the model.tar.gz is repackaged so the contents of the src directory is automatically added to the code directory model.tar.gz, which initially only contains model files. You don't need to know the inference code in advance.
from sagemaker.pytorch import PyTorchModel from sagemaker import get_execution_role role = get_execution_role() model_uri = estimator.model_data model = PyTorchModel(model_data=model_uri, role=role, framework_version='1.4.0', entry_point='serve.py', source_dir='src') predictor = model.deploy(initial_instance_count=1, instance_type='ml.p3.2xlarge')
For the older versions, you couldn't include additional files /dependencies during inference unless you built a custom container. The source.tar.gz was only used during training.
Relevant content
- asked a year ago
- asked 2 years ago
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated a month ago
- AWS OFFICIALUpdated 4 months ago