Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -48,8 +48,8 @@ encoded_sent = tokenizer.encode(
|
|
48 |
indexed_tokens = tokenizer.convert_tokens_to_ids(tokenizer.tokenize(str(text)))#le.convert_tokens_to_ids(tkns)
|
49 |
segments_ids = [0] * len(indexed_tokens)
|
50 |
|
51 |
-
tokens_tensor = torch.tensor([indexed_tokens])
|
52 |
-
segments_tensors = torch.tensor([segments_ids])
|
53 |
|
54 |
model = BertForSequenceClassification.from_pretrained(
|
55 |
"bert-base-uncased", # Use the 12-layer BERT model, with an uncased vocab.
|
@@ -59,7 +59,7 @@ model = BertForSequenceClassification.from_pretrained(
|
|
59 |
output_hidden_states = False, # Whether the model returns all hidden-states.
|
60 |
)
|
61 |
model.load_state_dict(torch.load("model_last_version.pt"))
|
62 |
-
model.to(device)
|
63 |
model.eval()
|
64 |
with torch.no_grad():
|
65 |
logit = model(tokens_tensor,
|
|
|
48 |
indexed_tokens = tokenizer.convert_tokens_to_ids(tokenizer.tokenize(str(text)))#le.convert_tokens_to_ids(tkns)
|
49 |
segments_ids = [0] * len(indexed_tokens)
|
50 |
|
51 |
+
tokens_tensor = torch.tensor([indexed_tokens])#.to(device)
|
52 |
+
segments_tensors = torch.tensor([segments_ids])#.to(device)
|
53 |
|
54 |
model = BertForSequenceClassification.from_pretrained(
|
55 |
"bert-base-uncased", # Use the 12-layer BERT model, with an uncased vocab.
|
|
|
59 |
output_hidden_states = False, # Whether the model returns all hidden-states.
|
60 |
)
|
61 |
model.load_state_dict(torch.load("model_last_version.pt"))
|
62 |
+
# model.to(device)
|
63 |
model.eval()
|
64 |
with torch.no_grad():
|
65 |
logit = model(tokens_tensor,
|