-
Notifications
You must be signed in to change notification settings - Fork 92
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
Jammy flow integration #728
base: main
Are you sure you want to change the base?
Jammy flow integration #728
Conversation
@Aske-Rosted checks are now passing. Please let me know if you have any questions |
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.
LGTM - A few questions here and there that do not necessarily require fixing.
sensor listed here will be removed from the graph. Defaults to None. | ||
string_mask: A list of string id's to be masked from the graph. Defaults to None. | ||
sensor listed here will be removed from the graph. | ||
Defaults to None. |
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.
Did some unintended formatting happen here?
return self._default_prediction_labels | ||
|
||
def nb_inputs(self) -> Union[int, None]: # type: ignore | ||
"""Return number of conditional inputs assumed by task.""" |
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.
does non-conditional inputs also exist or what is the reason for the distinction of "conditional"?
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.
Are these changes unrelated to jammy flows?
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.
reread the minor changes and these changes are described there, you can disregard this question.
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.
Are these changes also unrelated to Jammy flows?
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.
reread the minor changes and these changes are described there, you can disregard this question.
labels = labels.to(self.dtype) | ||
# Set the initial parameters of flow close to truth | ||
# This speeds up training and helps with NaN | ||
if self._initialized is False: |
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.
Just a quick note: I noticed that this part could override the learned weights whenever they are loaded from a state dict, which might affect further training or inference. It could be worth adding a global boolean to check if the weights have been loaded. Otherwise, it might be good at least to pass and self.training
, which should work when the model is set to evaluation mode for predictions.
This PR adds support for Normalizing Flows via the jammy_flows package, and therefore supersedes #649. The benefit of using
jammy_flows
is that it contains many different normalizing flows, and that we avoid maintaining that code ourselves :-).The package is not listed as a direct dependency but used as an optional support package.
Specifically, this PR introduces the following major changes:
StandardFlowTask
now uses jammy_flows to construct pdfs of any kind that it supports. These pdfs can be both conditional and non-conditional. Conditional flows can be conditioned on latent model output, event-level information or pulse-level information.NormalizingFlow
which work with theStandardFlowTask
. Usage is similar toStandardModel
.examples/04_training/07_train_normalizing_flow.py
has_jammy_flows_package()
is added undergraphnet.utils.imports
to check if its installed, and is used in a few places to make sure that the code runs also for people who choose not to install jammy_flows.Minor changes:
repeat_labels
is added as an argument toGraphDefinition
- ifTrue
, event-level information, .e.genergy
is repeated row-wise to match the number of pulses in the event. This feature was added in this PR to make it possible to build flows that learn pulse-level pdfs conditioned on event-level information.**kwargs
forTrainer
is added forpredict
-methods inEasySyntax
to allow the same level of control overTrainer
arguments as we have for.fit