Downloads · 30 days
16
5% of all-time downloads
Laurie/baichuan7b-lora-merged
baichuan7b-lora-merged is a text generation model from Laurie. Use it when you need the model to write or continue text. It is set up for transformers. The card lists the license as apache-2.0.
from transformers import AutoModelForCausalLM, AutoTokenizer, TextStreamer import torch
Downloads · 30 days
16
5% of all-time downloads
All-time downloads
305
Public
Repo size
14 GB
Likes
0
Public
Click a slice to open those files.
.bin14 GB · 100%
From the Hugging Face model README
from transformers import AutoModelForCausalLM, AutoTokenizer, TextStreamer
import torch
tokenizer = AutoTokenizer.from_pretrained("baichuan7b-lora-merged", trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained("baichuan7b-lora-merged", device_map="auto", trust_remote_code=True,torch_dtype=torch.float16)
streamer = TextStreamer(tokenizer, skip_prompt=True, skip_special_tokens=True)
while True:
query = input('请输入问题:')
if len(query.strip()) == 0:
break
inputs = tokenizer(["<human>:{}\n<bot>:".format(query)], return_tensors="pt")
inputs = inputs.to("cuda")
generate_ids = model.generate(**inputs, max_new_tokens=256, streamer=streamer)