File Storage Observer, know where files are dumped during run
See original GitHub issueSo I have read the Observing an experiment documentation up and down and the following isn’t clear to me:
If I want to run an experiment and keep track of just some basic information (e.g. the config and the acc) using the File Observer, how can I know where (what subdir) it is writing to?
I set the directory where I want all the experiments to be written to, but once I call an experiment, I do not know what the subdir will be (seems to be just enumerated…)
ex.observers.append(FileStorageObserver.create(experiment_dir))
Why would I want to know this?
Well returning the weights would results in them being dumped into results of the run file. This is not efficient and a poor idea.
The documentation for custom information suggests large data separately, and using add_artifact
to save it to the DB.
I do not need two copies of the file.
So it would be nice if I could, via _run
, access "observer_dump_loc"
so I can write my files there:
os.path.join(_run["observer_dump_loc"], "all_this_data.npz")
# writes to /experiment_dir/<observer_dump_loc>/all_this_data.npz
Issue Analytics
- State:
- Created 5 years ago
- Reactions:6
- Comments:7
Totally see your point here. A temporary directory per run sounds like a workable solution. I take it as a feature request! Maybe mkdtemp already does it. Meanwhile you can prefix all artifact files with
_run._id
and delete them right after you added them. This should keep the naming management to a minimum.Hi. What prevents us from allowing
ndarray
’s and streams asadd_artifact
arguments? That would’ve sure solved the naming issue as we wouldn’t have any names and also having to dump weights/etc into a file first isn’t very convenient protocol. If some underlying package only accepts filenames (mongo? I’m only making a guess) then perhaps sacred could bridge the gap and transparently to user make a temp. Also, sometimes a user of sacred may indeed need a temporary when some other package he uses only provides filename interface – so even withadd_artifact
supporting buffers it would be still handy to have a convenience function that makes a named temporary associated with the current run and returns the name.