Quickstart#
Installing through Anaconda Navigator
To find neptune, you may need to update your channels and index.
- In the Navigator, select Environments.
- In the package view, click Channels.
- Click Add..., enter
conda-forge
, and click Update channels. - In the package view, click Update index... and wait until the update is complete. This can take several minutes.
- You should now be able to search for neptune.
Note: The displayed version may be outdated. The latest version of the package will be installed.
Note: On Bioconda, there is a "neptune" package available which is not the neptune.ai client library. Make sure to specify the "conda-forge" channel when installing neptune.ai.
Create a run#
- Create a script called
hello_neptune.py
. - Copy and paste the below code to the script file.
import neptune
# Create a Neptune run object
run = neptune.init_run(
project="your-workspace-name/your-project-name", # (1)!
api_token="YourNeptuneApiToken", # (2)!
)
# Track metadata and hyperparameters by assigning them to the run
run["JIRA"] = "NPT-952"
run["algorithm"] = "ConvNet"
PARAMS = {
"batch_size": 64,
"dropout": 0.2,
"learning_rate": 0.001,
"optimizer": "Adam",
}
run["parameters"] = PARAMS
# Track the training process by logging your training metrics
for epoch in range(10):
run["train/accuracy"].append(epoch * 0.6) # (3)!
run["train/loss"].append(epoch * 0.4)
# Record the final results
run["f1_score"] = 0.66
# Stop the connection and synchronize the data with the Neptune servers
run.stop()
- The full project name. For example,
"ml-team/classification"
. To copy it, navigate to the project settings → Properties. - In the Neptune app, click your avatar and select Get your API token. When you're done testing, save your API token as an environment variable instead of putting it here in the code!
- Mocked code, so we can see the graph visualized in a Neptune chart.
How do I find my API token?
In the top-right corner of the Neptune app, click your avatar and select Get your API token.
You can copy your token from the dialog that opens. It's very long – make sure to copy and paste it in full!
import neptune
# Create a Neptune run object
run = neptune.init_run(
project="common/quickstarts", # (1)!
api_token=neptune.ANONYMOUS_API_TOKEN, # (2)!
)
# Track metadata and hyperparameters by assigning them to the run
run["JIRA"] = "NPT-952"
run["algorithm"] = "ConvNet"
PARAMS = {
"batch_size": 64,
"dropout": 0.2,
"learning_rate": 0.001,
"optimizer": "Adam",
}
run["parameters"] = PARAMS
# Track the training process by logging your training metrics
for epoch in range(10):
run["train/accuracy"].append(epoch * 0.6) # (3)!
run["train/loss"].append(epoch * 0.4)
# Record the final results
run["f1_score"] = 0.66
# Stop the connection and synchronize the data with the Neptune servers
run.stop()
- Projects in the
common
workspace are public and can be used for testing. To log to your own workspace, pass the full name of your Neptune project:workspace-name/project-name
. For example,"ml-team/classification"
. To copy it, navigate to the project settings → Properties. - The
api_token
argument is included to enable anonymous logging. Once you register, you should leave the token out of your script and instead save it as an environment variable. - Mocked code, so we can see the graph visualized in a Neptune chart.
Now that you have your Hello Neptune script ready, execute it from your terminal, Jupyter Lab, or other environments:
Click the link in the console output to open the run in Neptune.
Explore the results in Neptune#
In the left pane, you can see your data in the following sections:
- All metadata - displays logged metadata in a folder-like structure.
- Charts - visualizes the metrics as charts.
- Monitoring - shows hardware consumption during the run execution.
- Source code - records the code that was used for the run.
See in Neptune  See code on GitHub 
Congrats! You've learned how to connect Neptune to your code and explore the tracked run in the app.
Next steps#
- Rerun the script with different parameters to track a few more runs, then click Compare runs in the very left pane to compare and visualize them.
- When you move on from Hello Neptune, take a moment to save your API token as an environment variable. This helps keep your API token secure, as you can omit the
api_token
parameter from your code.- Set the
project
argument to your own project name, or export that as an environment variable too.
- Set the
- To get the most out of Neptune, take the Neptune tutorial. It walks you through all of the above plus the central Neptune features.
Other resources to check out
- Using Neptune ≫ What you can log and display
- Using Neptune ≫ Adding Neptune to your code
- Tutorials ≫ Tracking and organizing model-training runs
- Integrations