Skip to content

Remove all usage of AttnProcsLayers #4699

Closed
@williamberman

Description

@williamberman

Describe the bug

All training scripts which use AttnProcsLayers will not work properly with accelerate for any accelerate feature that requires calling into the wrapped return class for monkey patching the forward method.

All lora training scripts should instead:

  1. the top level module must be directly passed to accelerate.prepare
  2. the parameters passed to the optimizer must be pulled out of the top level module
  3. the saving callbacks must pull the lora weights out of the top level module
  4. the load callbacks must load weights into the top level module
  5. the clipped parameters must be pulled out of the top level module
  6. validation and/or other forward code must properly deal with potentially changed dtypes due to mixed precision now being actually enabled
  7. The save of the final trained model must pull the lora weights out of the top level module

This PR fixed these bugs in the dreambooth lora script https://github.com/huggingface/diffusers/pull/3778/files but there are still 4 lora training scripts which use AttnProcsLayers

other relevant github links : #4046 #4046 (comment)

Reproduction

n/a

Logs

No response

System Info

n/a

Who can help?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions