Spaces:
Runtime error
Runtime error
Update model_arch.py
Browse files- model_arch.py +10 -0
model_arch.py
CHANGED
@@ -16,3 +16,13 @@ class TextClassifierModel(nn.Module):
|
|
16 |
embedded_activated = F.relu(embedded_norm)
|
17 |
|
18 |
return self.fc(embedded_activated)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
embedded_activated = F.relu(embedded_norm)
|
17 |
|
18 |
return self.fc(embedded_activated)
|
19 |
+
|
20 |
+
|
21 |
+
def load_state_dict(new_model, new_optimizer, trained_model, vocab):
|
22 |
+
num_class = 11
|
23 |
+
vocab_size = len(vocab)
|
24 |
+
embed_size = 300
|
25 |
+
new_model.load_state_dict(trained_model['model_state_dict'])
|
26 |
+
new_optimizer.load_state_dict(trained_model['optimizer_state_dict'])
|
27 |
+
return new_model, new_optimizer
|
28 |
+
|