Spaces:
Sleeping
Sleeping
Jugal-sheth
commited on
Commit
·
53b1ccc
1
Parent(s):
52a915d
Upload 3 files
Browse files- mnist_model.pth +3 -0
- model.py +25 -0
- requirements.txt +3 -0
mnist_model.pth
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:cba2854b401f47b7c12136c72ef38cac53310ec9139d87b3eab5ba93cf14192e
|
3 |
+
size 89975
|
model.py
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# model.py
|
2 |
+
|
3 |
+
import torch.nn as nn
|
4 |
+
|
5 |
+
|
6 |
+
# neural network architecture
|
7 |
+
class Net(nn.Module):
|
8 |
+
def __init__(self):
|
9 |
+
super(Net, self).__init__()
|
10 |
+
self.conv1 = nn.Conv2d(1, 10, kernel_size=5)
|
11 |
+
self.conv2 = nn.Conv2d(10, 20, kernel_size=5)
|
12 |
+
self.dropout = nn.Dropout2d()
|
13 |
+
self.fc1 = nn.Linear(320, 50)
|
14 |
+
self.fc2 = nn.Linear(50, 10)
|
15 |
+
|
16 |
+
def forward(self, x):
|
17 |
+
x = nn.functional.relu(nn.functional.max_pool2d(self.conv1(x), 2))
|
18 |
+
x = nn.functional.relu(nn.functional.max_pool2d(self.dropout(self.conv2(x)), 2))
|
19 |
+
x = x.view(-1, 320)
|
20 |
+
x = nn.functional.relu(self.fc1(x))
|
21 |
+
x = nn.functional.dropout(x, training=self.training)
|
22 |
+
x = self.fc2(x)
|
23 |
+
return nn.functional.log_softmax(x, dim=1)
|
24 |
+
|
25 |
+
model = Net()
|
requirements.txt
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
torch
|
2 |
+
torchvision
|
3 |
+
transformers
|