Skip to main content
In this guide you will learn how to fetch the Zoo dataset, process it into tensors, train a simple neural network classifier, and publish the resulting model to the W&B Registry. In this guide you will learn how to download and use artifacts linked to the Registry. To do this, you will download both a pretrained classification model and the corresponding dataset tensors. You will then use these artifacts to perform inference and evaluate the model’s performance.

Prerequisites

Before you begin, ensure that you have a W&B API key. Run the attached Python training script if you want to run the notebook example described on this page yourself. The script covers the first part of the workflow, including fetching the dataset, processing it into tensors, defining a neural network model, training the neural network model, before publishing the resulting model to the W&B Registry.

Sign up and create an API key

To authenticate your machine with W&B, you need an API key. To create an API key, select the Personal API key or Service Account API key tab for details.
To create a personal API key owned by your user ID:
  1. Log in to W&B, then click your user profile icon > User Settings.
  2. Click Create new API key.
  3. Provide a descriptive name for your API key.
  4. Click Create.
  5. Copy the displayed API key immediately and store it securely.
W&B shows the full API key only once, when you create it. After you close the dialog, you cannot view the full API key again. Your settings display only the key ID (the first part of the key). If you lose the full API key, you must create a new one.
For secure storage options, see Store API keys securely.

Run training script (Optional)

Copy the following code into a file named train.py and save it locally on your machine:
train.py
Next, run the training script using uv:

Create your first notebook

  1. Navigate to your project’s workspace.
  2. Select Notebooks from the project sidebar.
  3. Click Create notebook.
See the Create and manage notebooks for more information.

Install dependencies

Within your notebook install the required dependencies:
  1. Select Manage packages () from the notebook sidebar.
  2. Enter torch, ucimlrepo, and scikit-learn.
  3. Select Add.
For more information, see the Manage packages and environments guide or refer to the marimo documentation.

Run the notebook example