--- license: apache-2.0 language: - zh --- A instruction-tuned LoRA model of https://huggingface.co/baichuan-inc/baichuan-7B Training framework: https://github.com/hiyouga/LLaMA-Factory Please follow the baichuan-7B License to use this model. Usage: from transformers import AutoModelForCausalLM, AutoTokenizer, TextStreamer tokenizer = AutoTokenizer.from_pretrained("hiyouga/baichuan-7b-sft", trust_remote_code=True) model = AutoModelForCausalLM.from_pretrained("hiyouga/baichuan-7b-sft", trust_remote_code=True).cuda() streamer = TextStreamer(tokenizer, skip_prompt=True, skip_special_tokens=True) query = "晚上睡不着怎么办" template = ( "你是一名经验丰富的心理咨询师,专长于认知行为疗法, 以心理咨询师的身份回答以下问题。\n" "Human: {}\nAssistant: " ) inputs = tokenizer([template.format(query)], return_tensors="pt") inputs = inputs.to("cuda") generate_ids = model.generate(**inputs, max_new_tokens=256, streamer=streamer)