-
Notifications
You must be signed in to change notification settings - Fork 66
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cross normalization #45
Comments
Hi @nzhang258 , Maybe I can help you with this. In if idx == 0 and conditional_controls is not None:
scale = conditional_controls['scale']
conditional_controls = conditional_controls['output']
mean_latents, std_latents = torch.mean(sample, dim=(1, 2, 3), keepdim=True), torch.std(sample, dim=(1, 2, 3), keepdim=True)
mean_control, std_control = torch.mean(conditional_controls, dim=(1, 2, 3), keepdim=True), torch.std(conditional_controls, dim=(1, 2, 3), keepdim=True)
conditional_controls = (conditional_controls - mean_control) * (std_latents / (std_control + 1e-5)) + mean_latents
conditional_controls = F.adaptive_avg_pool2d(conditional_controls, sample.shape[-2:])
# 0.2: This superparameter is used to adjust the control level: increasing this value will strengthen the control level.
sample = sample + conditional_controls * scale * 0.2 This is how the cross normalization is computed. Hope this may help. |
It seems not like the formulation presented in paper eq (10)? |
did you test it out with IP-adapter? @nzhang258 ? did it not work well with pre-trained Ip-adapters? |
@nzhang258 @jackyyang9 Here is my assumption: |
Thanks a lot for such an amazing work and here are some questions about training code.
Looking forward to your reply~
The text was updated successfully, but these errors were encountered: