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

[Bugfix] Inserted adapter_name to get_peft_model_state_dict function #626

Merged
merged 12 commits into from
Jun 27, 2023

Conversation

nafiturgut
Copy link
Contributor

Inserted adapter_name to get_peft_model_state_dict function, which was causing error when LORA_ADAPTER_NAME!='default'

nafiturgut and others added 4 commits June 25, 2023 00:11
Accelerator init updated from logging_dir to project_dir. Newer versions of accelerate uses project_dir. logging_dir is deprecated
Update train_dreambooth.py
Bugfix: Adapter name variable inserted, when changing LORA_ADAPTER_NA…
@HuggingFaceDocBuilderDev
Copy link

HuggingFaceDocBuilderDev commented Jun 26, 2023

The documentation is not available anymore as the PR was closed or merged.

Copy link
Contributor

@pacman100 pacman100 left a comment

Choose a reason for hiding this comment

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

Thank you @nafiturgut for the fix! 🤗

left a comment

@@ -19,7 +19,7 @@

def get_module_kohya_state_dict(module: PeftModel, prefix: str, dtype: torch.dtype) -> Dict[str, torch.Tensor]:
kohya_ss_state_dict = {}
for peft_key, weight in get_peft_model_state_dict(module).items():
for peft_key, weight in get_peft_model_state_dict(module, adapter_name=LORA_ADAPTER_NAME).items():
Copy link
Contributor

Choose a reason for hiding this comment

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

Here, the user needs to still update the LORA_ADAPTER_NAME. Could you please add adapter_name as kwarg with default value being LORA_ADAPTER_NAME and pass that here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@pacman100 Added adapter_name as kwarg and changed function calls

Copy link
Contributor

@pacman100 pacman100 left a comment

Choose a reason for hiding this comment

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

Hello @nafiturgut, thank you for iterating, LGTM! ✨

Once the code quality issues are resolved, we can merge this. Please run make style and make quality to resolve the code quality issues.

@nafiturgut
Copy link
Contributor Author

Hello @pacman100, updated pr with style and quality checks. Thank you for review

Copy link
Contributor

@pacman100 pacman100 left a comment

Choose a reason for hiding this comment

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

Thank you!

@pacman100 pacman100 merged commit a7ea02a into huggingface:main Jun 27, 2023
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