IDSIA / sacred

Sacred is a tool to help you configure, organize, log and reproduce experiments developed at IDSIA.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Experiment.add_artifact with bytes, documentation vs code

mrzv opened this issue · comments

The documentation for Experiment.add_artifact suggests that it's possible to pass bytes, but it doesn't work, and I don't see it in the code. It would be tremendously useful to be able to save arbitrary bytes as an artifact. Is there a way to access this functionality?

Hi @mrzv!

The documentation is actually correct, that's (almost) the type annotation of os.PathLike (https://docs.python.org/3/library/os.html#os.PathLike). So, you can path a file path as bytes (as stated in the docs), but no raw binary data. It's meant to log artifact files that you already created. Raw data wouldn't work with all observers (currently).

What is your use-case that you can't dump the file to disk before logging?

Oh, I see. I must misunderstand the meaning of bytes in this case. My use case doesn't prevent me from dumping the file to disk, it's just an extra, inconvenient step, when the data's only purpose is to land in sacred's database.