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("모델 파일 재생성 완료!")