emanuelaboros commited on
Commit
e94dd5e
·
verified ·
1 Parent(s): efaf2c1

Upload folder using huggingface_hub

Browse files
Files changed (2) hide show
  1. config.json +9 -0
  2. newsagency_ner.py +4 -1
config.json CHANGED
@@ -5,6 +5,15 @@
5
  ],
6
  "attention_probs_dropout_prob": 0.1,
7
  "classifier_dropout": null,
 
 
 
 
 
 
 
 
 
8
  "hidden_act": "gelu",
9
  "hidden_dropout_prob": 0.1,
10
  "hidden_size": 768,
 
5
  ],
6
  "attention_probs_dropout_prob": 0.1,
7
  "classifier_dropout": null,
8
+ "custom_pipelines": {
9
+ "newsagency-ner": {
10
+ "impl": "newsagency_ner.NewsAgencyModelPipeline",
11
+ "pt": [
12
+ "AutoModelForTokenClassification"
13
+ ],
14
+ "tf": []
15
+ }
16
+ },
17
  "hidden_act": "gelu",
18
  "hidden_dropout_prob": 0.1,
19
  "hidden_size": 768,
newsagency_ner.py CHANGED
@@ -167,8 +167,11 @@ class NewsAgencyModelPipeline(Pipeline):
167
  input_ids = torch.tensor([inputs["input_ids"]], dtype=torch.long).to(
168
  self.model.device
169
  )
 
 
 
170
  with torch.no_grad():
171
- outputs = self.model(input_ids)
172
  return outputs, text_sentence
173
 
174
  def postprocess(self, outputs, **kwargs):
 
167
  input_ids = torch.tensor([inputs["input_ids"]], dtype=torch.long).to(
168
  self.model.device
169
  )
170
+ attention_mask = torch.tensor([inputs["attention_mask"]], dtype=torch.long).to(
171
+ self.model.device
172
+ )
173
  with torch.no_grad():
174
+ outputs = self.model(input_ids, attention_mask)
175
  return outputs, text_sentence
176
 
177
  def postprocess(self, outputs, **kwargs):