Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -32,7 +32,7 @@ tag_to_idx = {'cs': 0,
|
|
| 32 |
|
| 33 |
tokenizer = DistilBertTokenizer.from_pretrained('distilbert-base-uncased')
|
| 34 |
|
| 35 |
-
model = AutoModel.from_pretrained('./model', device_map='
|
| 36 |
|
| 37 |
|
| 38 |
st.markdown("### Угадыватель")
|
|
@@ -46,8 +46,8 @@ ans = None
|
|
| 46 |
|
| 47 |
if st.button('Предположить'):
|
| 48 |
inputs = tokenizer(title + ' : ' + abstract, return_tensors='pt')
|
| 49 |
-
inputs['input_ids'] = inputs['input_ids']
|
| 50 |
-
inputs['attention_mask'] = inputs['attention_mask']
|
| 51 |
|
| 52 |
with torch.no_grad():
|
| 53 |
logits = model(**inputs).logits
|
|
@@ -58,8 +58,8 @@ if st.button('Предположить'):
|
|
| 58 |
if st.button("Посмотреть топ"):
|
| 59 |
if not logits:
|
| 60 |
inputs = tokenizer(title + ' : ' + abstract, return_tensors='pt')
|
| 61 |
-
inputs['input_ids'] = inputs['input_ids']
|
| 62 |
-
inputs['attention_mask'] = inputs['attention_mask']
|
| 63 |
|
| 64 |
with torch.no_grad():
|
| 65 |
logits = model(**inputs).logits
|
|
|
|
| 32 |
|
| 33 |
tokenizer = DistilBertTokenizer.from_pretrained('distilbert-base-uncased')
|
| 34 |
|
| 35 |
+
model = AutoModel.from_pretrained('./model', device_map='CPU')
|
| 36 |
|
| 37 |
|
| 38 |
st.markdown("### Угадыватель")
|
|
|
|
| 46 |
|
| 47 |
if st.button('Предположить'):
|
| 48 |
inputs = tokenizer(title + ' : ' + abstract, return_tensors='pt')
|
| 49 |
+
inputs['input_ids'] = inputs['input_ids']
|
| 50 |
+
inputs['attention_mask'] = inputs['attention_mask']
|
| 51 |
|
| 52 |
with torch.no_grad():
|
| 53 |
logits = model(**inputs).logits
|
|
|
|
| 58 |
if st.button("Посмотреть топ"):
|
| 59 |
if not logits:
|
| 60 |
inputs = tokenizer(title + ' : ' + abstract, return_tensors='pt')
|
| 61 |
+
inputs['input_ids'] = inputs['input_ids']
|
| 62 |
+
inputs['attention_mask'] = inputs['attention_mask']
|
| 63 |
|
| 64 |
with torch.no_grad():
|
| 65 |
logits = model(**inputs).logits
|