Adapting commited on
Commit
733c47d
1 Parent(s): ef866a2

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +32 -0
README.md ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # how to use
2
+
3
+ ```python
4
+ # !pip install transformers
5
+ import torch.nn as nn
6
+ import torch.nn.functional as F
7
+ from huggingface_hub import PyTorchModelHubMixin
8
+
9
+ class Net(nn.Module,PyTorchModelHubMixin):
10
+ def __init__(self):
11
+ super().__init__()
12
+ self.conv1 = nn.Conv2d(3, 6, 5)
13
+ self.pool = nn.MaxPool2d(2, 2)
14
+ self.conv2 = nn.Conv2d(6, 16, 5)
15
+ self.fc1 = nn.Linear(16 * 5 * 5, 120)
16
+ self.fc2 = nn.Linear(120, 84)
17
+ self.fc3 = nn.Linear(84, 10)
18
+
19
+ def forward(self, x):
20
+ x = self.pool(F.relu(self.conv1(x)))
21
+ x = self.pool(F.relu(self.conv2(x)))
22
+ x = torch.flatten(x, 1) # flatten all dimensions except batch
23
+ x = F.relu(self.fc1(x))
24
+ x = F.relu(self.fc2(x))
25
+ x = self.fc3(x)
26
+ return x
27
+
28
+ net = Net.from_pretrained('Adapting/cifar10-image-classification')
29
+
30
+ ```
31
+
32
+ example codes for testing the model: [link](https://colab.research.google.com/drive/10xjbgSzw-U1Y4vCot5aqqdOi7AhmIkC3?usp=sharing)