Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -22,9 +22,7 @@ class BertForSTS(torch.nn.Module):
|
|
22 |
#self.bert = AutoModelForSequenceClassification.from_pretrained("CAMeL-Lab/bert-base-arabic-camelbert-msa-sixteenth")
|
23 |
self.bert = models.Transformer(param_model_name, max_seq_length=param_max_length)
|
24 |
|
25 |
-
|
26 |
-
for p in self.bert.parameters():
|
27 |
-
p.requires_grad = False
|
28 |
dimension= self.bert.get_word_embedding_dimension()
|
29 |
#print(dimension)
|
30 |
self.pooling_layer = models.Pooling(dimension)
|
@@ -53,7 +51,7 @@ class BertForSTS(torch.nn.Module):
|
|
53 |
return x
|
54 |
model_load_path = "IBounhas/riadh/bert-sts-15.pt"
|
55 |
model = BertForSTS()
|
56 |
-
model.load_state_dict(torch.load(
|
57 |
model.to(device)
|
58 |
|
59 |
def predict_similarity(sentence_pair):
|
|
|
22 |
#self.bert = AutoModelForSequenceClassification.from_pretrained("CAMeL-Lab/bert-base-arabic-camelbert-msa-sixteenth")
|
23 |
self.bert = models.Transformer(param_model_name, max_seq_length=param_max_length)
|
24 |
|
25 |
+
|
|
|
|
|
26 |
dimension= self.bert.get_word_embedding_dimension()
|
27 |
#print(dimension)
|
28 |
self.pooling_layer = models.Pooling(dimension)
|
|
|
51 |
return x
|
52 |
model_load_path = "IBounhas/riadh/bert-sts-15.pt"
|
53 |
model = BertForSTS()
|
54 |
+
model.load_state_dict(torch.load(model_load_path, map_location=torch.device('cpu')))
|
55 |
model.to(device)
|
56 |
|
57 |
def predict_similarity(sentence_pair):
|