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

LCM Add Tests #5707

Merged
merged 14 commits into from
Nov 9, 2023
Merged

LCM Add Tests #5707

merged 14 commits into from
Nov 9, 2023

Conversation

patrickvonplaten
Copy link
Contributor

@patrickvonplaten patrickvonplaten commented Nov 8, 2023

What does this PR do?

This PR adds tests for LCM

@HuggingFaceDocBuilderDev
Copy link

HuggingFaceDocBuilderDev commented Nov 8, 2023

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

Comment on lines 1205 to 1208
state_dict, network_alphas = self.lora_state_dict(
pretrained_model_name_or_path_or_dict,
**kwargs,
)
Copy link
Member

@sayakpaul sayakpaul Nov 9, 2023

Choose a reason for hiding this comment

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

If we remove the last ","m this become one-line.

@@ -1325,6 +1338,7 @@ def lora_state_dict(
weight_name = cls._best_guess_weight_name(
pretrained_model_name_or_path_or_dict, file_extension=".safetensors"
)
print("weight_name", weight_name)
Copy link
Member

Choose a reason for hiding this comment

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

Remove.

Comment on lines 1454 to 1461
if any(f.endswith(LORA_WEIGHT_NAME) for f in targeted_files):
targeted_files = list(
filter(lambda x: x.endswith(LORA_WEIGHT_NAME), targeted_files)
)
elif any(f.endswith(LORA_WEIGHT_NAME_SAFE) for f in targeted_files):
targeted_files = list(
filter(lambda x: x.endswith(LORA_WEIGHT_NAME_SAFE), targeted_files)
)
Copy link
Member

Choose a reason for hiding this comment

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

Nice!

@@ -204,6 +209,81 @@ def set_weights_and_activate_adapters(model, adapter_names, weights):
module.active_adapter = adapter_names


def find_adapter_config_file(
Copy link
Member

Choose a reason for hiding this comment

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

Very useful!

Comment on lines 1674 to 1678
if peft_config is not None:
lora_config_kwargs = LoraConfig.from_json_file(peft_config)
else:
lora_config_kwargs = get_peft_kwargs(rank, network_alphas, state_dict, is_unet=True)

Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't this come under an if USE_PEFT_BACKEND?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point!

Copy link
Member

@sayakpaul sayakpaul left a comment

Choose a reason for hiding this comment

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

@patrickvonplaten patrickvonplaten changed the title lcm add tests LCM Add Tests Nov 9, 2023
@patrickvonplaten patrickvonplaten merged commit 3d7eaf8 into main Nov 9, 2023
13 checks passed
@HuggingFaceDocBuilderDev

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint.

kashif pushed a commit to kashif/diffusers that referenced this pull request Nov 11, 2023
* lcm add tests

* uP

* Fix all

* uP

* Add

* all

* uP

* uP

* uP

* uP

* uP

* uP

* uP
@kashif kashif deleted the add_lcm_tests branch December 5, 2023 08:59
yoonseokjin pushed a commit to yoonseokjin/diffusers that referenced this pull request Dec 25, 2023
* lcm add tests

* uP

* Fix all

* uP

* Add

* all

* uP

* uP

* uP

* uP

* uP

* uP

* uP
AmericanPresidentJimmyCarter pushed a commit to AmericanPresidentJimmyCarter/diffusers that referenced this pull request Apr 26, 2024
* lcm add tests

* uP

* Fix all

* uP

* Add

* all

* uP

* uP

* uP

* uP

* uP

* uP

* uP
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

3 participants