-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Could not use SFT Trainer in qlora_finetuning.py #12356
Comments
Hi, I have also downgraded the transformers to 4.36.0 when I downgrade the trl to 0.9.6 and I got this error |
https://github.com/intel-analytics/ipex-llm/blob/main/docker/llm/finetune/xpu/Dockerfile I build this Dockerfile and then manually pip install trl==0.9.6 in the docker container. I ran the qlora_finetune.py in LLM_Finetuning/QLoRA/trl-example. Is there anything I missed? |
Hi @shungyantham , we have reproduced this issue in our local env. Please modify Code should look like this: trainer = SFTTrainer(
model=model,
train_dataset=train_data,
args=transformers.TrainingArguments(
per_device_train_batch_size=4,
gradient_accumulation_steps= 1,
warmup_steps=20,
max_steps=200,
learning_rate=2e-5,
save_steps=100,
bf16=True, # bf16 is more stable in training
logging_steps=20,
output_dir="outputs",
optim="adamw_hf", # paged_adamw_8bit is not supported yet
gradient_checkpointing=True, # can further reduce memory but slower
),
dataset_text_field="instruction",
data_collator=transformers.DataCollatorForSeq2Seq(
tokenizer, pad_to_multiple_of=8, return_tensors="pt", padding=True
)
) |
Hi @qiyuangong , I have faced another issue after adding the padding to the Trainer |
Please provide transformers and trl version, as well as finetune.py. For reference, this is key lib versions in our test env. After merging that PR, it can finetune model without modification. transformers 4.36.0
trl 0.9.6 |
Hi @qiyuangong , I setup a docker container following this link: inside this container, I manually installed trl==0.9.6 and ran qlora_finetuning.py in /LLM-Finetuning/QLoRA/trl-example. My transformers version is 4.36.0. |
Essential lib versions are correct. Please share your launch command and |
We can resolve this padding error by adding these lines into if tokenizer.pad_token is None:
tokenizer.pad_token = tokenizer.eos_token I will submit a PR for this change. |
I have installed trl<0.12.0 to run qlora_finetune.py in the QLoRA/trl-example but it requires transformers 4.46.2 which causes the error below.
So I downgraded trl from 0.11.4 to 0.9.6 and I got another padding error.
The text was updated successfully, but these errors were encountered: