Download model.py from Mehriddin1997/EMNIST-Letters-CNN: direct link, hf CLI and curl.
- Browser
- Download file 617 Bytes
-
https://huggingface.co/Mehriddin1997/EMNIST-Letters-CNN/resolve/main/model.py
- Command line
-
hf download hf://Mehriddin1997/EMNIST-Letters-CNN/model.py
-
curl -L -o model.py https://huggingface.co/Mehriddin1997/EMNIST-Letters-CNN/resolve/main/model.py
617 Bytes
| import torch | |
| import torch.nn as nn | |
| class LetterCNN(nn.Module): | |
| def __init__(self): | |
| super().__init__() | |
| self.conv = nn.Sequential( | |
| nn.Conv2d(1, 16, 3, padding=1), | |
| nn.ReLU(), | |
| nn.MaxPool2d(2), | |
| nn.Conv2d(16, 32, 3, padding=1), | |
| nn.ReLU(), | |
| nn.MaxPool2d(2), | |
| ) | |
| self.fc = nn.Sequential( | |
| nn.Linear(32*7*7, 128), | |
| nn.ReLU(), | |
| nn.Linear(128, 26) | |
| ) | |
| def forward(self, x): | |
| x = self.conv(x) | |
| x = x.view(-1, 32*7*7) | |
| return self.fc(x) |