---
library_name: peft
license: apache-2.0
base_model: Qwen/Qwen2.5-7B
tags:
- axolotl
- generated_from_trainer
datasets:
- Aratako/Magpie-Tanuki-8B-annotated-96k
model-index:
- name: custom_model_name
results: []
---
```python
from peft import PeftModel
from transformers import AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig
base_model = AutoModelForCausalLM.from_pretrained(
"Qwen/Qwen2.5-7B",
quantization_config=BitsAndBytesConfig(
load_in_4bit=True,
),
)
model = PeftModel.from_pretrained(base_model, "OsakanaTeishoku/Qwen2.5-7B-axolotl-sft-v0.1")
tokenizer = AutoTokenizer.from_pretrained("OsakanaTeishoku/Qwen2.5-7B-axolotl-sft-v0.1")
from transformers import TextStreamer
streamer = TextStreamer(
tokenizer,
skip_prompt=False,
skip_special_tokens=False,
)
prompt = "あなたは何者ですか"
messages = [
{"role": "system", "content": "You are Qwen, created by Alibaba Cloud. You are a helpful assistant."},
{"role": "user", "content": prompt}
]
text = tokenizer.apply_chat_template(
messages,
tokenize=False,
add_generation_prompt=True
)
model_inputs = tokenizer([text], return_tensors="pt").to(model.device)
generated_ids = model.generate(
**model_inputs,
max_new_tokens=512,
streamer=streamer,
eos_token_id=tokenizer.eos_token_id,
pad_token_id=tokenizer.eos_token_id,
)
```
[
](https://github.com/axolotl-ai-cloud/axolotl)
See axolotl config
axolotl version: `0.8.0`
```yaml
base_model: Qwen/Qwen2.5-7B
hub_model_id: OsakanaTeishoku/custom_model_name
load_in_8bit: false
load_in_4bit: true
strict: false
chat_template: qwen_25
datasets:
# This will be the path used for the data when it is saved to the Volume in the cloud.
- path: Aratako/Magpie-Tanuki-8B-annotated-96k
split: train[0:4000]
type: chat_template
field_messages: messages
dataset_prepared_path: last_run_prepared
val_set_size: 0.05
output_dir: ./lora-out
sequence_len: 2048
sample_packing: false
eval_sample_packing: false
pad_to_sequence_len: false
adapter: qlora
lora_model_dir:
lora_r: 16
lora_alpha: 32
lora_dropout: 0.05
lora_target_linear: true
lora_fan_in_fan_out:
lora_modules_to_save: # required when adding new tokens to LLaMA/Mistral
- embed_tokens
- lm_head
gradient_accumulation_steps: 1
micro_batch_size: 16
num_epochs: 1
optimizer: adamw_torch
lr_scheduler: cosine
learning_rate: 0.0001
bf16: auto
fp16: false
tf32: false
train_on_inputs: false
group_by_length: false
gradient_checkpointing: true
early_stopping_patience:
resume_from_checkpoint:
local_rank:
logging_steps: 1
xformers_attention:
flash_attention: true
warmup_steps: 10
save_steps:
debug:
deepspeed: /workspace/axolotl/deepspeed_configs/zero2.json
weight_decay: 0.0
fsdp:
fsdp_config:
special_tokens:
eos_token: "<|im_end|>"
plugins:
- axolotl.integrations.liger.LigerPlugin
liger_rope: true
liger_rms_norm: true
liger_glu_activation: true
liger_layer_norm: true
liger_fused_linear_cross_entropy: true
eval_strategy: "no"
save_strategy: "epoch"
```
# custom_model_name
This model is a fine-tuned version of [Qwen/Qwen2.5-7B](https://huggingface.co/Qwen/Qwen2.5-7B) on the Aratako/Magpie-Tanuki-8B-annotated-96k dataset.
## Model description
More information needed
## Intended uses & limitations
More information needed
## Training and evaluation data
More information needed
## Training procedure
### Training hyperparameters
The following hyperparameters were used during training:
- learning_rate: 0.0001
- train_batch_size: 16
- eval_batch_size: 16
- seed: 42
- distributed_type: multi-GPU
- num_devices: 2
- total_train_batch_size: 32
- total_eval_batch_size: 32
- optimizer: Use OptimizerNames.ADAMW_TORCH with betas=(0.9,0.999) and epsilon=1e-08 and optimizer_args=No additional optimizer arguments
- lr_scheduler_type: cosine
- lr_scheduler_warmup_steps: 10
- num_epochs: 1.0
### Training results
### Framework versions
- PEFT 0.15.1
- Transformers 4.51.3
- Pytorch 2.6.0+cu124
- Datasets 3.5.0
- Tokenizers 0.21.1