Spaces:
Runtime error
Runtime error
Commit
·
6c51676
1
Parent(s):
afbd3cd
Tensor loading
Browse files
app.py
CHANGED
@@ -131,13 +131,17 @@ def evaluate_jaccard(text, selected_text, acronym, offsets, idx_start, idx_end):
|
|
131 |
def disambiguate(text, acronym):
|
132 |
|
133 |
inputs = process_data(text, acronym, acronym, TOKENIZER, MAX_LEN)
|
134 |
-
ids = torch.tensor(input['ids'])
|
135 |
-
mask = torch.tensor(inputs['mask'])
|
136 |
-
token_type = torch.tensor(inputs['token_type'])
|
137 |
offsets = inputs['offset']
|
138 |
expansion = inputs['expnsion']
|
139 |
acronym = inputs['acronym']
|
140 |
|
|
|
|
|
|
|
|
|
141 |
start_logits, end_logits = MODEL(ids, mask, token_type)
|
142 |
|
143 |
start_prob = torch.softmax(start_logits, axis=-1).detach().numpy()
|
|
|
131 |
def disambiguate(text, acronym):
|
132 |
|
133 |
inputs = process_data(text, acronym, acronym, TOKENIZER, MAX_LEN)
|
134 |
+
ids = torch.tensor(input['ids'])
|
135 |
+
mask = torch.tensor(inputs['mask'])
|
136 |
+
token_type = torch.tensor(inputs['token_type'])
|
137 |
offsets = inputs['offset']
|
138 |
expansion = inputs['expnsion']
|
139 |
acronym = inputs['acronym']
|
140 |
|
141 |
+
ids = torch.unsqueeze(ids, 0)
|
142 |
+
mask = torch.unsqueeze(mask, 0)
|
143 |
+
token_type = torch.unsqueeze(token_type, 0)
|
144 |
+
|
145 |
start_logits, end_logits = MODEL(ids, mask, token_type)
|
146 |
|
147 |
start_prob = torch.softmax(start_logits, axis=-1).detach().numpy()
|