Skip to content

fix: preserve method docstring through apply_forward_hook decorator#14101

Open
ZAID646 wants to merge 1 commit into
huggingface:mainfrom
ZAID646:fix/preserve-docstring-apply-forward-hook
Open

fix: preserve method docstring through apply_forward_hook decorator#14101
ZAID646 wants to merge 1 commit into
huggingface:mainfrom
ZAID646:fix/preserve-docstring-apply-forward-hook

Conversation

@ZAID646

@ZAID646 ZAID646 commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

The @apply_forward_hook decorator wraps methods like AutoencoderKL.encode() and AutoencoderKL.decode() in a wrapper function without preserving the original method metadata. This causes the doc generator to miss these methods, making them absent from the online docs.

Using functools.wraps preserves __doc__, __name__, __module__, and __qualname__ through the decorator, ensuring the doc generator can discover these methods.

Fixes #6575

@github-actions github-actions Bot added fixes-issue utils size/S PR with diff < 50 LOC and removed fixes-issue labels Jul 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/S PR with diff < 50 LOC utils

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Missing methods of AutoencoderKL in online docs

1 participant