Views
No views yet
pip install -r requirements.txt1from transformers import AutoModelForCausalLM, AutoTokenizer
2from transformers.generation import GenerationConfig
3tokenizer = AutoTokenizer.from_pretrained("huskyhong/noname-ai-v2_5", trust_remote_code=True)
4model = AutoModelForCausalLM.from_pretrained("huskyhong/noname-ai-v2_5", device_map="auto", trust_remote_code=True).eval() # Load the model using GPU
5# model = AutoModelForCausalLM.from_pretrained("huskyhong/noname-ai-v2_5", device_map="cpu", trust_remote_code=True).eval() # Load the model using CPU
65model.generation_config = GenerationConfig.from_pretrained("huskyhong/noname-ai-v2_5", trust_remote_code=True) # You can specify different generation lengths, top_p, 和 other related hyperparameters
7# For the first generation model, replace "huskyhong/noname-ai-v2_5" with "huskyhong/noname-ai-v1". For lightweight version v2.5 model, replace "huskyhong/noname-ai-v2_5" with "huskyhong/noname-ai-v2_5-light"
8
9prompt = "请帮我编写一个技能,技能效果如下:" + input("请输入技能效果:")
10response, history = model.chat(tokenizer, prompt, history = [])
11print(response)
12
13prompt = "请帮我编写一张卡牌,卡牌效果如下::" + input("请输入卡牌效果:")
14response, history = model.chat(tokenizer, prompt, history = [])
15print(response)1from transformers import pipeline, AutoTokenizer, AutoModelForCausalLM, GenerationConfig
2generator = pipeline(
3 "text-generation",
4 model="huskyhong/noname-ai-v2_5",
5 tokenizer="huskyhong/noname-ai-v2_5",
6 device=0, # Choose GPU device. If you want to use CPU, you can set device=-1
7 trust_remote_code=True
8)
9
10prompt = "请帮我编写一个技能,技能效果如下:" + input("请输入技能效果:")
11response = generator(prompt, max_length=50, top_p=0.95) # You can adjust parameters such as generation length, top_p as needed
12print(response[0]['generated_text'])
13
14prompt = "请帮我编写一张卡牌,卡牌效果如下:" + input("请输入卡牌效果:")
15response = generator(prompt, max_length=50, top_p=0.95) # You can adjust parameters such as generation length, top_p as needed
16print(response[0]['generated_text'])your_model_name with your actual model path.pip install -r requirements.txtpip install streamlitstreamlit run webdemo.pypip install peft deepspeed1git lfs install
2git clone https://github.com/204313508/noname_llm.git
3git clone https://huggingface.co/huskyhong/noname-ai-v2_3-light
4cd noname_llm/finetunebash finetune.sh


