Fix chain center-of-mass loss weighting#571
Open
taivu1998 wants to merge 1 commit into
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
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.
Summary
Fixes #540 by removing the local
weightmultiplier fromchain_center_of_mass_loss.The chain center-of-mass loss was applying
weightinside the squared clamp expression, and thenAlphaFoldLossappliedloss.chain_center_of_mass.weightagain during top-level aggregation. Because the local multiplier was inside the square, the default multimer contribution was effectively scaled by0.05 ** 3instead of the intended single top-level0.05coefficient.Changes
chain_center_of_mass_loss.weightargument in the function signature for config/backward compatibility, but document that top-level weighting is handled byAlphaFoldLoss.weightargumentNotes
This intentionally leaves config defaults and
AlphaFoldLossaggregation unchanged. It also leaves diagonal chain-pair normalization untouched, since that is a separate paper-faithfulness question from the weighting bug reported in #540.Validation
PYTHONPATH=/private/tmp/openfold-issue540-stubs:/private/tmp/openfold-issue540-test-deps-py310 python3 -m pytest tests/test_loss.py -k chain_center_of_mass -q2 passed, 1 skipped, 21 deselectedPYTHONPATH=/private/tmp/openfold-issue540-stubs:/private/tmp/openfold-issue540-test-deps-py310 python3 -m py_compile openfold/utils/loss.py tests/test_loss.pyPYTHONPATH=/private/tmp/openfold-issue540-stubs:/private/tmp/openfold-issue540-test-deps-py310 python3 -m pytest tests/test_loss.py -q1 failed, 6 passed, 17 skippedopenfold/resources/stereo_chemical_props.txtfortest_find_structural_violationsPYTHONPATH=/private/tmp/openfold-issue540-stubs:/private/tmp/openfold-issue540-test-deps-py310 python3 -m pytest tests/test_loss.py -k "not find_structural_violations" -q6 passed, 16 skipped, 2 deselected