Neptune keeps track of your
.git commit to make sure you know on which code you ran your experiment. But sometimes you don’t want to commit everything and in those dirty, in between commit, situations you may want Neptune to snapshot your code and save it with experiment.
In that case you need to pass a list of files you want to snaphsot to the
upload_source_files argument of
neptune.create_experiment method. We wrote a helper that lets you create this list getting all the names of files of certain extensions in your folder and subfolders.
import neptune from neptunecontrib.api.utils import get_filepaths neptune.init('USER_NAME/PROJECT_NAME') with neptune.create_experiment(upload_source_files=get_filepaths(directory='.',extensions=['.py', '.yaml', '.yml'])): neptune.set_property('code_snapshot','yes!')
Now you can view your code snapshot in Neptune.
Check this example experiment: