API reference: Sacred integration#
The Neptune–Sacred integration provides a Sacred observer that logs experiment metadata to Neptune.
- For an in-depth tutorial, see Integrations ≫ Working with Sacred.
- neptune-sacred repo on GitHub
Logs Sacred experiment data to Neptune.
||-||An existing run reference, as returned by
||Namespace under which all metadata logged by the observer will be stored.|
Start a Neptune run:
If Neptune can't find your project name or API token
As a best practice, you should save your Neptune API token and project name as environment variables:
export NEPTUNE_API_TOKEN="h0dHBzOi8aHR0cHM6Lkc78ghs74kl0jvYh3Kb8" export NEPTUNE_PROJECT="ml-team/classification"
You can, however, also pass them as arguments when initializing Neptune:
run = neptune.init_run( api_token="h0dHBzOi8aHR0cHM6Lkc78ghs74kl0jvYh3Kb8", # your token here project="ml-team/classification", # your full project name here )
- Find and copy your API token by clicking your avatar and selecting Get my API token.
- Find and copy your project name in the project Settings → Properties.
If you haven't registered, you can also log anonymously to a public project (make sure not to publish sensitive data through your code!):
Create an experiment:
Add a Neptune observer:
from neptune.new.integrations.sacred import NeptuneObserver ex.observers.append(NeptuneObserver(run=neptune_run))
Define the model and run the experiment: