cpm-ant-10b / README.md
neoz's picture
Update README.md
2ae4f3f
|
raw
history blame
713 Bytes
metadata
tags:
  - text-generation
language: zh

Note

This repo is under development.

Usage

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)