Skip to content

Fix WanVAE_.encode() to return both mu and log_var#574

Open
Mr-Neutr0n wants to merge 1 commit intoWan-Video:mainfrom
Mr-Neutr0n:fix/encode-return-value
Open

Fix WanVAE_.encode() to return both mu and log_var#574
Mr-Neutr0n wants to merge 1 commit intoWan-Video:mainfrom
Mr-Neutr0n:fix/encode-return-value

Conversation

@Mr-Neutr0n
Copy link

Summary

  • Fixed WanVAE_.encode() to return both mu and log_var as expected by forward()
  • Made scale parameter optional (defaults to None) in both encode() and decode() methods

Problem

The forward() method calls self.encode(x) expecting two return values (mu, log_var):

mu, log_var = self.encode(x)

However, encode() was only returning mu, causing a ValueError: not enough values to unpack.

Additionally, encode(x, scale) required the scale parameter, but forward() didn't pass it.

Changes

  1. Modified encode() to return (mu, log_var) tuple
  2. Made scale parameter optional with scale=None default
  3. Made scale parameter optional in decode() as well for consistency
  4. Updated WanVAE.encode() wrapper to extract only mu with [0] index

Related Issue

Fixes #556

Test Plan

  • forward() now works without passing scale (uses no scaling when scale=None)
  • Explicit scale parameter still works as before
  • WanVAE wrapper continues to work unchanged

@Mr-Neutr0n
Copy link
Author

bump on this — the encode() method was only returning mu and dropping log_var, which breaks anyone trying to use the VAE's full latent distribution. would appreciate a review

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.

关于 line 483: WanVAE_ 中 encode 返回值缺失 问题

1 participant

Comments