| license: mit | |
| language: en | |
| tags: | |
| - tutorial | |
| - mnist | |
| - pytorch | |
| task_categories: | |
| - image-classification | |
| framework: pytorch | |
| # MNIST Classifier (PyTorch) | |
| ## What this model does | |
| This repository contains a simple feed-forward neural network trained to classify MNIST handwritten digits (0–9). | |
| ## Intended use | |
| - Educational example for saving, uploading, and reloading a PyTorch model using the Hugging Face Hub. | |
| - Simple baseline digit classification for MNIST-like inputs. | |
| ## How to use (inference) | |
| ```python | |
| import torch | |
| loaded = ClassifierHF.from_pretrained("foxnat/mnist-classifier-hf") | |
| loaded.eval() | |
| with torch.no_grad(): | |
| logits = loaded(x) | |
| preds = torch.argmax(logits, dim=1) | |
| ``` | |
| ## Training data | |
| MNIST handwritten digits loaded via torchvision in the tutorial notebook. | |
| ## Evaluation | |
| Test accuracy is printed in the notebook after training and after reloading from the Hub. | |
| ## Limitations | |
| - This model is intended for teaching purposes only. | |
| - Performance depends on using the same preprocessing as training. | |