Spaces:
Sleeping
Sleeping
File size: 487 Bytes
f1d9d07 994b482 f1d9d07 994b482 fd675bd 7f0aa08 fd675bd 994b482 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
# model_wrappers/model_a.py
from transformers import pipeline
# 中文 GPT2:Wenzhong
model_a = pipeline("text-generation", model="IDEA-CCNL/Wenzhong-GPT2-110M", tokenizer="IDEA-CCNL/Wenzhong-GPT2-110M")
def run_model_a(prompt: str) -> str:
output = model_a(prompt,
max_length=100,
do_sample=True,
temperature=0.8,
top_k=50,
top_p=0.95)
return output[0]["generated_text"] |