jeffreygo commited on
Commit
1018474
1 Parent(s): 2ae4f3f

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +7 -7
README.md CHANGED
@@ -15,16 +15,16 @@ pip install transformers
15
  ```
16
 
17
  ```python
18
- from transformers import CPMAntTokenizer, CPMAntModel
19
 
20
- texts = ["今天天气真好!"]
21
- model = CPMAntModel.from_pretrained("openbmb/cpm-ant-10b")
22
  tokenizer = CPMAntTokenizer.from_pretrained("openbmb/cpm-ant-10b")
23
- input_ids = tokenizer.get_model_input(texts)
24
- logits, hidden = model(**input_ids)
 
25
 
26
- print(logits.shape)
27
- print(hidden.shape)
28
  ```
29
  ## pipeline
30
  ```python
 
15
  ```
16
 
17
  ```python
18
+ from transformers import CPMAntTokenizer, CPMAntForCausalLM
19
 
20
+ texts = "今天天气真好!"
21
+ model = CPMAntForCausalLM.from_pretrained("openbmb/cpm-ant-10b")
22
  tokenizer = CPMAntTokenizer.from_pretrained("openbmb/cpm-ant-10b")
23
+ input_ids = tokenizer(texts, return_tensors="pt")
24
+ outputs = model.generate(**input_ids)
25
+ output_texts = tokenizer.batch_decode(outputs)
26
 
27
+ print(output_texts)
 
28
  ```
29
  ## pipeline
30
  ```python