Commit 1fb16033 authored by zhaoying1's avatar zhaoying1
Browse files

update

parent 7f8094a3
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
from transformers.generation.utils import GenerationConfig
tokenizer = AutoTokenizer.from_pretrained("/public/home/zhaoying1/work/Baichuan2-main/fine-tune/slurm_script/output/checkpoint-420", use_fast=False, trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained("/public/home/zhaoying1/work/Baichuan2-main/fine-tune/slurm_script/output/checkpoint-420", device_map="auto", torch_dtype=torch.bfloat16, trust_remote_code=True)
model.generation_config = GenerationConfig.from_pretrained("/public/home/zhaoying1/work/Baichuan2-main/fine-tune/slurm_script/output/checkpoint-420")
tokenizer = AutoTokenizer.from_pretrained("/baichuan/baichuan-13b-chat", use_fast=False, trust_remote_code=True)
# lora
from peft import AutoPeftModelForCausalLM
model = AutoPeftModelForCausalLM.from_pretrained("/baichuan/baichuan2_pytorch/fine-tune/output/checkpoint-4", trust_remote_code=True)
# full parameter
# model = AutoModelForCausalLM.from_pretrained("/public/home/zhaoying1/work/Baichuan2-main/fine-tune/slurm_script/output/checkpoint-420", device_map="auto", torch_dtype=torch.bfloat16, trust_remote_code=True)
model.generation_config = GenerationConfig.from_pretrained("/baichuan/baichuan-13b-chat")
messages = []
messages.append({"role": "user", "content": "解释一下“温故而知新”"})
response = model.chat(tokenizer, messages)
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
......@@ -5,6 +5,6 @@ modelName=baichuan2_pytorch
# 模型描述
modelDescription=基于pytorch的baichuan2
# 应用场景
appScenario=训练,推理,train,inference,nlp,智能聊天助手
appScenario=训练,推理,对话问答,医疗,教育,科研,金融
# 框架类型
frameType=Pytorch,Transformers,Deepspeed
File mode changed from 100644 to 100755
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment