-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
LCM Add Tests #5707
Conversation
The documentation is not available anymore as the PR was closed or merged. |
src/diffusers/loaders.py
Outdated
state_dict, network_alphas = self.lora_state_dict( | ||
pretrained_model_name_or_path_or_dict, | ||
**kwargs, | ||
) |
There was a problem hiding this comment.
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.
src/diffusers/loaders.py
Outdated
@@ -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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove.
src/diffusers/loaders.py
Outdated
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) | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
src/diffusers/utils/peft_utils.py
Outdated
@@ -204,6 +209,81 @@ def set_weights_and_activate_adapters(model, adapter_names, weights): | |||
module.active_adapter = adapter_names | |||
|
|||
|
|||
def find_adapter_config_file( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very useful!
src/diffusers/loaders.py
Outdated
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) | ||
|
There was a problem hiding this comment.
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
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. |
* lcm add tests * uP * Fix all * uP * Add * all * uP * uP * uP * uP * uP * uP * uP
* lcm add tests * uP * Fix all * uP * Add * all * uP * uP * uP * uP * uP * uP * uP
* lcm add tests * uP * Fix all * uP * Add * all * uP * uP * uP * uP * uP * uP * uP
What does this PR do?
This PR adds tests for LCM