Skip to content
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

add ia3 and adalora support #809

Merged
merged 1 commit into from
Apr 19, 2024
Merged

add ia3 and adalora support #809

merged 1 commit into from
Apr 19, 2024

Conversation

sywangyi
Copy link
Collaborator

What does this PR do?

Fixes # (issue)

Before submitting

  • This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
  • Did you make sure to update the documentation with your changes?
  • Did you write any new necessary tests?

@HuggingFaceDocBuilderDev

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

@sywangyi
Copy link
Collaborator Author

huggingface/peft#1540 fixed adalora rank==0 issue in inference load model.

@sywangyi
Copy link
Collaborator Author

update peft to 0.10.0 which contains huggingface/peft#1540

@sywangyi sywangyi force-pushed the adalora_ia3 branch 3 times, most recently from a77bbba to 3540ec8 Compare April 6, 2024 12:27
@sywangyi
Copy link
Collaborator Author

sywangyi commented Apr 6, 2024

adalora + deepspeed zero3 finetune fix in peft huggingface/peft#1625

Signed-off-by: Wang, Yi A <yi.a.wang@intel.com>
@sywangyi
Copy link
Collaborator Author

sywangyi commented Apr 9, 2024

IA3 finetune with "--use_flash_attention" need PR fix in huggingface/peft#1634. since q, k, v should has some data type in FusedSDPA.apply

Copy link
Collaborator

@regisss regisss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For PEFT v0.10, there was an issue with higher memory consumption from PEFT v0.7: #590
Let me try to see if that works.

optimum/habana/peft/layer.py Show resolved Hide resolved
examples/language-modeling/run_lora_clm.py Show resolved Hide resolved
@regisss
Copy link
Collaborator

regisss commented Apr 12, 2024

We're still having an issue with Falcon-180b and more recent versions of PEFT. Let me see how we can do.

@sywangyi
Copy link
Collaborator Author

try #895 and it could fix falcon 180b issue

@regisss
Copy link
Collaborator

regisss commented Apr 18, 2024

@sywangyi LGTM! Can you share a command for both ia3 and adalora to make sure I can run them please?

@sywangyi
Copy link
Collaborator Author

sywangyi commented Apr 18, 2024

Hi, @regisss . you could use "--peft_type ia3" for IA3 and "--peft_type adalora" for adalora in run_lora_clm.py command for alpaca dataset

like

python3 run_lora_clm.py \
  --model_name_or_path meta-llama/Llama-2-7b-hf \
  --dataset_name tatsu-lab/alpaca \
  --output_dir ./lora_out \
  --num_train_epochs 1 \
  --max_step 500 \
  --max_seq_len 2048 \
  --per_device_train_batch_size 1 \
  --per_device_eval_batch_size 10 \
  --evaluation_strategy epoch \
  --eval_delay 2 \
  --save_strategy no \
  --learning_rate 0.0018 \
  --warmup_ratio 0.03 \
  --lr_scheduler_type "cosine" \
  --logging_steps 1 \
  --dataset_concatenation \
  --do_train \
  --do_eval \
  --use_habana \
  --use_lazy_mode \
  --throughput_warmup_steps 3 \
  --lora_rank 4 \
  --lora_target_modules "q_proj" "v_proj" "k_proj" "o_proj" \
  --validation_split_percentage 4 \
  --peft_type ia3 \
  --pipelining_fwd_bwd \
  --bf16 \
  --attn_softmax_bf16 True 

python3 run_lora_clm.py \
  --model_name_or_path meta-llama/Llama-2-7b-hf \
  --dataset_name tatsu-lab/alpaca \
  --output_dir ./lora_out \
  --num_train_epochs 1 \
  --max_step 500 \
  --max_seq_len 2048 \
  --per_device_train_batch_size 1 \
  --per_device_eval_batch_size 10 \
  --evaluation_strategy epoch \
  --eval_delay 2 \
  --save_strategy no \
  --learning_rate 0.0018 \
  --warmup_ratio 0.03 \
  --lr_scheduler_type "cosine" \
  --logging_steps 1 \
  --dataset_concatenation \
  --do_train \
  --do_eval \
  --use_habana \
  --use_lazy_mode \
  --throughput_warmup_steps 3 \
  --lora_rank 4 \
  --lora_target_modules "q_proj" "v_proj" "k_proj" "o_proj" \
  --validation_split_percentage 4 \
  --peft_type adalora\
  --pipelining_fwd_bwd \
  --bf16 \
  --attn_softmax_bf16 True

@regisss regisss merged commit 7a1dce9 into main Apr 19, 2024
9 checks passed
@regisss regisss deleted the adalora_ia3 branch April 19, 2024 14:43
vivekgoe pushed a commit to HabanaAI/optimum-habana-fork that referenced this pull request Jun 5, 2024
Signed-off-by: Wang, Yi A <yi.a.wang@intel.com>
vivekgoe pushed a commit to HabanaAI/optimum-habana-fork that referenced this pull request Jun 5, 2024
Signed-off-by: Wang, Yi A <yi.a.wang@intel.com>
ghost pushed a commit to HabanaAI/optimum-habana-fork that referenced this pull request Jun 5, 2024
* Add ia3 and adalora support (huggingface#809)

Signed-off-by: Wang, Yi A <yi.a.wang@intel.com>

* Fix failure in Llama-70B-FSDP test

* Fix peft files

---------

Signed-off-by: Wang, Yi A <yi.a.wang@intel.com>
Co-authored-by: Wang, Yi <yi.a.wang@intel.com>
astachowiczhabana pushed a commit to HabanaAI/optimum-habana-fork that referenced this pull request Jun 13, 2024
* Add ia3 and adalora support (huggingface#809)

Signed-off-by: Wang, Yi A <yi.a.wang@intel.com>

* Fix failure in Llama-70B-FSDP test

* Fix peft files

---------

Signed-off-by: Wang, Yi A <yi.a.wang@intel.com>
Co-authored-by: Wang, Yi <yi.a.wang@intel.com>
astachowiczhabana pushed a commit to HabanaAI/optimum-habana-fork that referenced this pull request Jun 24, 2024
* Add ia3 and adalora support (huggingface#809)

Signed-off-by: Wang, Yi A <yi.a.wang@intel.com>

* Fix failure in Llama-70B-FSDP test

* Fix peft files

---------

Signed-off-by: Wang, Yi A <yi.a.wang@intel.com>
Co-authored-by: Wang, Yi <yi.a.wang@intel.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants