Closed
Description
What is the problem?
I am trying to save something at the end of the training. To achieve this, I'm trying to get the save directory for the trial. The code from the documentation ("Trainable Logging" --> "Functional API") is as follows:
def trainable(config):
library.init(
name=trial_id,
id=trial_id,
resume=trial_id,
reinit=True,
allow_val_change=True)
library.set_log_path(tune.track.logdir)
for step in range(100):
library.log_model(...)
library.log(results, step=step)
tune.track.log(results)
To me, it is not clear where the name library
comes from. So I was assuming this had nothing to do with my problem, and thought the relevant part was the tune.track.logdir
variable. However, that variable does not exist.
When I run the example code, I get the following error message:
AttributeError: module 'ray.tune' has no attribute 'track'
I'm new to ray and tune, so perhaps there is another way to get the log directory for the trial. I found the documentation a bit sparse about this issue if the functional API is used.
Reproduction (REQUIRED)
Ray version: 0.8.6 (from PyPI)
import ray
from ray import tune
def training_function(config):
# see:
# https://docs.ray.io/en/latest/tune/api_docs/logging.html
# (section "Trainable Logging")
tune.report(logdir=tune.track.logdir)
ray.init()
analysis = tune.run(training_function,
config={
'dummy': [1],
},
local_dir='test_local_dir',
num_samples=1,
resources_per_trial={'cpu': 1},
queue_trials=False)