Skip to content

Fix latent bugs surfaced by ty migration#646

Draft
kmontemayor2-sc wants to merge 3 commits into
mainfrom
kmontemayor/ty_fix_real_bugs
Draft

Fix latent bugs surfaced by ty migration#646
kmontemayor2-sc wants to merge 3 commits into
mainfrom
kmontemayor/ty_fix_real_bugs

Conversation

@kmontemayor2-sc
Copy link
Copy Markdown
Collaborator

Resolves 4 # ty: ignore comments from PR #585 by fixing the underlying logic (not suppressing). Includes None-division risk in loss.py and masked None flow in optimizer code paths.

kmonte and others added 2 commits May 18, 2026 23:10
Resolves 4 `# ty: ignore` comments from PR #585 by fixing the underlying logic (not suppressing). Includes None-division risk in loss.py and masked None flow in optimizer code paths.

See: docs/plans/20260518-ty-ignore-resolution-meta.md
The repo's default unit-test pattern is *_test.py (Makefile:29,
tests/unit/main.py:8); the original name test_torchrec_utils.py uses
the prefix form, so the new regression coverage for apply_sparse_optimizer
would be silently skipped by make unit_test_py / CI.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@kmontemayor2-sc
Copy link
Copy Markdown
Collaborator Author

/all_test

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 19, 2026

GiGL Automation

@ 17:55:04UTC : 🔄 E2E Test started.

@ 19:24:40UTC : ✅ Workflow completed successfully.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 19, 2026

GiGL Automation

@ 17:55:05UTC : 🔄 Scala Unit Test started.

@ 18:04:08UTC : ✅ Workflow completed successfully.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 19, 2026

GiGL Automation

@ 17:55:06UTC : 🔄 C++ Unit Test started.

@ 17:57:02UTC : ✅ Workflow completed successfully.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 19, 2026

GiGL Automation

@ 17:55:07UTC : 🔄 Integration Test started.

@ 19:19:34UTC : ✅ Workflow completed successfully.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 19, 2026

GiGL Automation

@ 17:55:07UTC : 🔄 Lint Test started.

@ 18:04:07UTC : ✅ Workflow completed successfully.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 19, 2026

GiGL Automation

@ 17:55:07UTC : 🔄 Python Unit Test started.

@ 18:53:11UTC : ✅ Workflow completed successfully.

@@ -100,18 +100,27 @@ def forward(


class SoftmaxLoss(nn.Module):
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Side node, this isnt really Softmax loss but we have been calling it that.
cc @yliu2-sc - isnt this just a flavor of InfoNCE ?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

this is not even used in any runs or configs

@@ -0,0 +1,83 @@
"""Regression tests for ``apply_sparse_optimizer`` in ``gigl.experimental.knowledge_graph_embedding.common.torchrec.utils``.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

do we need test for this experimental code?
Are these auto generated?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

they were auto-generated, would you rather remove them?

return {
CondensedEdgeType(0): BatchScores(
pos_scores=pos_scores, # ty: ignore[invalid-argument-type] TODO(ty-torch-tensor-specialization): cleared by PR 3 relaxing BatchScores to Tensor.
hard_neg_scores=hard_neg_scores, # ty: ignore[invalid-argument-type] TODO(ty-torch-tensor-specialization): cleared by PR 3 relaxing BatchScores to Tensor.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

can we take a manual pass at this test first?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Hmmm do you mean why are we adding the new type ignores? I have a follow-up pr which fixes these.

- Consolidate SoftmaxLoss regression coverage into the existing
  loss_test.py (one assertion on the default temperature).
- Delete legacy_loss_test.py (was a misnamed parallel file created
  to avoid clobbering the existing loss_test.py).
- Trim torchrec_utils_test.py from 4 tests to 1 — the actual
  regression path (defaults flowing through to RowWiseAdagrad).
- Drop test-side narrative docstrings that re-described what the
  fix did rather than the contract under test.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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