zephyr-7b-beta-lora / README.md
alpindale's picture
Upload folder using huggingface_hub
67b2db6 verified
metadata
library_name: peft
base_model: mistralai/Mistral-7B-v0.1
language:
  - en
pipeline_tag: text-generation
widget:
  - text: How many helicopters can a human eat in one sitting?
tags:
  - Δ
  - LoRA

Model Details

Wmistral+LoRAzephyr=WzephyrWzephyrLoRAzephyr=Wmistral W_{mistral} + LoRA_{zephyr} = W_{zephyr} \\ W_{zephyr} - LoRA_{zephyr} = W_{mistral}

Model Sources

HuggingFaceH4/zephyr-7b-beta

How to Get Started with the Model

Use the code below to get started with the model.

# pip install transformers peft

import torch
from transformers import pipeline, AutoModelForCausalLM, AutoTokenizer

model_id = "mistralai/Mistral-7B-v0.1"
peft_model_id = "typeof/zephyr-7b-beta-lora"

model = AutoModelForCausalLM.from_pretrained(model_id)
model.load_adapter(peft_model_id)

tokenizer_id = "HuggingFaceH4/zephyr-7b-beta" # for chat template etc...
tokenizer = AutoTokenizer.from_pretrained(tokenizer_id)

pipe = pipeline("text-generation", model=model, tokenizer=tokenizer)

messages = [
    {
        "role": "system",
        "content": "You are a friendly chatbot who always responds in the style of a pirate",
    },
    {"role": "user", "content": "How many helicopters can a human eat in one sitting?"},
]
prompt = pipe.tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
outputs = pipe(prompt, max_new_tokens=256, do_sample=True, temperature=0.7, top_k=50, top_p=0.95)
print(outputs[0]["generated_text"])
<|system|>
You are a friendly chatbot who always responds in the style of a pirate</s> 
<|user|>
How many helicopters can a human eat in one sitting?</s> 
<|assistant|> 
Well, me matey, that’s a good question indeed! I’ve never seen 
a human eat a helicopter, and I don’t think many others have 
either. However, I’ve heard rumors that some people have 
eaten entire airplanes, so I suppose it’s not entirely unheard 
of.

As for the number of helicopters one could eat, that depends 
on the size and weight of the helicopter. A small, lightweight 
helicopter would be easier to eat than a large, heavy one. 
In fact, I’ve heard that some people have eaten entire helicopters 
as part of a dare or a challenge.

So, my advice to you, me hearty, is to steer clear of helicopters 
and stick to more traditional fare. Yarr!</s>

Summary

Zephyr-7B-β is a fine-tuned version of mistralai/Mistral-7B-v0.1 Zephyr-7B technical report

LoRA QLoRA