flud / regenerate_model.py
Halfotter's picture
Upload folder using huggingface_hub
ff282f7 verified
raw
history blame contribute delete
849 Bytes
import torch
import torch.nn as nn
import torch.nn.functional as F
import pickle
# SimpleClassifier ํด๋ž˜์Šค ์ •์˜
class SimpleClassifier(nn.Module):
def __init__(self, input_size, num_classes):
super(SimpleClassifier, self).__init__()
self.fc1 = nn.Linear(input_size, 256)
self.fc2 = nn.Linear(256, 128)
self.fc3 = nn.Linear(128, num_classes)
self.dropout = nn.Dropout(0.3)
def forward(self, x):
x = F.relu(self.fc1(x))
x = self.dropout(x)
x = F.relu(self.fc2(x))
x = self.dropout(x)
x = self.fc3(x)
return x
# ๋ชจ๋ธ ํŒŒ์ผ ๋‹ค์‹œ ์ƒ์„ฑ
with open('semantic_model.pkl', 'rb') as f:
data = pickle.load(f)
torch.save(data['model'].state_dict(), 'pytorch_model.bin')
print("๋ชจ๋ธ ํŒŒ์ผ ์žฌ์ƒ์„ฑ ์™„๋ฃŒ!")