Skip to content

fix: add missing parentheses to @torch.inference_mode decorator#991

Open
jnMetaCode wants to merge 2 commits into2noise:devfrom
jnMetaCode:fix-inference-mode-decorator
Open

fix: add missing parentheses to @torch.inference_mode decorator#991
jnMetaCode wants to merge 2 commits into2noise:devfrom
jnMetaCode:fix-inference-mode-decorator

Conversation

@jnMetaCode
Copy link

In ChatTTS/model/tokenizer.py, the decode method uses @torch.inference_mode without parentheses, while the encode method (and every other usage across the codebase) correctly uses @torch.inference_mode().

Without parentheses, torch.inference_mode is applied as a raw class rather than as a decorator factory. This means the decode method gets replaced by the torch.inference_mode context manager object itself, instead of being wrapped with inference mode enabled. As a result, calling decode won't actually perform any decoding — it silently returns the context manager.

This patch adds the missing () to match the rest of the codebase and restore correct behavior.

Signed-off-by: JiangNan <1394485448@qq.com>
@github-actions github-actions bot changed the base branch from main to dev March 8, 2026 14:29
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