MLS-C01 Practice Question: Machine Learning Implementation and Operations
Exhibit
2024-03-15 10:23:45,234 - root - ERROR - Failed to load model: 'NoneType' object has no attribute 'shape'
Traceback (most recent call last):
File "/opt/ml/code/inference.py", line 45, in model_fn
model = load_model(model_dir)
File "/opt/ml/code/inference.py", line 30, in load_model
input_shape = model.input_shape
AttributeError: 'NoneType' object has no attribute 'shape'Refer to the exhibit. A data scientist is deploying a PyTorch model on a SageMaker endpoint. When the endpoint is invoked, the above error appears in CloudWatch logs. What is the MOST likely cause?
⚠ Common exam trap
The MLS-C01 exam often tests the distinction between model-loading errors (missing artifact) and inference-time errors (shape mismatch, memory), so candidates mistakenly attribute a file-not-found error to a shape or memory issue instead of recognizing it as a deployment configuration problem.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
The model artifact was not properly saved or is missing from the S3 location.
The error shown in CloudWatch logs is a `FileNotFoundError` or `No such file or directory` when SageMaker attempts to load the model artifact. This indicates that the model file (e.g., `model.pth` or `model.pt`) is missing from the specified S3 bucket path or was not properly packaged during training. SageMaker endpoints require the model artifact to be present and correctly referenced in the `model_data_url` parameter; otherwise, the container fails to load the model and throws this error.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
The endpoint instance type does not support the required CUDA version.
Why it's wrong here
CUDA incompatibility would cause a different error, like 'CUDA error'.
- ✗
The endpoint instance does not have enough memory to load the model.
Why it's wrong here
Insufficient memory would cause an OOM error, not a NoneType error.
- ✗
The input tensor shape does not match the model's expected input shape.
Why it's wrong here
Shape mismatch would cause an error during inference, not during model loading.
- ✓
The model artifact was not properly saved or is missing from the S3 location.
Why this is correct
If the model file is missing or corrupted, load_model returns None.
Quick reference
AWS S3 Storage Class Comparison
| Storage Class | Min Duration | Retrieval | Use Case |
|---|---|---|---|
| S3 Standard | None | Immediate | Frequently accessed data |
| S3 Standard-IA | 30 days | Immediate | Infrequent access, rapid retrieval |
| S3 One Zone-IA | 30 days | Immediate | Non-critical infrequent data |
| S3 Intelligent-Tiering | None | Immediate–hours | Unknown or changing access patterns |
| S3 Glacier Instant | 90 days | Milliseconds | Archive with instant retrieval |
| S3 Glacier Flexible | 90 days | Minutes–hours | Archive, flexible retrieval |
| S3 Glacier Deep Archive | 180 days | Hours | Long-term compliance archive |
Go deeper
Related to this question
About these practice questions
This MLS-C01 question is part of Courseiva's 1,672-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This MLS-C01 practice question is part of Courseiva's free Amazon Web Services certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the MLS-C01 exam.