cpm-ant-10b / README.md
jeffreygo's picture
Update README.md
1018474
|
raw
history blame
757 Bytes
metadata
tags:
  - text-generation
language: zh

Note

This repo is under development.

Usage

pip install transformers
from transformers import CPMAntTokenizer, CPMAntForCausalLM

texts = "今天天气真好!"
model = CPMAntForCausalLM.from_pretrained("openbmb/cpm-ant-10b")
tokenizer = CPMAntTokenizer.from_pretrained("openbmb/cpm-ant-10b")
input_ids = tokenizer(texts, return_tensors="pt")
outputs = model.generate(**input_ids)
output_texts = tokenizer.batch_decode(outputs)

print(output_texts)

pipeline

texts = ["昨天多云转阴,", "今天天气不错,"]
generator = pipeline("text-generation", model="openbmb/cpm-ant-10b", tokenizer="openbmb/cpm-ant-10b")
result = generator(texts)
print(result)