Skip to content

fix: avoid reading correction settings when TIS is disabled - #2349

Open
yuyz-cyber wants to merge 1 commit into
THUDM:mainfrom
yuyz-cyber:fix/mis-metrics-without-tis
Open

fix: avoid reading correction settings when TIS is disabled#2349
yuyz-cyber wants to merge 1 commit into
THUDM:mainfrom
yuyz-cyber:fix/mis-metrics-without-tis

Conversation

@yuyz-cyber

@yuyz-cyber yuyz-cyber commented Sep 4, 2026

Copy link
Copy Markdown

Problem

When --get-mismatch-metrics uses the example compute_mis_weights_with_cp helper with TIS disabled, training fails on the first batch:

AttributeError: 'Namespace' object has no attribute 'tis_lower_bound'

compute_mis_weights reads the correction bounds before checking args.use_tis. These settings are not defined or used when TIS is disabled, so the premature access raises an exception and prevents the mismatch metrics from being returned.

Fix

Move the correction-bound calculation after the args.use_tis check. With use_tis=False, the helper returns the mismatch metrics and original loss masks without accessing correction settings. The TIS-enabled path is unchanged.

Test plan

  • Added a regression test for use_tis=False without correction settings.
  • Verified that mismatch metrics and the original loss masks are returned.
  • tests/test_rollout_metrics.py: 12 passed.
  • Ruff, Black, and isort checks passed.

@yuyz-cyber
yuyz-cyber force-pushed the fix/mis-metrics-without-tis branch from d1ae592 to ba2f887 Compare September 4, 2026 07:43
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.

1 participant