From 126f95be805ed5f50c847371a56dbe049bcaf762 Mon Sep 17 00:00:00 2001 From: "Jin, Qiao" <89779290+JinBridger@users.noreply.github.com> Date: Fri, 1 Nov 2024 13:29:44 +0800 Subject: [PATCH] Fix DPO finetuning example (#12313) --- python/llm/example/GPU/LLM-Finetuning/DPO/README.md | 5 +++-- python/llm/example/GPU/LLM-Finetuning/DPO/dpo_finetuning.py | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/python/llm/example/GPU/LLM-Finetuning/DPO/README.md b/python/llm/example/GPU/LLM-Finetuning/DPO/README.md index 9fdf34cbbb0..3e0a07a4970 100644 --- a/python/llm/example/GPU/LLM-Finetuning/DPO/README.md +++ b/python/llm/example/GPU/LLM-Finetuning/DPO/README.md @@ -17,8 +17,9 @@ conda create -n llm python=3.11 conda activate llm # below command will install intel_extension_for_pytorch==2.1.10+xpu as default pip install --pre --upgrade ipex-llm[xpu] --extra-index-url https://pytorch-extension.intel.com/release-whl/stable/xpu/us/ -pip install transformers==4.36.0 datasets -pip install trl peft==0.10.0 +pip install datasets +pip install peft==0.10.0 +pip install 'trl<0.9' # Note, if you don't want to reinstall BNBs dependencies, append the `--no-deps` flag! pip install --no-deps --force-reinstall 'https://github.com/bitsandbytes-foundation/bitsandbytes/releases/download/continuous-release_multi-backend-refactor/bitsandbytes-0.44.1.dev0-py3-none-manylinux_2_24_x86_64.whl' ``` diff --git a/python/llm/example/GPU/LLM-Finetuning/DPO/dpo_finetuning.py b/python/llm/example/GPU/LLM-Finetuning/DPO/dpo_finetuning.py index 54e05c9a719..ca01bff9111 100644 --- a/python/llm/example/GPU/LLM-Finetuning/DPO/dpo_finetuning.py +++ b/python/llm/example/GPU/LLM-Finetuning/DPO/dpo_finetuning.py @@ -34,12 +34,12 @@ import os import torch +from ipex_llm.transformers.qlora import get_peft_model, prepare_model_for_kbit_training +from ipex_llm.transformers import AutoModelForCausalLM import transformers from transformers import AutoTokenizer, TrainingArguments, BitsAndBytesConfig from datasets import load_dataset from peft import LoraConfig -from ipex_llm.transformers.qlora import get_peft_model, prepare_model_for_kbit_training -from ipex_llm.transformers import AutoModelForCausalLM from trl import DPOTrainer import argparse