Instructions to use hikmatfarhat/MNIST_Classifier with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use hikmatfarhat/MNIST_Classifier with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("feature-extraction", model="hikmatfarhat/MNIST_Classifier", trust_remote_code=True)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("hikmatfarhat/MNIST_Classifier", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
File size: 494 Bytes
f3ef4ca | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | import torch.nn as nn
class Net(nn.Module):
def __init__(self,input_size,hidden_size1,hidden_size2,output_size):
super(Net, self).__init__()
self.layer1=nn.Linear(input_size,hidden_size1)
self.layer2=nn.Linear(hidden_size1,hidden_size2)
self.layer3=nn.Linear(hidden_size2,output_size)
self.relu=nn.ReLU()
def forward(self,x):
x=x.flatten(start_dim=1)
x=self.layer1(x)
x=self.relu(x)
x=self.layer2(x)
x=self.relu(x)
x=self.layer3(x)
return x |