TinyMistral-248M-Chat

Recommended Prompt Format

<|im_start|>system
{system_message}<|im_end|>
<|im_start|>user
{user_message}<|im_end|>
<|im_start|>assistant

Recommended Inference Parameters

penalty_alpha: 0.5
top_k: 5

Usage Example

from transformers import pipeline

generate = pipeline("text-generation", "Felladrin/TinyMistral-248M-Chat-v3")

messages = [
    {
        "role": "system",
        "content": "You are a highly knowledgeable and friendly assistant. Your goal is to understand and respond to user inquiries with clarity. Your interactions are always respectful, helpful, and focused on delivering the most accurate information to the user.",
    },
    {
        "role": "user",
        "content": "Hey! Got a question for you!",
    },
    {
        "role": "assistant",
        "content": "Sure! What's it?",
    },
    {
        "role": "user",
        "content": "What are some potential applications for quantum computing?",
    },
]

prompt = generate.tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)

output = generate(
    prompt,
    max_new_tokens=256,
    penalty_alpha=0.5,
    top_k=5,
)

print(output[0]["generated_text"])

How it was trained

This model was trained with SFTTrainer using the following settings:

Hyperparameter Value
Learning rate 2e-5
Total train batch size 32
Max. sequence length 2048
Weight decay 0.01
Warmup ratio 0.1
NEFTune Noise Alpha 5
Optimizer Adam with betas=(0.9,0.999) and epsilon=1e-08
Scheduler cosine
Seed 42

Then, the model was fine-tuned with DPO through LLaMA-Factory using the following hyperparameters and command:

Parameter Value
Dataset HuggingFaceH4/ultrafeedback_binarized
Learning rate 1e-06
Train batch size 4
Eval batch size 8
Seed 42
Distributed type multi-GPU
Number of devices 8
Gradient accumulation steps 4
Total train batch size 128
Total eval batch size 64
Optimizer adamw_8bit with betas=(0.9,0.999) and epsilon=1e-08
LR scheduler type cosine
LR scheduler warmup ratio 0.1
Number of epochs 2.0
llamafactory-cli train \
    --stage dpo \
    --do_train True \
    --model_name_or_path ~/TinyMistral-248M-Chat \
    --preprocessing_num_workers $(python -c "import os; print(max(1, os.cpu_count() - 2))") \
    --dataloader_num_workers $(python -c "import os; print(max(1, os.cpu_count() - 2))") \
    --finetuning_type full \
    --template default \
    --flash_attn auto \
    --enable_liger_kernel True \
    --dataset_dir data \
    --dataset ultrafeedback \
    --cutoff_len 1024 \
    --learning_rate 1e-6 \
    --num_train_epochs 2.0 \
    --per_device_train_batch_size 4 \
    --gradient_accumulation_steps 4 \
    --lr_scheduler_type cosine \
    --max_grad_norm 1.0 \
    --logging_steps 10 \
    --save_steps 50 \
    --save_total_limit 1 \
    --warmup_ratio 0.1 \
    --packing False \
    --report_to none \
    --output_dir ~/TinyMistral-248M-Chat-v3 \
    --pure_bf16 True \
    --plot_loss True \
    --trust_remote_code True \
    --ddp_timeout 180000000 \
    --include_tokens_per_second True \
    --include_num_input_tokens_seen True \
    --optim adamw_8bit \
    --pref_beta 0.5 \
    --pref_ftx 0 \
    --pref_loss simpo \
    --gradient_checkpointing True
Downloads last month
376
Safetensors
Model size
248M params
Tensor type
BF16
Β·
Inference Providers NEW
This model is not currently available via any of the supported Inference Providers.

Model tree for Felladrin/TinyMistral-248M-Chat-v3

Finetuned
(4)
this model
Adapters
1 model
Merges
3 models
Quantizations
13 models

Datasets used to train Felladrin/TinyMistral-248M-Chat-v3

Spaces using Felladrin/TinyMistral-248M-Chat-v3 2

Collection including Felladrin/TinyMistral-248M-Chat-v3