Upload or download files#
Uploading files#
You can generally pass any file path to the upload()
method. This will upload the contents of the file under the specified field in the run.
See example uploads in Neptune 
To see the upload()
commands that were used for this example, check the code snapshot in the Source code tab.
Artifact tip
You should only upload files that you specifically want to store or interact with in Neptune.
If you just want to track the metadata of your files (for example, for versioning purposes) logging them as artifacts is handier than uploading the files in full.
For details, see Track artifacts.
Logging chart or figure objects#
To log a file-like object, like a confusion matrix, simply assign the object to a field name of your choice.
import matplotlib.pyplot as plt
fig = plt.figure(figsize=(7, 9))
# Log figure to run
run["my-figure"].upload(fig)
Viewing files in the web app#
To preview files logged with the upload()
function, open the run in Neptune and navigate to All metadata.
A more convenient way to display logged files is to create a custom dashboard with one or more File preview widgets.
- CLick on a run to open it.
- Create a custom dashboard (or use an existing one).
- Select New widget.
-
In the input box at the stop, start typing the name of the file field you want to display.
Alternatively, you can add the File preview widget first, then view suggestions for files to display.
-
Save your dashboard.
Downloading or fetching files#
Use the download()
function to fetch uploaded files.
First, connect to the run in your code:
run["data/sample"].download(destination="path/to/destination")
Related
File series#
For FileSeries
fields created with append()
or extend()
, you can use download()
or download_last()
to fetch the files.
import neptune
run = neptune.init_run()
for iteration in range(100):
pil_image = ...
run["train/predictions"].append(pil_image)
run["train/predictions"].download(destination="downloaded_predictions")
File set#
If you don't need advanced display options for individual files, you can upload a set of files to a single field with the upload_files()
method.
run["preprocessing_scripts"].upload_files("./preprocessing/*.py") # (1)!
- When using pattern expansion, such as
**/*.py
, make sure that your expression does not capture files you don't intend to upload. For example, using*
as a pattern will upload all files and directories from the current working directory (cwd
).
You can still preview and download individual files from the set, but if you create a custom widget, you can only preview the FileSet field as a whole.
If you want to display and interact with images individually, log them to separate fields instead: run["my-file"].upload("path/to/single/file.png")
Related