Skip to content

QLORA FSDP doesn't work with 8bit #2833

@ojh31

Description

@ojh31

System Info

  • Accelerate version: 1.10.1
  • Platform: Linux-5.15.0-157-generic-x86_64-with-glibc2.39
  • accelerate bash location: /opt/uv/venv/bin/accelerate
  • Python version: 3.12.11
  • Numpy version: 2.2.6
  • PyTorch version: 2.9.0.dev20250825+cu128
  • PyTorch accelerator: CUDA
  • System RAM: 1003.13 GB
  • GPU type: NVIDIA H100 80GB HBM3
  • Accelerate default config:
    Not found
  • peft version: 0.15.2
  • transformers version: 4.56.1

Who can help?

@BenjaminBossan @githubnemo

Reproduction

Add --use_8bit_quantization True to peft/examples/sft/run_peft_qlora_fsdp.sh

accelerate launch --config_file "configs/fsdp_config_qlora.yaml"  train.py \
--seed 100 \
--model_name_or_path "meta-llama/Llama-3.1-8B-Instruct" \
--dataset_name "smangrul/ultrachat-10k-chatml" \
--chat_template_format "chatml" \
--add_special_tokens False \
--append_concat_token False \
--splits "train,test" \
--max_seq_len 2048 \
--num_train_epochs 1 \
--logging_steps 5 \
--log_level "info" \
--logging_strategy "steps" \
--eval_strategy "epoch" \
--save_strategy "epoch" \
--bf16 True \
--packing True \
--learning_rate 1e-4 \
--lr_scheduler_type "cosine" \
--weight_decay 1e-4 \
--warmup_ratio 0.0 \
--max_grad_norm 1.0 \
--output_dir "llama-sft-qlora-fsdp" \
--per_device_train_batch_size 2 \
--per_device_eval_batch_size 2 \
--gradient_accumulation_steps 2 \
--gradient_checkpointing True \
--use_reentrant True \
--dataset_text_field "content" \
--use_flash_attn True \
--use_peft_lora True \
--lora_r 8 \
--lora_alpha 16 \
--lora_dropout 0.1 \
--lora_target_modules "all-linear" \
--use_4bit_quantization True \
--use_8bit_quantization True

Expected behavior

Training should complete, instead we get ValueError: Cannot flatten integer dtype tensors

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions