Edit model card

使用transformers推理:

  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, "Laurie/baichuan-7b-lora-alpaca-cn")
  streamer = TextStreamer(tokenizer, skip_prompt=True, skip_special_tokens=True)
  
  query = "天空为什么是蓝色的?"
  
  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)
Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Examples
This model does not have enough activity to be deployed to Inference API (serverless) yet. Increase its social visibility and check back later, or deploy to Inference Endpoints (dedicated) instead.

Dataset used to train Laurie/baichuan-7b-lora-alpaca-cn