Downloads · 30 days
0
chenliang1225/baichuan-7b-sft
baichuan-7b-sft is a machine learning model from chenliang1225. Use it for the machine learning task on the model card, and read the license before you ship it in a product. It is set up for transformers. The card lists the license as apache-2.0.
An instruction-tuned LoRA model of https://huggingface.co/baichuan-inc/baichuan-7B
Downloads · 30 days
0
Access
Public
Updated Jun 20, 2023
Repo size
50.4 MB
Likes
1
Public
Click a slice to open those files.
.pt33.6 MB · 66%
From the Hugging Face model README
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)