File size: 1,132 Bytes
6a635a7 b2efac5 6a635a7 1845e61 b2efac5 58102f0 b2efac5 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
---
license: apache-2.0
language:
- zh
---
finetuned from Qwen
```python
from transformers import AutoModelForCausalLM, AutoTokenizer
from transformers.generation import GenerationConfig
tokenizer = AutoTokenizer.from_pretrained("huskyhong/noname-ai-v2_3-light", trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained("huskyhong/noname-ai-v2_3-light", device_map="auto", trust_remote_code=True).eval() # 采用gpu加载模型
# model = AutoModelForCausalLM.from_pretrained("huskyhong/noname-ai-v2_3-light", device_map="cpu", trust_remote_code=True).float() # 采用cpu加载模型
model.generation_config = GenerationConfig.from_pretrained("huskyhong/noname-ai-v2_3-light", trust_remote_code=True) # 可指定不同的生成长度、top_p等相关超参
prompt = "请帮我编写一个技能,技能效果如下:" + input("请输入技能效果:")
response, history = model.chat(tokenizer, prompt, history = [])
print(response)
prompt = "请帮我编写一张卡牌,卡牌效果如下:" + input("请输入卡牌效果:")
response, history = model.chat(tokenizer, prompt, history = [])
print(response)
``` |