GroupDRO resume unpacks the wrong checkpoint loader
- Dominant language
- Python
- Stars
- 1
- Forks
- 1
- PR merge metrics
- No merged PRs in 30d
Description
## Summary
Resuming a GroupDRO run with `--resume --loss groupdro` fails before training because the code unpacks four values from the three-value `load_checkpoint` helper. It then also calls the same loader a second time unconditionally.
This is still present on `main` at `a0b47382f08b108a17a39b343c4e58dbf2852db3`.
## Evidence
`trial_training/train_plugins_v2.py` lines 349–352 contain:
```python
elif args.resume and os.path.exists(checkpoint_path):
if loss_type == 'groupdro':
start_epoch, best_val_auc, patience_counter, groupdro_q = load_checkpoint(...)
start_epoch, best_val_auc, patience_counter = load_checkpoint(...)
```
`utils.load_checkpoint` returns exactly three values (lines 509–517). The repository already defines `load_checkpoint_with_groupdro`, which returns the expected fourth `groupdro_q` value (lines 519–528), but the training script neither imports nor calls it.
A minimal call that replaces `load_checkpoint` with a stub returning `(1, 0.5, 0)` reproduces:
```text
ValueError: not enough values to unpack (expected 4, got 3)
```
## Expected behavior
GroupDRO resume should restore the standard checkpoint fields and the saved group weights exactly once, while other loss types continue using the standard loader.
## Impact
Any GroupDRO checkpoint written by this script cannot be resumed through the advertised `--resume` path. Long-running experiments must restart, and the learned group distribution is not restored.
## Suggested fix
Import and call `load_checkpoint_with_groupdro` in the GroupDRO branch, and put the standard `load_checkpoint` call in an `else` branch. Add a focused test for loader selection and restored `groupdro_q`.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start in trial_training/train_plugins_v2.py around the resume branch, then inspect utils.load_checkpoint and load_checkpoint_with_groupdro. Reproduce the failing GroupDRO resume path and add a focused test for loader selection and restored group weights. Done means GroupDRO loads its four values once, while other loss types use the standard three-value loader.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- machine-learning
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 88/100