Recall & Review
beginner
What is REST API inference in machine learning?
REST API inference means using a web service to send data to a machine learning model and get predictions back over the internet.
Click to reveal answer
beginner
Why do we use REST APIs for model inference?
REST APIs let different programs talk to the model easily, no matter where they run, making it simple to get predictions from anywhere.Click to reveal answer
intermediate
In PyTorch, what is the typical step before serving a model via REST API?
You load the trained model, set it to evaluation mode with model.eval(), and prepare it to receive input data for prediction.
Click to reveal answer
beginner
What HTTP method is commonly used to send data for inference in REST APIs?
POST is commonly used because it allows sending data in the request body to the server for prediction.
Click to reveal answer
intermediate
How do you ensure the REST API inference is fast and responsive?
By loading the model once, using efficient data processing, and avoiding reloading the model on every request.
Click to reveal answer
Which HTTP method is best for sending input data to a REST API for inference?
✗ Incorrect
POST is used to send data in the request body, which is needed for inference input.
In PyTorch, what does model.eval() do before inference?
✗ Incorrect
model.eval() sets the model to evaluation mode, disabling training-specific features like dropout.
What is the main advantage of using a REST API for model inference?
✗ Incorrect
REST APIs let clients send data and get predictions from the model remotely.
Which format is commonly used to send data in REST API requests for inference?
✗ Incorrect
JSON is widely used because it is easy to read and parse for sending structured data.
What should you avoid to keep REST API inference fast?
✗ Incorrect
Reloading the model on every request wastes time and slows down inference.
Explain how a REST API can be used to get predictions from a PyTorch model.
Think about how data travels from client to server and back.
You got /3 concepts.
Describe the steps to prepare a PyTorch model for REST API inference.
Focus on what happens before and during the API call.
You got /4 concepts.