We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 6d53929 commit 18bb7d4Copy full SHA for 18bb7d4
flaml/tune/tune.py
@@ -197,9 +197,16 @@ def compute_with_config(config):
197
global _training_iteration
198
if _use_ray:
199
try:
200
- from ray import tune
+ from ray import __version__ as ray_version
201
+
202
+ if ray_version.startswith("1."):
203
+ from ray import tune
204
205
+ return tune.report(_metric, **kwargs)
206
+ else: # ray>=2
207
+ from ray.air import session
208
- return tune.report(_metric, **kwargs)
209
+ return session.report(metrics={"metric": _metric, **kwargs})
210
except ImportError:
211
# calling tune.report() outside tune.run()
212
return
0 commit comments