Upload folder using huggingface_hub
Browse files- regenerate_model.py +28 -0
- semantic_model.pkl +3 -0
regenerate_model.py
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import torch
|
| 2 |
+
import torch.nn as nn
|
| 3 |
+
import torch.nn.functional as F
|
| 4 |
+
import pickle
|
| 5 |
+
|
| 6 |
+
# SimpleClassifier ํด๋์ค ์ ์
|
| 7 |
+
class SimpleClassifier(nn.Module):
|
| 8 |
+
def __init__(self, input_size, num_classes):
|
| 9 |
+
super(SimpleClassifier, self).__init__()
|
| 10 |
+
self.fc1 = nn.Linear(input_size, 256)
|
| 11 |
+
self.fc2 = nn.Linear(256, 128)
|
| 12 |
+
self.fc3 = nn.Linear(128, num_classes)
|
| 13 |
+
self.dropout = nn.Dropout(0.3)
|
| 14 |
+
|
| 15 |
+
def forward(self, x):
|
| 16 |
+
x = F.relu(self.fc1(x))
|
| 17 |
+
x = self.dropout(x)
|
| 18 |
+
x = F.relu(self.fc2(x))
|
| 19 |
+
x = self.dropout(x)
|
| 20 |
+
x = self.fc3(x)
|
| 21 |
+
return x
|
| 22 |
+
|
| 23 |
+
# ๋ชจ๋ธ ํ์ผ ๋ค์ ์์ฑ
|
| 24 |
+
with open('semantic_model.pkl', 'rb') as f:
|
| 25 |
+
data = pickle.load(f)
|
| 26 |
+
|
| 27 |
+
torch.save(data['model'].state_dict(), 'pytorch_model.bin')
|
| 28 |
+
print("๋ชจ๋ธ ํ์ผ ์ฌ์์ฑ ์๋ฃ!")
|
semantic_model.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:ece66c155962546b7954bc96691a0974d54fa423a3211c112236bc230af39f37
|
| 3 |
+
size 3390141
|