-
Notifications
You must be signed in to change notification settings - Fork 6
Support arbitrary number of feature dimensions in latent to discrete transformation #26
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @VolodyaCO. Don't forget to add a an entry to the release-log.
@thisac I don't understand very well the reno process for release notes. Is every PR intended to create a new release? |
@thisac nvm, I just read "All of the list items in this section are combined when the release notes are rendered" |
7dd9d16
to
4119f2d
Compare
4119f2d
to
a3ec9ec
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks very much Vlad for the nice PR. I've added a few minor comments.
tests/test_dvae_winci2020.py
Outdated
if __name__ == "__main__": | ||
unittest.main() | ||
unittest.main() | ||
unittest.main() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this redundant? If so, please remove it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, yes, it is! thanks for noticing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed it!
tests/test_dvae_winci2020.py
Outdated
|
||
def forward(self, x: torch.Tensor) -> torch.Tensor: | ||
return x * 20 - 10 | ||
# x is of shape (batch_size, replica_size, l1, l2, ...) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's replica_size
here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The gumbel softmax sampling is non-deterministic (depends on the random seed). The DVAE can be told how many times to sample from the logits. This number of times is the replica size. This is documented in the forward method of the DVAE, but it's called n_samples
instead of replica_size
. I will change this accordingly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed this to n_samples
.
5225ee0
to
673a581
Compare
fix number of feature dimensions [docs] consistent notation release ignore files in aim testing different number of latent dimensions extend tests to more feature dimensions Update tests/test_dvae_winci2020.py Co-authored-by: Anahita Mansouri Bigvand <[email protected]> Update tests/test_dvae_winci2020.py Co-authored-by: Anahita Mansouri Bigvand <[email protected]> Update tests/test_dvae_winci2020.py Co-authored-by: Anahita Mansouri Bigvand <[email protected]>
673a581
to
3b81ea8
Compare
The encoder might not encode a datapoint x to a 1D spin string. In the case of autoencoders where vector quantisation layers are added, encoders might encode a datapoint x to a HxWxC array. In such a case, the default latent to discrete transformation would be wrong, as it expected only a single feature dimension, whereas in this case there are three such feature dimensions.
This PR fixes that by automatically finding the number of feature dimensions in the encoded data representation, and performs the gumbel softmax transformation accordingly, keeping the same number of feature dimensions.