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

[lora] support lora for Gemini #5001

Open
wants to merge 8 commits into
base: feature/lora
Choose a base branch
from

Conversation

Fridge003
Copy link
Contributor

@Fridge003 Fridge003 commented Nov 1, 2023

📌 Checklist before creating the PR

  • I have created an issue for this PR for traceability
  • The title follows the standard format: [doc/gemini/tensor/...]: A concise description
  • I have added relevant tags if possible for us to better distinguish different PRs

🚨 Issue number

Link this PR to your issue with words like fixed to automatically close the linked issue upon merge

e.g. fixed #1234, closed #1234, resolved #1234

resolved #4929

📝 What does this PR do?

Summarize your work here.
if you have any plots/diagrams/screenshots/tables, please attach them here.

  • support lora feature for gemini plugin

💥 Checklist before requesting a review

  • I have linked my PR to an issue (instruction)
  • My issue clearly describes the problem/feature/proposal, with diagrams/charts/table/code if possible
  • I have performed a self-review of my code
  • I have added thorough tests.
  • I have added docstrings for all the functions/methods I implemented

⭐️ Do you enjoy contributing to Colossal-AI?

  • 🌝 Yes, I do.
  • 🌚 No, I don't.

Tell us more if you don't enjoy contributing to Colossal-AI.

@Fridge003 Fridge003 force-pushed the feature/lora branch 6 times, most recently from 69136b6 to 3bf7e1c Compare November 8, 2023 10:59
@Fridge003 Fridge003 marked this pull request as ready for review November 9, 2023 06:58
@Fridge003 Fridge003 requested a review from ver217 November 9, 2023 07:05
peft_config.base_model_name_or_path = peft_model.base_model.model.__dict__.get("name_or_path", None)

inference_mode = peft_config.inference_mode
peft_config.inference_mode = True
Copy link
Member

Choose a reason for hiding this comment

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

Why set inference mode to True before saving?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Peft will set it to True when saving, and I didn't change this behavior.

@@ -142,7 +142,6 @@ def _flatten_grad_args(args) -> Tuple[list, list, List[bool], TreeSpec]:
grad_args.append(arg)
else:
other_args.append(arg)
assert len(grad_args) > 0
Copy link
Member

Choose a reason for hiding this comment

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

Why remove the assertation? If there are no grad args, post-backward hook may be not triggered.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

They are plenty of parameters with requires_grad being False when lora is enabled. So len(grad_args) often equals to zero during training.

tests/test_lora/test_gemini_lora.py Outdated Show resolved Hide resolved
@xs1997zju
Copy link

any update of this work?

@KaiLv69
Copy link
Contributor

KaiLv69 commented Jun 1, 2024

Looking forward to the feature implemented in this PR!

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.

None yet

4 participants