YAML Metadata
Warning:
empty or missing yaml metadata in repo card
(https://huggingface.co/docs/hub/model-cards#model-card-metadata)
chinese-simile-generative 是一个将句子A改写成带有修辞手法(主要为比喻,明喻)的句子B的seq2seq模型。
A: 想当初对你的定级是很高的,现在我很伤心,看到你的科研进度这么慢。
B: 想当初对你的定级是很高的,现在我很伤心,看到你的科研进度像蜗牛一样慢。
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
tokenizer = AutoTokenizer.from_pretrained("figurative-nlp/chinese-simile-generation")
model = AutoModelForSeq2SeqLM.from_pretrained("figurative-nlp/chinese-simile-generation")
input_ids = tokenizer(
"我走得很慢,慢极了", return_tensors="pt"
).input_ids
outputs = model.generate(input_ids,num_beams = 5,max_length = 64)
result = tokenizer.decode(outputs[0], skip_special_tokens=True)
print(result)
#result : 我走的很慢,像蜗牛一样。
- Downloads last month
- 14
This model does not have enough activity to be deployed to Inference API (serverless) yet. Increase its social
visibility and check back later, or deploy to Inference Endpoints (dedicated)
instead.