SatAT commited on
Commit
a557725
·
1 Parent(s): d329f7c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
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]).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,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,