Skip to content

fix: allow seed=0 in OptimizationConfig - #360

Closed
kayaal34 wants to merge 1 commit into
deeppavlov:devfrom
kayaal34:fix/optimization-config-seed-zero
Closed

kayaal34 wants to merge 1 commit into
deeppavlov:devfrom
kayaal34:fix/optimization-config-seed-zero

Conversation

@kayaal34

Copy link
Copy Markdown

Closes #352

Summary

OptimizationConfig.seed was declared PositiveInt, so seed=0 was rejected, while Pipeline(seed=...) and Pipeline.from_search_space(seed=...) accept it. This also broke Pipeline.from_preset(name, seed=0) and Pipeline.from_optimization_config, which build an OptimizationConfig.

Changes

  • seed: PositiveIntseed: NonNegativeInt. Negative seeds are still rejected (numpy doesn't accept them).
  • Regenerated docs/optimizer_config.schema.json (exclusiveMinimum: 0minimum: 0).
  • Added tests: seed accepts 0/1/42 and rejects -1.

Testing

  • pytest tests/configs/test_full_config.py: 6 passed
  • Checked by hand: Pipeline.from_preset("classic-light", seed=0) now works
  • ruff check / ruff format --check pass

🤖 Generated with Claude Code

`OptimizationConfig.seed` was `PositiveInt`, so `seed=0` was rejected even
though `Pipeline(seed=0)` accepts it. This also broke
`Pipeline.from_preset(name, seed=0)`, which builds an `OptimizationConfig`.

Switch to `NonNegativeInt`, regenerate the JSON schema, and add tests.

Closes deeppavlov#352

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Copilot AI lite review requested due to automatic review settings September 19, 2026 11:25

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot review overview

🟢 Approval recommended

The implementation, schema, and boundary tests are aligned with no unresolved issues.

Review effort: Lite
Findings: None

What changed in this PR

Updates OptimizationConfig.seed to accept 0 while continuing to reject negative values.

Changes:

  • Changed seed from PositiveInt to NonNegativeInt.
  • Regenerated the optimizer configuration schema.
  • Added boundary validation tests.
File Description
tests/​configs/​test_full_config.py Tests zero, positive, and negative seeds.
src/​autointent/​_optimization_config.py Allows non-negative optimization seeds.
docs/​optimizer_config.schema.json Documents the updated minimum seed value.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@voorhs

voorhs commented Sep 20, 2026

Copy link
Copy Markdown
Collaborator

duplicate of #358

@voorhs voorhs closed this Sep 20, 2026
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.

OptimizationConfig.seed is PositiveIntseed=0 is rejected while Pipeline(seed=0) accepts it

3 participants