Assuming model.predict expects a single string for real-time inference.
medium
A. Input should be a string, not a list
B. model.predict cannot process text
C. Missing batch size parameter
D. Prediction variable name is invalid
Solution
Step 1: Check input type for real-time inference
Real-time inference expects a single input string, not a list.
Step 2: Identify mismatch in code
The code passes a list with one string, causing a type mismatch error.
Final Answer:
Input should be a string, not a list -> Option A
Quick Check:
Real-time input = string only [OK]
Hint: Real-time input must be a single string [OK]
Common Mistakes:
Passing list instead of string
Assuming batch size needed for real-time
Thinking variable name causes error
5. You have a large dataset of 10,000 sentences to classify using an NLP model. You want to minimize total processing time but can wait a few minutes for results. Which inference method should you choose and why?
hard
A. Neither, you should retrain the model first.
B. Batch inference, because processing many inputs together is more efficient for large data.
C. Real-time inference, because it processes each sentence instantly.
D. Real-time inference, because it uses less memory.
Solution
Step 1: Analyze dataset size and time constraints
With 10,000 sentences and willingness to wait minutes, efficiency matters more than instant results.
Step 2: Choose inference method based on efficiency
Batch inference processes many inputs together, reducing overhead and total time.
Final Answer:
Batch inference, because processing many inputs together is more efficient for large data. -> Option B
Quick Check:
Large data + wait time = batch inference [OK]
Hint: Large data with wait time? Use batch inference [OK]