KoichiYasuoka commited on
Commit
6e6001c
1 Parent(s): 233daa7
Files changed (1) hide show
  1. README.md +1 -1
README.md CHANGED
@@ -29,7 +29,7 @@ class UDgoeswith(object):
29
  def __call__(self,text):
30
  import numpy,torch,ufal.chu_liu_edmonds
31
  w=self.tokenizer(text,return_offsets_mapping=True)
32
- v=w["input_ids"]
33
  x=[v[0:i]+[self.tokenizer.mask_token_id]+v[i+1:]+[j] for i,j in enumerate(v[1:-1],1)]
34
  with torch.no_grad():
35
  e=self.model(input_ids=torch.tensor(x)).logits.numpy()[:,1:-2,:]
 
29
  def __call__(self,text):
30
  import numpy,torch,ufal.chu_liu_edmonds
31
  w=self.tokenizer(text,return_offsets_mapping=True)
32
+ v=[self.tokenizer.cls_token_id]+[t for t,(s,e) in zip(w["input_ids"],w["offset_mapping"]) if s<e]+[self.tokenizer.sep_token_id]
33
  x=[v[0:i]+[self.tokenizer.mask_token_id]+v[i+1:]+[j] for i,j in enumerate(v[1:-1],1)]
34
  with torch.no_grad():
35
  e=self.model(input_ids=torch.tensor(x)).logits.numpy()[:,1:-2,:]