diff --git a/python/ray/tune/function_runner.py b/python/ray/tune/function_runner.py index 5b0c59abf..9fa19e6d2 100644 --- a/python/ray/tune/function_runner.py +++ b/python/ray/tune/function_runner.py @@ -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)