cpm-ant-10b / README.md
pioliverse
add text-generation
9866627
|
raw
history blame
716 Bytes
metadata
tags:
  - text-generation
language: zh
license: apache-2.0

Usage (HuggingFace Transformers)

pip install transformers
from transformers import CPMAntTokenizer, CPMAntModel

texts = ["今天天气真好!"]
model = CPMAntModel.from_pretrained("openbmb/cpm-ant-10b")
tokenizer = CPMAntTokenizer.from_pretrained("openbmb/cpm-ant-10b")
input_ids = tokenizer.get_model_input(texts)
logits, hidden = model(**input_ids)

print(logits.shape)
print(hidden.shape)

pipeline

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