Skip to content

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

Description

@voorhs

What happens

OptimizationConfig.seed is declared PositiveInt (_optimization_config.py:52), so seed=0 — a perfectly normal seed, and the first value of any seed grid — is rejected:

>>> from autointent import OptimizationConfig
>>> OptimizationConfig(seed=0, search_space=[])
ValidationError: 1 validation error for OptimizationConfig
seed
  Input should be greater than 0 [type=greater_than, input_value=0, input_type=int]

It is inconsistent with the rest of the API: Pipeline(seed=...) and Pipeline.from_search_space(seed=...) take int | None (_pipeline.py:54, :111) and accept 0, while Pipeline.from_preset(name, seed=0) and Pipeline.from_optimization_config fail because they build an OptimizationConfig (:124-127).

Proposed

NonNegativeInt (or plain int, matching Pipeline). Darinochka/AutoIntent-experiments#43 works around it by building the pipeline with the default seed and setting pipeline._seed = 0 afterwards.

Follow-up from #350.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueGood for newcomers

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions