Downloads · 30 days
0
halilibr/mistral-7b-orca_dpo_pairs-fine-tuned
mistral-7b-orca_dpo_pairs-fine-tuned is a text generation model from halilibr. Use it when you need the model to write or continue text. It is set up for peft.
Downloads · 30 days
0
Access
Public
Updated Jan 4, 2024
Parameters
7.2B
14.5 GB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors14.5 GB · 100%
From the Hugging Face model README
from transformers import TrainingArguments
training_args = TrainingArguments(
per_device_train_batch_size=4,
gradient_accumulation_steps=4,
gradient_checkpointing=True,
learning_rate=5e-5,
lr_scheduler_type="cosine",
max_steps=50,
save_strategy="no",
logging_steps=1,
output_dir='<output_dir>',
optim="paged_adamw_32bit",
warmup_steps=100,
bf16=True,
)
import transformers
from transformers import AutoTokenizer
# Format prompt
message = [
{"role": "system", "content": "You are a helpful assistant chatbot."},
{"role": "user", "content": "What is a Large Language Model?"}
]
tokenizer = AutoTokenizer.from_pretrained('halilibr/mistral-7b-orca_dpo_pairs-fine-tuned')
prompt = tokenizer.apply_chat_template(message, add_generation_prompt=True, tokenize=False)
# Create pipeline
pipeline = transformers.pipeline(
"text-generation",
model='halilibr/mistral-7b-orca_dpo_pairs-fine-tuned',
tokenizer=tokenizer
)
# Generate text
sequences = pipeline(
prompt,
do_sample=True,
temperature=0.7,
top_p=0.9,
num_return_sequences=1,
max_length=200,
)
print(sequences[0]['generated_text'])