KoichiYasuoka commited on
Commit
58833e0
1 Parent(s): 12cdd2b
Files changed (1) hide show
  1. README.md +1 -1
README.md CHANGED
@@ -24,7 +24,7 @@ This is a RoBERTa model pre-trained on Classical Chinese texts for sentence segm
24
  import torch
25
  from transformers import AutoTokenizer,AutoModelForTokenClassification
26
  tokenizer=AutoTokenizer.from_pretrained("KoichiYasuoka/roberta-classical-chinese-base-sentence-segmentation")
27
- model=AutoModelForMaskedLM.from_pretrained("KoichiYasuoka/roberta-classical-chinese-base-sentence-segmentation")
28
  s="子曰學而時習之不亦說乎有朋自遠方來不亦樂乎人不知而不慍不亦君子乎"
29
  p=[model.config.id2label[q] for q in torch.argmax(model(tokenizer.encode(s,return_tensors="pt"))[0],dim=2)[0].tolist()[1:-1]]
30
  print("".join(c+"。" if q=="E" or q=="S" else c for c,q in zip(s,p)))
 
24
  import torch
25
  from transformers import AutoTokenizer,AutoModelForTokenClassification
26
  tokenizer=AutoTokenizer.from_pretrained("KoichiYasuoka/roberta-classical-chinese-base-sentence-segmentation")
27
+ model=AutoModelForTokenClassification.from_pretrained("KoichiYasuoka/roberta-classical-chinese-base-sentence-segmentation")
28
  s="子曰學而時習之不亦說乎有朋自遠方來不亦樂乎人不知而不慍不亦君子乎"
29
  p=[model.config.id2label[q] for q in torch.argmax(model(tokenizer.encode(s,return_tensors="pt"))[0],dim=2)[0].tolist()[1:-1]]
30
  print("".join(c+"。" if q=="E" or q=="S" else c for c,q in zip(s,p)))