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] enable LoRA for Mochi-1 #9943

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open

[LoRA] enable LoRA for Mochi-1 #9943

wants to merge 8 commits into from

Conversation

sayakpaul
Copy link
Member

What does this PR do?

Needed for fine-tuning.

@@ -2362,7 +2362,7 @@ def save_lora_weights(

class CogVideoXLoraLoaderMixin(LoraBaseMixin):
r"""
Load LoRA layers into [`CogVideoXTransformer3DModel`]. Specific to [`CogVideoX`].
Load LoRA layers into [`CogVideoXTransformer3DModel`]. Specific to [`CogVideoXPipeline`].
Copy link
Member Author

Choose a reason for hiding this comment

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

Unrelated change but doesn't hurt I guess.

Copy link
Member

Choose a reason for hiding this comment

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

Looks okay to fix here

@@ -2667,6 +2667,314 @@ def unfuse_lora(self, components: List[str] = ["transformer", "text_encoder"], *
super().unfuse_lora(components=components)


class Mochi1LoraLoaderMixin(LoraBaseMixin):
Copy link
Member Author

Choose a reason for hiding this comment

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

A copy-paste of the Cog LoRA loader classes, indicated by the "Copied from ..." comments.

@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.

def test_simple_inference_with_text_denoiser_lora_unfused(self):
super().test_simple_inference_with_text_denoiser_lora_unfused(expected_atol=9e-3)

@unittest.skip("Not supported in Mochi.")
Copy link
Member

Choose a reason for hiding this comment

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

Looks good since not supporting T5 finetuning!

Copy link
Member

@a-r-r-o-w a-r-r-o-w left a comment

Choose a reason for hiding this comment

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

Looks great! Don't see any major differences in the lora mixin, so I think everything should be good to merge once the finetuning script is working - going to take a look at it now, thanks!

@sayakpaul
Copy link
Member Author

so I think everything should be good to merge once the finetuning script is working

@a-r-r-o-w thanks! Do you think it could make sense to merge regardless with the tests, etc.? Because this will also allow others to experiment from main. I am okay otherwise too.

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