What happens when you send a prediction request to the server?
medium
A. The server returns predictions from the loaded model
B. The server throws an error because model_store is missing
C. The server starts but does not load any model
D. The server converts the model to ONNX format
Solution
Step 1: Understand the archiving and serving commands
The first command creates a .mar file in model_store. The second starts TorchServe loading that model.
Step 2: Predict server behavior on request
Since the model is loaded, the server will respond with predictions when given input data.
Final Answer:
The server returns predictions from the loaded model -> Option A
Quick Check:
Model archived and loaded = predictions served [OK]
Hint: Archive then start server to serve predictions [OK]
Common Mistakes:
Assuming model_store folder is missing
Thinking server starts without loading models
Believing TorchServe converts model formats
4. You run torchserve --start --model-store model_store --models mymodel=mymodel.mar but get an error: ModelNotFoundError. What is the most likely cause?
medium
A. The handler.py file is missing
B. TorchServe is not installed
C. The .mar file is not in the model_store directory
D. The model name is misspelled in the command
Solution
Step 1: Analyze the error message
ModelNotFoundError means TorchServe cannot find the specified .mar file in the model_store directory.
Step 2: Check command and files
If the .mar file is missing or not placed in model_store, the server cannot load it. Misspelling or missing handler causes different errors.
Final Answer:
The .mar file is not in the model_store directory -> Option C
Quick Check:
ModelNotFoundError = missing .mar file [OK]
Hint: Ensure .mar file is inside model_store folder [OK]
Common Mistakes:
Ignoring file location for .mar archive
Assuming TorchServe installation issue
Confusing model name typo with missing file
5. You want to deploy two different PyTorch models simultaneously using TorchServe. Which setup correctly achieves this?
hard
A. Create two .mar files and start TorchServe with --models model1=model1.mar model2=model2.mar
B. Combine both models into one .mar file and start TorchServe with a single model
C. Start two TorchServe servers on the same port, each serving one model
D. Use torch-model-archiver to merge models into a single .pth file
Solution
Step 1: Understand multi-model serving in TorchServe
TorchServe supports serving multiple models by specifying multiple .mar files with aliases in the --models option.
Step 2: Evaluate options
Create two .mar files and start TorchServe with --models model1=model1.mar model2=model2.mar correctly uses two .mar files with aliases. Combine both models into one .mar file and start TorchServe with a single model is invalid because .mar files cannot combine models. Start two TorchServe servers on the same port, each serving one model fails because two servers cannot share the same port. Use torch-model-archiver to merge models into a single .pth file is incorrect; torch-model-archiver does not merge models.
Final Answer:
Create two .mar files and start TorchServe with --models model1=model1.mar model2=model2.mar -> Option A
Quick Check:
Multiple models = multiple .mar files with aliases [OK]
Hint: Use space-separated model aliases in --models option [OK]
Common Mistakes:
Trying to merge models into one .mar file
Running multiple servers on same port
Misusing torch-model-archiver to combine models
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.