Skip to content

Skip trial validation on copy_study#6249

Merged
c-bata merged 1 commit intooptuna:masterfrom
gen740:skip_validation_on_copy_study
Aug 20, 2025
Merged

Skip trial validation on copy_study#6249
c-bata merged 1 commit intooptuna:masterfrom
gen740:skip_validation_on_copy_study

Conversation

@gen740
Copy link
Copy Markdown
Member

@gen740 gen740 commented Aug 15, 2025

Motivation

Fix #6163.

As mentioned in #6163, copy_study does not allow enqueued_trials whose parameters are out of the distribution range. This is because copy_study internally calls trial._validate on every trial.

In copy_study, we can assume that the trials in the study are valid (unless the user has modified the database or storage directly). Therefore, I believe that simply skipping the validation is the best solution.

Description of the changes

  • Modified copy_study to skip trial validation.

@gen740 gen740 changed the title feat(study): Skip trial validation on copy_study Skip trial validation on copy_study Aug 15, 2025
@c-bata c-bata marked this pull request as ready for review August 18, 2025 04:45
@c-bata c-bata added the bug Issue/PR about behavior that is broken. Not for typos/examples/CI/test but for Optuna itself. label Aug 18, 2025
Copy link
Copy Markdown
Member

@y0z y0z left a comment

Choose a reason for hiding this comment

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

LGTM

@y0z
Copy link
Copy Markdown
Member

y0z commented Aug 20, 2025

@c-bata Could you review this PR?

@c-bata c-bata added this to the v4.6.0 milestone Aug 20, 2025
@c-bata c-bata merged commit cb32949 into optuna:master Aug 20, 2025
15 checks passed
@gen740 gen740 deleted the skip_validation_on_copy_study branch October 3, 2025 04:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Issue/PR about behavior that is broken. Not for typos/examples/CI/test but for Optuna itself.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

optuna.study.copy_study() fails if a value isn't contained in the distribution

3 participants