serbog commited on
Commit
72d14aa
1 Parent(s): 646ce9c

Upload handler.py

Browse files
Files changed (1) hide show
  1. handler.py +1 -3
handler.py CHANGED
@@ -30,7 +30,7 @@ class EndpointHandler:
30
  encodings = self.tokenizer(inputs, padding=False, truncation=False)
31
 
32
  truncated_input_ids = middle_truncate(
33
- encodings["input_ids"][0].tolist(), self.MAX_LENGTH, self.tokenizer
34
  )
35
 
36
  attention_masks = [
@@ -42,8 +42,6 @@ class EndpointHandler:
42
  "attention_mask": torch.tensor([attention_masks]),
43
  }
44
 
45
- truncated_encodings.set_format("torch")
46
-
47
  outputs = self.model(**truncated_encodings)
48
 
49
  # transform logits to probabilities and apply threshold
 
30
  encodings = self.tokenizer(inputs, padding=False, truncation=False)
31
 
32
  truncated_input_ids = middle_truncate(
33
+ encodings["input_ids"], self.MAX_LENGTH, self.tokenizer
34
  )
35
 
36
  attention_masks = [
 
42
  "attention_mask": torch.tensor([attention_masks]),
43
  }
44
 
 
 
45
  outputs = self.model(**truncated_encodings)
46
 
47
  # transform logits to probabilities and apply threshold