PEFT
English
tomaarsen's picture
tomaarsen HF staff
Create a model card
9f196d3
|
raw
history blame
2.25 kB
metadata
library_name: peft
datasets:
  - laion/OIG
  - argilla/oig-30k
language:
  - en
license: apache-2.0

Model card for Mistral-7B-v0.1-chat-OIG

Mistral-7B-v0.1-chat-OIG is a LLM trained to act as a chat assistant, capable of subsequent prompting. It is finetuned from mistralai/Mistral-7B-v0.1 on 3k samples from the laion/OIG dataset. The training procedure involves supervised finetuning from TRL.

Model description

Usage

from transformers import AutoTokenizer
from peft import AutoPeftModelForCausalLM
import torch

model_id = "argilla/Mistral-7B-v0.1-chat-OIG"
model = AutoPeftModelForCausalLM.from_pretrained(
    model_id,
    torch_dtype=torch.bfloat16,
    device_map="auto",
)
tokenizer = AutoTokenizer.from_pretrained(model_id)
tokenizer.pad_token_id = tokenizer.eos_token_id
text = "<human>: What were Nelson Mandela's relations with the ANC? <bot>:"
inputs = tokenizer(text, return_tensors="pt").to(model.device)

with torch.no_grad():
    outputs = model.generate(input_ids=inputs["input_ids"], max_new_tokens=250, pad_token_id=tokenizer.pad_token_id)
print(tokenizer.batch_decode(outputs, skip_special_tokens=False)[0])

Prompt template

Single step

<s><human>: {prompt} <bot>: 

or

Background: {background} <s><human>: {prompt} <bot>: 

Multi-step

<s><human>: {prompt_1} <bot>: {response_1}</s><s><human>: {prompt_2} <bot>: {response_2}</s><s><human>: {prompt_3} <bot>: 

or

Background: {background} <s><human>: {prompt_1} <bot>: {response_1}</s><s><human>: {prompt_2} <bot>: {response_2}</s><s><human>: {prompt_3} <bot>: 

Framework versions

  • Transformers 4.34.0
  • Pytorch 2.0.1+cu118
  • Datasets 2.12.0
  • Tokenizers 0.14.0
  • PEFT 0.5.0