Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -59,7 +59,7 @@ model = DistillBERTClass()
|
|
59 |
LEARNING_RATE = 1e-05
|
60 |
|
61 |
optimizer = torch.optim.Adam(params = model.parameters(), lr=LEARNING_RATE)
|
62 |
-
model = torch.load("pytorch_distilbert_news (
|
63 |
# model.load_state_dict(checkpoint['model'])
|
64 |
# optimizer.load_state_dict(checkpoint['opt'])
|
65 |
# model.to("cpu")
|
@@ -91,7 +91,7 @@ def get_predict(text):
|
|
91 |
)
|
92 |
logits = outputs[0]
|
93 |
y_predict = torch.nn.functional.softmax(logits).cpu().detach().numpy()
|
94 |
-
file_path = "
|
95 |
|
96 |
with open(file_path, 'r') as json_file:
|
97 |
decode_target = json.load(json_file)
|
|
|
59 |
LEARNING_RATE = 1e-05
|
60 |
|
61 |
optimizer = torch.optim.Adam(params = model.parameters(), lr=LEARNING_RATE)
|
62 |
+
model = torch.load("pytorch_distilbert_news (3).bin", map_location=torch.device('cpu'))
|
63 |
# model.load_state_dict(checkpoint['model'])
|
64 |
# optimizer.load_state_dict(checkpoint['opt'])
|
65 |
# model.to("cpu")
|
|
|
91 |
)
|
92 |
logits = outputs[0]
|
93 |
y_predict = torch.nn.functional.softmax(logits).cpu().detach().numpy()
|
94 |
+
file_path = "sample.json"
|
95 |
|
96 |
with open(file_path, 'r') as json_file:
|
97 |
decode_target = json.load(json_file)
|