-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
29 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# ERA-V3 MNIST Project | ||
|
||
This project implements a CNN model for MNIST digit classification with CI/CD pipeline. | ||
|
||
## Project Structure | ||
- `mnist_project/`: Contains the main project code | ||
- `src/`: Source code directory | ||
- `model.py`: CNN model architecture | ||
- `train.py`: Training script | ||
- `utils.py`: Utility functions | ||
- `tests/`: Test files | ||
|
||
## Local Setup | ||
1. Clone the repository: |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,16 @@ | ||
import torch | ||
import glob | ||
from src.model import MNISTModel | ||
from src.utils import evaluate_model | ||
|
||
def test_model_accuracy(): | ||
model = MNISTModel() | ||
model.load_state_dict(torch.load('model_mnist_latest.pth')) | ||
# Find the most recent model file | ||
model_files = glob.glob('model_mnist_*.pth') | ||
if not model_files: | ||
raise FileNotFoundError("No model file found") | ||
latest_model = max(model_files) # Gets the most recent file | ||
|
||
model.load_state_dict(torch.load(latest_model)) | ||
accuracy = evaluate_model(model) | ||
assert accuracy >= 0.8, f"Model accuracy {accuracy} is below 0.8" |