[tune] validate function callable in tune.with_parameters() (#11504)

This commit is contained in:
Kai Fricke
2020-10-21 00:03:24 +01:00
committed by GitHub
parent 2c5cb95b42
commit 6d11fb8bc6
+6
View File
@@ -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)