-
Notifications
You must be signed in to change notification settings - Fork 12
HGN working without transformer #83
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
Open
fedetask
wants to merge
5
commits into
master
Choose a base branch
from
no-f-test
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
If transformer is not present in configuration, HGN will extract q and p from the latent encoding. The encoder and hnn must handle dimensions appropriately.
Comment on lines
+171
to
+176
| if self.transformer is not None: | ||
| latent_shape = (1, self.encoder.out_mean.out_channels, img_shape[0], | ||
| img_shape[1]) | ||
| else: # TODO: Don't hardcode shape | ||
| latent_shape = (1, int(self.encoder.out_mean.out_channels), 4, 4) | ||
| latent_representation = torch.randn(latent_shape).to(self.device).requires_grad_() |
Member
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.
Not sure if I understand this if else
Comment on lines
+65
to
+72
| if "transformer" in params["networks"]: | ||
| transformer = TransformerNet( | ||
| in_channels=params["networks"]["encoder"]["out_channels"], | ||
| **params["networks"]["transformer"], | ||
| dtype=dtype).to(device) | ||
| decoder_in_channels = params["networks"]["transformer"]["out_channels"] | ||
| else: | ||
| transformer = None |
Member
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.
Isn't that what def instantiate_transformer is doing?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request makes HGN work without the transformer. If
transformeris not present undernetworksin the configuration, HGN will not use it. The latent encoding will be split intoqandpand used. Therefore, the encoder and hamiltonian networks should handle dimensions appropriately.I updated the
train_config_no_transformer.yamlby making the latent encoding of 32 channels instead of 48, so that q and p are of 16 channels each.