How to use from the
Use from the
Transformers library
# Use a pipeline as a high-level helper
from transformers import pipeline

pipe = pipeline("image-classification", model="dacorvo/mnist-mlp", trust_remote_code=True)
pipe("https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/hub/parrots.png")
# pip install -U transformers accelerate
# Load model directly
from transformers import AutoModel
model = AutoModel.from_pretrained("dacorvo/mnist-mlp", trust_remote_code=True, device_map="auto")
Quick Links

Model Card for MNIST-MLP

This is a simple MLP trained on the MNIST dataset.

Its primary use is to be a very simple reference model to test quantization.

Inputs preprocessing

The MNIST images must be normalized and flattened as follows:

from torchvision import datasets, transforms


transform=transforms.Compose([
        transforms.ToTensor(),
        transforms.Normalize((0.1307,), (0.3081,)),
        transforms.Lambda(lambda x: torch.flatten(x)),
])
test_set = datasets.MNIST('../data', train=False, download=True,
                          transform=transform)
Downloads last month
366
Safetensors
Model size
269k params
Tensor type
F32
ยท
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support