Skip to content

fix: Make training budget validation idempotent. - #52

Merged
Neonkraft merged 1 commit into
mainfrom
fix/training-budget-validation
Aug 26, 2026
Merged

Neonkraft merged 1 commit into
mainfrom
fix/training-budget-validation

Conversation

@Ali-Elganzory

Copy link
Copy Markdown
Member

Summary

The current training budget validation resolves all budget options, except #epochs, to max_steps, which gets saved in the freezed config, along with the original budget option (e.g., num_training_tokens). Thus, in the frozen config, there is more than 1 budget option set, making the actual training validation fail.

This fixes the issue by avoiding writing max_steps to the freezed config file. Then, the number of max steps is resolved wherever needed using a helper method in the configuration object.

Type of change

  • Bug fix
  • New feature
  • Refactor
  • Performance
  • Documentation
  • Maintenance

Validation

  • PYTHONPATH=src uv run pytest tests/test_data_loader.py
  • PYTHONPATH=src uv run pre-commit run --all-files
  • A successful small training run.

@Neonkraft Neonkraft left a comment

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.

Looks good to me :)

if t.max_steps is not None:
return t.max_steps
if t.num_training_samples is not None:
return math.ceil(t.num_training_samples / t.effective_batch_size)

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.

Unrelated to this PR, but I wonder how this will hold up when packing is enabled.

@Neonkraft
Neonkraft merged commit 6ca4f11 into main Aug 26, 2026
2 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.

2 participants