mirror of
https://github.com/wassname/ray.git
synced 2026-06-30 16:49:48 +08:00
[tune] validate function callable in tune.with_parameters() (#11504)
This commit is contained in:
@@ -616,6 +616,12 @@ def with_parameters(fn, **kwargs):
|
||||
)
|
||||
|
||||
"""
|
||||
if not callable(fn):
|
||||
raise ValueError(
|
||||
"`tune.with_parameters()` only works with the function API. "
|
||||
"If you want to pass parameters to Trainable _classes_, consider "
|
||||
"passing them via the `config` parameter.")
|
||||
|
||||
prefix = f"{str(fn)}_"
|
||||
for k, v in kwargs.items():
|
||||
parameter_registry.put(prefix + k, v)
|
||||
|
||||
Reference in New Issue
Block a user