Skip to content

Conversation

@gonduras
Copy link

This commit includes several improvements to the AnimateDiff scripts:

  • animatediff.py:

    • Replaced wildcard import from animatediff_i2ibatch with explicit imports.
    • Renamed self.hacked flag in AnimateDiffScript to self.module_injected_by_this_script_run for better clarity.
  • animatediff_mm.py:

    • Added detailed comments to the GroupNorm32 monkey patching section to explain its purpose and global nature.
    • Improved consistency in UNet block index handling between inject and restore methods for input_blocks under inject_sdxl condition.
    • Added cautionary comments regarding the hardcoded UNet indices, noting their dependency on specific SD UNet architectures.
  • animatediff_i2ibatch.py:

    • Standardized error logging by replacing a print(e) call with logger.error() for UnidentifiedImageError.
  • tests/test_animatediff_mm.py:

    • Created a new unit test file.
    • Added initial test cases for AnimateDiffMM.load() method, covering successful load and file-not-found scenarios.
    • Includes basic mocking setup for A1111/Forge environment globals.

These changes aim to improve code readability, maintainability, and provide a starting point for unit testing.

This commit includes several improvements to the AnimateDiff scripts:

- `animatediff.py`:
    - Replaced wildcard import from `animatediff_i2ibatch` with explicit imports.
    - Renamed `self.hacked` flag in `AnimateDiffScript` to `self.module_injected_by_this_script_run` for better clarity.

- `animatediff_mm.py`:
    - Added detailed comments to the GroupNorm32 monkey patching section to explain its purpose and global nature.
    - Improved consistency in UNet block index handling between `inject` and `restore` methods for `input_blocks` under `inject_sdxl` condition.
    - Added cautionary comments regarding the hardcoded UNet indices, noting their dependency on specific SD UNet architectures.

- `animatediff_i2ibatch.py`:
    - Standardized error logging by replacing a `print(e)` call with `logger.error()` for `UnidentifiedImageError`.

- `tests/test_animatediff_mm.py`:
    - Created a new unit test file.
    - Added initial test cases for `AnimateDiffMM.load()` method, covering successful load and file-not-found scenarios.
    - Includes basic mocking setup for A1111/Forge environment globals.

These changes aim to improve code readability, maintainability, and provide a starting point for unit testing.
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.

1 participant