glow-pytorch icon indicating copy to clipboard operation
glow-pytorch copied to clipboard

How to learn y condition?

Open ueoo opened this issue 5 years ago • 4 comments

Thanks for your great implementation.

The learned prior are added in every block in your implementation, which produces more promising results, however, the original implementation adds the prior only at the end of the glow,

your prior original prior and the location of prior usage

Could you please provide an example or tell me how to learn the y condition (image label)?

Thanks again!

ueoo avatar Sep 23 '19 06:09 ueoo

I added priors in every blocks because of split2d_prior in this lines: https://github.com/openai/glow/blob/eaff2177693a5d84a1cf8ae19e8e0441715b82f8/model.py#L551

I think easy way to use class conditions is use class labels as an additional inputs is NN of affine coupling layers: https://github.com/rosinality/glow-pytorch/blob/4d4a69400df5f07aa947ea809802803bd9209cb6/model.py#L162

rosinality avatar Oct 10 '19 01:10 rosinality

Following @rosinality's advice, it works with label conditioning on MNIST.

I added a label conditioning to the affine coupling layers instead of the prior (this is good because the net in this layer doesn't interfere with the invertibility of the model).

I also added a classifier working on the forward pass of the model. This classifies the final latent vector output and the logits are compared with the labels in a loss term added to the total original loss.

Thanks again @rosinality :)

(these are some samples with a shallow model with minimal filters in the coupling net)

image

homerjed avatar Nov 25 '21 14:11 homerjed

@hologerry Can you share the codes? Thank you very much!

szulm avatar Apr 01 '22 14:04 szulm

@hologerry Can you share the codes about y condition? Thank you very much!

szulm avatar Oct 31 '22 06:10 szulm

@hologerry Can you share the codes about y condition? Thank you very much!

Hi, do you solve the problem? Can you share the codes about y condition? Thank you very much!

Moleculebo avatar Mar 20 '23 08:03 Moleculebo