transformers
e1a37d29 - Replace assert with raise ImportError for optuna/ray dependency checks (#46263)

Commit
55 days ago
Replace assert with raise ImportError for optuna/ray dependency checks (#46263) The assert statements in default_hp_space_optuna() and default_hp_space_ray() are silently stripped when Python runs with the -O (optimize) flag. This allows the functions to proceed without the required library installed, leading to confusing NameErrors downstream instead of a clear ImportError. The wandb equivalent (default_hp_space_wandb) already uses the correct if/raise ImportError pattern. This change makes the optuna and ray functions consistent.
Author
Parents
Loading