peft safetensors mistral text-generation conversational en dataset:Intel/orca_dpo_pairs region:us
---
datasets:
- Intel/orca_dpo_pairs
language:
- en
library_name: peft
pipeline_tag: text-generation
---


## Training Arguments

```python
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,
)
```


## Quick Start

```python
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'])
```
