Text Classification
Transformers
PyTorch
Safetensors
Chinese
bart
text2text-generation
fill-mask
Summarization
Chinese
CPT
BART
BERT
seq2seq
Instructions to use OpenMOSS-Team/cpt-large with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use OpenMOSS-Team/cpt-large with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="OpenMOSS-Team/cpt-large")# Load model directly from transformers import AutoTokenizer, AutoModelForSeq2SeqLM tokenizer = AutoTokenizer.from_pretrained("OpenMOSS-Team/cpt-large") model = AutoModelForSeq2SeqLM.from_pretrained("OpenMOSS-Team/cpt-large") - Notebooks
- Google Colab
- Kaggle
fix bugs (#1)
Browse files- fix bugs (1b75f78cd79df6091ab8115a9750c33fd31926f4)
Co-authored-by: yixi <yinnxinn@users.noreply.huggingface.co>
README.md
CHANGED
|
@@ -32,9 +32,9 @@ Yunfan Shao, Zhichao Geng, Yitao Liu, Junqi Dai, Fei Yang, Li Zhe, Hujun Bao, Xi
|
|
| 32 |
>>> from transformers import BertTokenizer
|
| 33 |
>>> tokenizer = BertTokenizer.from_pretrained("fnlp/cpt-large")
|
| 34 |
>>> model = CPTForConditionalGeneration.from_pretrained("fnlp/cpt-large")
|
| 35 |
-
>>>
|
| 36 |
>>> pred_ids = model.generate(input_ids, num_beams=4, max_length=20)
|
| 37 |
-
>>> print(tokenizer.convert_ids_to_tokens(pred_ids[
|
| 38 |
['[SEP]', '[CLS]', '北', '京', '是', '中', '国', '的', '首', '都', '[SEP]']
|
| 39 |
```
|
| 40 |
|
|
|
|
| 32 |
>>> from transformers import BertTokenizer
|
| 33 |
>>> tokenizer = BertTokenizer.from_pretrained("fnlp/cpt-large")
|
| 34 |
>>> model = CPTForConditionalGeneration.from_pretrained("fnlp/cpt-large")
|
| 35 |
+
>>> input_ids = tokenizer.encode("北京是[MASK]的首都", return_tensors='pt')
|
| 36 |
>>> pred_ids = model.generate(input_ids, num_beams=4, max_length=20)
|
| 37 |
+
>>> print(tokenizer.convert_ids_to_tokens(pred_ids[0]))
|
| 38 |
['[SEP]', '[CLS]', '北', '京', '是', '中', '国', '的', '首', '都', '[SEP]']
|
| 39 |
```
|
| 40 |
|