An instruction-tuned LoRA model of https://huggingface.co/baichuan-inc/baichuan-7B
This checkpoint is trained with: https://github.com/hiyouga/LLaMA-Efficient-Tuning
Usage:
from transformers import AutoModelForCausalLM, AutoTokenizer, TextStreamer
from peft import PeftModel
tokenizer = AutoTokenizer.from_pretrained("baichuan-inc/baichuan-7B", trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained("baichuan-inc/baichuan-7B", device_map="auto", trust_remote_code=True)
model = PeftModel.from_pretrained(model, "chenliang1225/baichuan-7b-sft")
streamer = TextStreamer(tokenizer, timeout=60.0, skip_prompt=True, skip_special_tokens=True)
query = "陨石为什么总能落在陨石坑里?"
inputs = tokenizer(["### Instruction:\n{}\n\n### Response:\n".format(query)], return_tensors="pt")
inputs = inputs.to("cuda")
generate_ids = model.generate(**inputs, max_new_tokens=256, streamer=streamer, top_p=0.7, temperature=0.95)