aws / amazon-sagemaker-examples

Example 📓 Jupyter notebooks that demonstrate how to build, train, and deploy machine learning models using 🧠 Amazon SageMaker.
https://sagemaker-examples.readthedocs.io
Apache License 2.0
10.09k stars 6.76k forks source link

Running pytorch_extending_our_containers notebook leads to "missing 1 required positional argument: 'image_uri'" error #2723

Open sheriferson opened 3 years ago

sheriferson commented 3 years ago

Link to the notebook https://github.com/aws/amazon-sagemaker-examples/blob/master/advanced_functionality/pytorch_extending_our_containers/pytorch_extending_our_containers.ipynb

Describe the bug Going through the cells in sequential order, arriving at this cell:

from sagemaker.estimator import Estimator

hyperparameters = {"epochs": 1}

estimator = Estimator(
    role=role,
    train_instance_count=1,
    train_instance_type=instance_type,
    image_name="pytorch-extending-our-containers-cifar10-example:latest",
    hyperparameters=hyperparameters,
)

estimator.fit("file:///tmp/pytorch-example/cifar-10-data")

predictor = estimator.deploy(1, instance_type)

Produces the following error:

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-9-43b36d26f91f> in <module>
      8     train_instance_type=instance_type,
      9     image_name="pytorch-extending-our-containers-cifar10-example:latest",
---> 10     hyperparameters=hyperparameters,
     11 )
     12 

TypeError: __init__() missing 1 required positional argument: 'image_uri'

To reproduce

Start a new SageMaker notebook instance and clone the examples repo. Open pytorch_extending_our_containers.ipynb, and Shift + Enter your way down one cell at a time until you arrive at the cell I mention above.

Logs

Other than the error message I don't think there are any other logs to attach.

mrceresa commented 3 years ago

i also had this problem. The image_uri is simply the docker repo. You can echo $fullname

in cell 29 of the notebook (when it builds and push the container) to get the proper value

Hope this helps

Best

Mario

Samjith888 commented 3 years ago

Try by changing image_name into image_uri

estimator = Estimator( role=role, train_instance_count=1, train_instance_type=instance_type, image_uri="pytorch-extending-our-containers-cifar10-example:latest", hyperparameters=hyperparameters, )