Skip to content

Conversation

@hyeok9855
Copy link
Collaborator

@hyeok9855 hyeok9855 commented Nov 10, 2025

  • I've read the .github/CONTRIBUTING.md file
  • My code follows the typing guidelines
  • I've added appropriate tests
  • I've run pre-commit hooks locally

Description

  • Refactor detailed balance score calculation
  • Minor refactoring of several GFlowNet classes

The results from python tutorials/examples/train_hypergrid_simple.py --loss DB are identical to the master branch.

@hyeok9855 hyeok9855 self-assigned this Nov 10, 2025
Copy link
Collaborator

@younik younik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good, thank you @hyeok9855 !

scores = preds - targets
# Apply forward-looking if applicable
if self.forward_looking:
import warnings # type: ignore
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logging should have typing

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you mean?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

im not sure I understand either. but why is type: ignore required for an import?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought it was required to avoid a Python error, but it turned out to be okay without it. Fixed.

Copy link
Collaborator

@josephdviviano josephdviviano left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm! but in the future I think it would be easier for me if you describe in your PR the intention behind the change (e.g., why you are doing a particular refactor) - it's hard for me to see why this was a priority for you, and I think knowing that would help me catch more subtle aspects of the changes.

flow of the states.
forward_looking: Whether to use the forward-looking GFN loss.
log_reward_clip_min: If finite, clips log rewards to this value.
safe_log_prob_min: If True, uses -1e10 as the minimum log probability value
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why did you remove this? it's useful.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • log_reward_clip_min is in the PFBasedGFlowNet now
  • safe_log_prob_min was not used anywhere.

scores = preds - targets
# Apply forward-looking if applicable
if self.forward_looking:
import warnings # type: ignore
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

im not sure I understand either. but why is type: ignore required for an import?

) -> None:
"""Initializes a TrajectoryBasedGFlowNet instance.
Args:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a bit confused about how you were able to get rid of this, but seems fine!

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It calls super().__init__(...) and does nothing else, so I could remove it.

@josephdviviano
Copy link
Collaborator

josephdviviano commented Nov 19, 2025 via email

@josephdviviano
Copy link
Collaborator

That's funny, we needed the safe log prob min to solve a much earlier issue. I suppose it was removed by someone. Joseph (Mobile)

On Wed, Nov 19, 2025 at 10:51 Sanghyeok Choi @.> wrote: @.* commented on this pull request. ------------------------------ In src/gfn/gflownet/detailed_balance.py <#432 (comment)>: > @@ -60,11 +60,9 @@ class DBGFlowNet(PFBasedGFlowNet[Transitions]): logF: A ScalarEstimator or ConditionalScalarEstimator for estimating the log flow of the states. forward_looking: Whether to use the forward-looking GFN loss. - log_reward_clip_min: If finite, clips log rewards to this value. - safe_log_prob_min: If True, uses -1e10 as the minimum log probability value - log_reward_clip_min is in the PFBasedGFlowNet now - safe_log_prob_min was not used anywhere. — Reply to this email directly, view it on GitHub <#432 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA7TL2U3TD4DHOB2EE2CGXL35SGW3AVCNFSM6AAAAACLVXASXWVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZTIOBTGQ4TQNBYGU . You are receiving this because your review was requested.Message ID: @.***>

Actually I just looked through the logs and it looks like it was never used anywhere. I guess I forgot to wire it in or something. I wonder why I did that??

@hyeok9855
Copy link
Collaborator Author

hyeok9855 commented Nov 19, 2025

lgtm! but in the future I think it would be easier for me if you describe in your PR the intention behind the change (e.g., why you are doing a particular refactor) - it's hard for me to see why this was a priority for you, and I think knowing that would help me catch more subtle aspects of the changes.

@josephdviviano
The work in this PR was originally a part of #431, but I separated it so as not to make each PR too big.

The intention behind these is... I just saw some suboptimal designs in the repo and wanted to improve them.

@josephdviviano
Copy link
Collaborator

josephdviviano commented Nov 19, 2025 via email

@hyeok9855 hyeok9855 merged commit a88b715 into master Nov 19, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants