Skip to content

Commit

Permalink
Skip flow fit when there are no trainable parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
davidnabergoj committed Jul 29, 2024
1 parent c6b90f9 commit a339b9a
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions normalizing_flows/flows.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,10 @@ def fit(self,
:param early_stopping: if True and validation data is provided, stop the training procedure early once validation loss stops improving for a specified number of consecutive epochs.
:param early_stopping_threshold: if early_stopping is True, fitting stops after no improvement in validation loss for this many epochs.
"""
if len(list(self.parameters())) == 0:
# If the flow has no trainable parameters, do nothing
return

self.train()

# Set the default batch size
Expand Down

0 comments on commit a339b9a

Please sign in to comment.