-
Notifications
You must be signed in to change notification settings - Fork 79
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
Weight demodulation #2429
Comments
@jvwilliams23 Thank you for reporting. I have implemented a version of the multi-dimensional reduction layer in #2430. You can also find a usage example in the corresponding unit test. |
Hi @tbennun thanks for implementing this. I am wondering, is it possible for me to install this branch on your fork via spack? Or do I need to wait until the PR is merged? |
Nevermind - got it! Testing now. |
Hi @tbennun. Works great! Thanks for implementing this. I will mark as closed. |
Happy to hear that! |
Hi @tbennun. Does this work in a model parallel setting (i.e. the reduction is multiplied by the output of a model parallel convolution layer, like shown below)? reduction_kernel = lbann.MultiDimReduction(lbann.Square(weights_times_styles), axes=reduction_axes)
dcoefs = lbann.Reshape(lbann.Rsqrt(reduction_kernel), dims=[out_channels, 1, 1, 1])
# scale activations by styles before convolution, scale by dcoefs after convolution
styles_reshaped = lbann.Tessellate(
styles_reshaped, dims=[in_channels, in_resolution, in_resolution]
)
x = lbann.Multiply(x, styles_reshaped)
if parallel_strategy_global is not None:
print("modulated_conv2d parallel_strategy = ", parallel_strategy_global)
conv_mod = lm.Convolution2dModule(
weights=weight.weights,
parallel_strategy=parallel_strategy_global,
**conv_kwargs
)
x = conv_mod(x)
dcoefs_reshape = lbann.Reshape(dcoefs, dims=[out_channels, 1, 1])
dcoefs_reshape = lbann.Tessellate(dcoefs_reshape, dims=[out_channels, resolution, resolution])
x = lbann.Multiply(x, dcoefs_reshape) I seem to get the following error:
|
Multi-dimensional reduction itself cannot run in model-parallel mode at the moment, but should accept model parallel outputs if you explicitly set it to be data parallel. |
Like below? reduction_kernel = lbann.MultiDimReduction(
lbann.Square(w),
axes=reduction_axes,
data_layout='data_parallel',
parallel_strategy=None
) I get the same error message. |
@benson31 any ideas? |
Hi,
We are trying to do weight demodulation on the weights of a 2D convolution layer, as in StyleGAN2 paper. Example of weight demodulation in Nvidia StyleGAN2 pytorch code:
Question; how to perform the multidimensional sum() on the
weights
to computedcoefs
?Best,
Josh
The text was updated successfully, but these errors were encountered: