svjack's picture
Create README.md
ae0a2b1
|
raw
history blame
542 Bytes
```python
from transformers import T5Tokenizer, MT5ForConditionalGeneration
model = "svjack/prompt-extend-chinese"
device = "cpu"
tokenizer = T5Tokenizer.from_pretrained(model)
model = MT5ForConditionalGeneration.from_pretrained(model).to(device).eval()
prompt = "卡通龙"
encode = tokenizer(prompt, return_tensors='pt').to(device)
answer = model.generate(encode.input_ids)[0]
decoded = tokenizer.decode(answer, skip_special_tokens=True)
decoded
'''
数字艺术、艺术品趋势、电影照明、工作室质量、光滑成型、5
'''
```