straybird commited on
Commit
90d22f9
1 Parent(s): 2de79a1

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +9 -8
README.md CHANGED
@@ -6,7 +6,7 @@ metrics:
6
  - bleu
7
  pipeline_tag: translation
8
  widget:
9
- - text: "安世字子孺,少以父任为郎"
10
  example_title: "translation"
11
  ---
12
  # Model Description
@@ -16,14 +16,15 @@ Erya4FT is based on [Erya](https://huggingface.co/RUCAIBox/Erya) and further fin
16
  # Example
17
 
18
  ```python
19
- from transformers import BertTokenizer, CPTForConditionalGeneration
20
 
21
- tokenizer = BertTokenizer.from_pretrained("RUCAIBox/Erya4FT")
22
- model = CPTForConditionalGeneration.from_pretrained("RUCAIBox/Erya4FT")
23
 
24
- input_ids = tokenizer("安世字子孺,少以父任为郎。", return_tensors='pt')
25
- input_ids.pop("token_type_ids")
26
 
27
- pred_ids = model.generate(max_new_tokens=256, **input_ids)
28
- print(tokenizer.batch_decode(pred_ids, skip_special_tokens=True))
 
29
  ```
 
6
  - bleu
7
  pipeline_tag: translation
8
  widget:
9
+ - text: "竖子不足与谋。"
10
  example_title: "translation"
11
  ---
12
  # Model Description
 
16
  # Example
17
 
18
  ```python
19
+ >>> from transformers import BertTokenizer, CPTForConditionalGeneration
20
 
21
+ >>> tokenizer = BertTokenizer.from_pretrained("RUCAIBox/Erya4FT")
22
+ >>> model = CPTForConditionalGeneration.from_pretrained("RUCAIBox/Erya4FT")
23
 
24
+ >>> input_ids = tokenizer("安世字子孺,少以父任为郎。", return_tensors='pt')
25
+ >>> input_ids.pop("token_type_ids")
26
 
27
+ >>> pred_ids = model.generate(max_new_tokens=256, **input_ids)
28
+ >>> print(tokenizer.batch_decode(pred_ids, skip_special_tokens=True))
29
+ ['这 小 子 不 值 得 与 他 商 量 。']
30
  ```