Hi team! 馃憢
While working on improving docstrings and type hints across scheduler files (issue #9567), I've noticed the # Copied from pattern used extensively throughout the codebase.
Examples:
- Functions like
betas_for_alpha_bar are duplicated across multiple schedulers
- Output classes like
DDPMSchedulerOutput are copied with name replacements (e.g., DDPM->EulerDiscrete)
My question: What's the rationale behind this duplication system instead of:
- Using a shared utils.py or common.py file for common functions
- Using class inheritance for similar Output classes
I understand there might be good architectural reasons (module independence, API stability, avoiding circular dependencies, etc.), but this isn't documented anywhere that I could find.
Suggested action: Regardless of the answer, I think we should either:
- Option A: Refactor to use inheritance/shared utilities (if the current system is legacy)
- Option B: Document this design decision in:
聽 - A CONTRIBUTING.md or architecture doc
聽 - Comments in the utils/check_copies.py script itself
聽 - Another README in the diffusers directory
This would help future contributors (like me! 馃槄) understand why this pattern exists and how to work with it properly when improving documentation. What do you think?
Thanks for maintaining such a great library! 馃殌
Hi team! 馃憢
While working on improving docstrings and type hints across scheduler files (issue #9567), I've noticed the
# Copied frompattern used extensively throughout the codebase.Examples:
betas_for_alpha_barare duplicated across multiple schedulersDDPMSchedulerOutputare copied with name replacements (e.g., DDPM->EulerDiscrete)My question: What's the rationale behind this duplication system instead of:
I understand there might be good architectural reasons (module independence, API stability, avoiding circular dependencies, etc.), but this isn't documented anywhere that I could find.
Suggested action: Regardless of the answer, I think we should either:
聽 - A CONTRIBUTING.md or architecture doc
聽 - Comments in the utils/check_copies.py script itself
聽 - Another README in the diffusers directory
This would help future contributors (like me! 馃槄) understand why this pattern exists and how to work with it properly when improving documentation. What do you think?
Thanks for maintaining such a great library! 馃殌