Implementation:Intel Ipex llm Axolotl Finetuning
| Knowledge Sources | |
|---|---|
| Domains | Finetuning, Axolotl, Integration |
| Last Updated | 2026-02-09 04:00 GMT |
Overview
Concrete tool for integrating the Axolotl fine-tuning framework with IPEX-LLM optimizations via the llm_patch mechanism.
Description
The do_cli() function wraps the Axolotl training framework with IPEX-LLM's llm_patch to enable XPU-optimized fine-tuning. It applies the patch at import time before delegating to Axolotl's standard training, inference, LoRA merging, or dataset sharding operations. This allows users to leverage Axolotl's rich configuration system (YAML-based) while benefiting from IPEX-LLM optimizations on Intel hardware.
Usage
Use this when wanting to use Axolotl's feature-rich fine-tuning framework (supporting multiple training methods, dataset formats, and configurations) on Intel XPU hardware with IPEX-LLM optimizations.
Code Reference
Source Location
- Repository: Intel IPEX-LLM
- File: python/llm/example/GPU/LLM-Finetuning/axolotl/finetune.py
- Lines: 1-86
Signature
def do_cli(config: Path = Path("examples/"), **kwargs):
"""Wrapper for Axolotl CLI with IPEX-LLM patches."""
Import
from ipex_llm import llm_patch
from axolotl.cli import load_cfg, load_datasets
from axolotl.train import train
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| config | Path | Yes | Path to Axolotl YAML configuration file |
| --inference | flag | No | Run inference mode |
| --merge_lora | flag | No | Merge LoRA adapters |
| --shard | flag | No | Shard dataset |
Outputs
| Name | Type | Description |
|---|---|---|
| Fine-tuned model | Files | Saved per Axolotl config output_dir |
| Merged model | Files | When --merge_lora is used |
Usage Examples
Axolotl Training with IPEX-LLM
python finetune.py qlora.yml
LoRA Merge
python finetune.py qlora.yml --merge_lora