hil-code / README.md
dongyuanjushi's picture
Upload README.md with huggingface_hub
a916cd0 verified
|
Raw
History Blame Contribute Delete
2.44 kB

HIL Code LlamaFactory Setup

Reproduce Setup

LlamaFactory expects custom local datasets under its data/ directory, registered in data/dataset_info.json, and example training YAMLs under examples/.

uv venv .venv/hil-code --python=3.12
source .venv/hil-code/bin/activate
git clone https://github.com/hiyouga/LlamaFactory.git LlamaFactory
uv pip install -e ./LlamaFactory -r LlamaFactory/requirements/metrics.txt
uv pip install -r LlamaFactory/requirements/galore.txt -r LlamaFactory/requirements/badam.txt
cp data/hil_code_dpo.json LlamaFactory/data/hil_code_dpo.json
cp data/dataset_info.json LlamaFactory/data/dataset_info.json
cp examples/train_lora/qwen36_lora_dpo.yaml LlamaFactory/examples/train_lora/qwen36_lora_dpo.yaml

The local config uses template: qwen3_5 because this LlamaFactory revision does not define a qwen3_6 template, and Qwen/Qwen3.6-27B is handled through the Qwen3.5 model family path.

Train

Run from the workspace root:

mkdir -p .cache/matplotlib
source .venv/hil-code/bin/activate
MPLCONFIGDIR="$PWD/.cache/matplotlib" CUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7 llamafactory-cli train LlamaFactory/examples/train_lora/qwen36_lora_dpo.yaml

For multi-GPU CUDA/Linux training of the 27B model, install the platform-specific extras in the same venv on the target machine:

source .venv/hil-code/bin/activate
uv pip install -r LlamaFactory/requirements/deepspeed.txt
uv pip install -r LlamaFactory/requirements/liger-kernel.txt

References:

To avoid the influences of special tokens that contained in the code, please use the following commands to run the training

IMAGE_PLACEHOLDER='<>'
VIDEO_PLACEHOLDER='<>'
AUDIO_PLACEHOLDER='<>'
CUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7 .venv/hil-code/bin/llamafactory-cli train
LlamaFactory/examples/train_lora/qwen36_lora_dpo.yaml

IMAGE_PLACEHOLDER='<>'
VIDEO_PLACEHOLDER='<>'
AUDIO_PLACEHOLDER='<>'
CUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7 .venv/hil-code/bin/llamafactory-cli train
LlamaFactory/examples/train_lora/qwen36_lora_sft.yaml