Course menuMLA-C02

Exams / MLA-C02 / Training with SageMaker AI / Question 1

MLA-C02 practice question: Training with SageMaker AI (1 of 3)

ML Model and Foundation Model (FM) Development A free question from our original MLA-C02 practice exam. Try it, then open the answer to see why each option is right or wrong.

Last verified against current AWS documentation ·How we write our questions

A logistics broker has a PyTorch training script that predicts freight delay risk. The data scientist wants to run it as a SageMaker AI training job, and the script needs two extra Python packages that are not in the default framework image.

The team wants to keep its own script, avoid building and maintaining a Docker image, and still use the managed PyTorch container that SageMaker AI provides.

Which approach meets these requirements?

Choose one answer.

  1. A. Build a custom Docker image that installs PyTorch and the two packages, push it to Amazon ECR, and point the training job at that image.
  2. B. Use the SageMaker AI PyTorch estimator in script mode, and list the two packages in a requirements.txt file in the source directory.
  3. C. Copy the script into an Amazon EC2 instance with PyTorch installed and run it there, then upload the trained model to Amazon S3 manually.
  4. D. Convert the PyTorch script into a built-in SageMaker AI algorithm, since built-in algorithms can run any framework code.
Show the answer and explanation

Answer: B

  • A. Wrong: A custom image works, but it adds the image build and maintenance the team wants to avoid. The stem asks to keep the managed container.
  • B. Right: Correct. Script mode runs the team's own script in the managed PyTorch container, and SageMaker AI installs the packages listed in requirements.txt when the job starts. No image needs to be built. Learn more: Resources for using PyTorch with Amazon SageMaker AI (opens in a new tab)
  • C. Wrong: This runs the training outside SageMaker AI, so the managed job, its logs and its model artifacts are lost. The stem asks for a SageMaker AI training job.
  • D. Wrong: Built-in algorithms do not run arbitrary framework scripts. The team's script would have to be rewritten to fit a built-in algorithm.

Explanation

Script mode lets a SageMaker AI framework estimator run the team's own training script in the managed container, and packages listed in requirements.txt are installed at start-up. A custom image adds build work, and running on EC2 or using a built-in algorithm loses the managed job.

Study

Keep practicing

Answer questions with a score at the end, or practice just this topic with the explanation after each one. No sign-up needed.

Want more on Training with SageMaker AI? The 5 full-length practice sets have 8 more Training with SageMaker AI questions, 325 in all, none of them in the free exam. One payment of $14.99, no subscription. See the practice sets