I am encountering a strange error in the test for Exercise 4 in the Module 4 assignment of Course 3. In particular, the error is the following. I am able to receive 9/10 points for this portion of the assignment, and all other functionality passes the tests and receives a perfect score from the grader.
Failed test case: No FakeQuantize modules found; prepare_qat likely not applied..
Expected: ≥ 1 FakeQuantize modules in the graph
Got: 0
The output from the validation cell is:
Base Model loaded and wrapped
Model prepared for qat
Epoch 1/1 - Loss: 0.0198 - Val Acc: 1.0000: 100%
1/1 [07:10<00:00, 430.84s/it]
New best accuracy: 1.0000, saved model to best_model.pt
Training completed:
Best accuracy: 1.0000
Final accuracy: 1.0000
Final model saved to final_model.pt
Model converted to int8
Saved quantized model checkpoint to quantized_int8_model.pt
Testing model on cpu
Test accuracy in base model: 0.99%
Int8 model test accuracy: 0.98%
Inference time comparison:
Base model: 0.9327 seconds per batch
Int8 model: 0.3946 seconds per batch
Speed improvement: 57.7%
Model size comparison:
Base model: 42.72 MB
Int8 model: 10.79 MB
Size reduction: 74.7%
Which is comparable but also differs in important ways from the expected output:
*Base Model loaded and wrapped
Model prepared for qat
New best accuracy: 0.9519, saved model to best_model.pt
New best accuracy: 0.9667, saved model to best_model.pt
Training completed:
Best accuracy: 0.9667
Final accuracy: 0.9667
Final model saved to final_model.pt
Model converted to int8
Saved quantized model checkpoint to quantized_int8_model.pt
Testing model on cpu
Test accuracy in base model: 0.97%
Int8 model test accuracy: 0.96%
Inference time comparison:
Base model: 0.0346 seconds per batch
Int8 model: 0.0193 seconds per batch
Speed improvement: 44.2%
Model size comparison:
Base model: 512.22 MB
Int8 model: 128.31 MB
Size reduction: 75.0%
*
Would anyone be able to guide me in understanding what might be wrong with my implementation? Thank you in advance!