> ## Documentation Index
> Fetch the complete documentation index at: https://docs.coreweave.com/llms.txt
> Use this file to discover all available pages before exploring further.

> Install Weights & Biases and start tracking, visualizing, and managing machine learning experiments in minutes.

# Weights & Biases Quickstart

export const GitHubLink = ({url, compact = false}) => <a href={url} target="_blank" rel="noopener noreferrer" className={compact ? "source-link" : "github-source-link"}>
    {compact ? "View source" : <>
    <svg width="20" height="20" viewBox="0 0 24 24" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
      <path d="M12 0C5.37 0 0 5.37 0 12c0 5.31 3.435 9.795 8.205 11.385.6.105.825-.255.825-.57 0-.285-.015-1.23-.015-2.235-3.015.555-3.795-.735-4.035-1.41-.135-.345-.72-1.41-1.23-1.695-.42-.225-1.02-.78-.015-.795.945-.015 1.62.87 1.845 1.23 1.08 1.815 2.805 1.305 3.495.99.105-.78.42-1.305.765-1.605-2.67-.3-5.46-1.335-5.46-5.925 0-1.305.465-2.385 1.23-3.225-.12-.3-.54-1.53.12-3.18 0 0 1.005-.315 3.3 1.23.96-.27 1.98-.405 3-.405s2.04.135 3 .405c2.295-1.56 3.3-1.23 3.3-1.23.66 1.65.24 2.88.12 3.18.765.84 1.23 1.905 1.23 3.225 0 4.605-2.805 5.625-5.475 5.925.435.375.81 1.095.81 2.22 0 1.605-.015 2.895-.015 3.3 0 .315.225.69.825.57A12.02 12.02 0 0024 12c0-6.63-5.37-12-12-12z" />
    </svg>
    GitHub source
      </>}
  </a>;

export const ColabLink = ({url}) => <a href={url} target="_blank" rel="noopener noreferrer" className="colab-link">
    <svg width="20" height="20" viewBox="0 0 24 24" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
      <path d="M14.25.18l.9.2.73.26.59.3.45.32.34.34.25.34.16.33.1.3.04.26.02.2-.01.13V8.5l-.05.63-.13.55-.21.46-.26.38-.3.31-.33.25-.35.19-.35.14-.33.1-.3.07-.26.04-.21.02H8.77l-.69.05-.59.14-.5.22-.41.27-.33.32-.27.35-.2.36-.15.37-.1.35-.07.32-.04.27-.02.21v3.06H3.17l-.21-.03-.28-.07-.32-.12-.35-.18-.36-.26-.36-.36-.35-.46-.32-.59-.28-.73-.21-.88-.14-1.05-.05-1.23.06-1.22.16-1.04.24-.87.32-.71.36-.57.4-.44.42-.33.42-.24.4-.16.36-.1.32-.05.24-.01h.16l.06.01h8.16v-.83H6.18l-.01-2.75-.02-.37.05-.34.11-.31.17-.28.25-.26.31-.23.38-.2.44-.18.51-.15.58-.12.64-.1.71-.06.77-.04.84-.02 1.27.05zm-6.3 1.98l-.23.33-.08.41.08.41.23.34.33.22.41.09.41-.09.33-.22.23-.34.08-.41-.08-.41-.23-.33-.33-.22-.41-.09-.41.09zm13.09 3.95l.28.06.32.12.35.18.36.27.36.35.35.47.32.59.28.73.21.88.14 1.04.05 1.23-.06 1.23-.16 1.04-.24.86-.32.71-.36.57-.4.45-.42.33-.42.24-.4.16-.36.09-.32.05-.24.02-.16-.01h-8.22v.82h5.84l.01 2.76.02.36-.05.34-.11.31-.17.29-.25.25-.31.24-.38.2-.44.17-.51.15-.58.13-.64.09-.71.07-.77.04-.84.01-1.27-.04-1.07-.14-.9-.2-.73-.25-.59-.3-.45-.33-.34-.34-.25-.34-.16-.33-.1-.3-.04-.25-.02-.2.01-.13v-5.34l.05-.64.13-.54.21-.46.26-.38.3-.32.33-.24.35-.2.35-.14.33-.1.3-.06.26-.04.21-.02.13-.01h5.84l.69-.05.59-.14.5-.21.41-.28.33-.32.27-.35.2-.36.15-.36.1-.35.07-.32.04-.28.02-.21V6.07h2.09l.14.01.21.03zm-6.47 14.25l-.23.33-.08.41.08.41.23.33.33.23.41.08.41-.08.33-.23.23-.33.08-.41-.08-.41-.23-.33-.33-.23-.41-.08-.41.08z" />
    </svg>
    Try in Colab
  </a>;

<div style={{ display: 'flex', gap: '12px', flexWrap: 'wrap' }}>
  <ColabLink url="https://colab.research.google.com/github/wandb/examples/blob/master/colabs/intro/run_quickstart.ipynb" />

  <GitHubLink url="https://github.com/wandb/examples/blob/master/colabs/intro/run_quickstart.ipynb" />
</div>

Install Weights & Biases to track, visualize, and manage machine learning experiments of any size.

<Note>
  Are you looking for information on W\&B Weave? See the [Weave Python SDK quickstart](/products/wandb/weave/quickstart) or [Weave TypeScript SDK quickstart](/products/wandb/weave/reference/generated_typescript_docs/intro-notebook).
</Note>

## Create an account

The first time you sign in, a short setup flow creates your account and connects you to an organization. Which steps you see depends on how you arrive.

<Steps>
  <Step title="Choose a sign-in method">
    Select **Continue with Google**, **Continue with GitHub**, **Continue with Apple**, or **Continue with Microsoft**, or sign up with an email address and password.

    If you already have Weights & Biases credentials, they work here. Select **Log in** instead of **Sign up**.
  </Step>

  <Step title="Verify your email">
    Check the inbox of the email address on your account for a verification link. If it doesn't arrive, check your spam folder or select **Resend email**.
  </Step>

  <Step title="Sign up for an account">
    Enter your full name, your organization or institution, and a username. Your username becomes your profile URL, so it must be unique. A username can use only letters, numbers, underscores, and hyphens.

    For **How will you use Forge?**, select **Professional** for personal or business projects, or **Academic** for research or education.

    To continue, accept the Terms of Service and Privacy Policy.
  </Step>

  <Step title="Join your team">
    If your email domain matches an organization whose teams are open to you, you can join one of those teams.

    If you arrived through a team invitation or already belong to a team, you don't see this step.
  </Step>

  <Step title="Create your organization">
    Name your organization. The name becomes part of its URL, as in `forge.coreweave.com/my-organization`.

    If you joined a team in the previous step, arrived through a team invitation, or already belong to a team, you don't see this step.
  </Step>

  <Step title="Choose what you're working on">
    Select one of **Train and fine-tune models**, **Build and evaluate agents**, **Run inference at scale**, or **I'm exploring**. Your choice determines which page you see next, but it doesn't restrict which products you can use.
  </Step>
</Steps>

When you finish the setup flow, your account is ready to use.

## Create an API key

To authenticate your machine, create an API key.

To create an API key, select the **Personal API key** or **Service Account API key** tab for details.

<Tabs>
  <Tab title="Personal API key">
    To create a personal API key owned by your user ID:

    1. Log in to Forge, then click your user profile icon and select **User settings**.
    2. Within **API keys**, select **New key**.
    3. Provide a descriptive name for your API key.
    4. Click **Create API key**.
    5. Copy the displayed API key immediately and store it securely.
  </Tab>

  <Tab title="Service account API key">
    To create an API key owned by a service account:

    1. In your team or organization settings, go to the **Service Accounts** tab.
    2. Find the service account in the list.
    3. Click the **action (<Icon icon="ellipsis" iconType="solid" />)** menu, then click **Create API key**.
    4. Provide a name for the API key, then click **Create**.
    5. Copy the displayed API key immediately and store it securely.
    6. Click **Done**.

    You can create multiple API keys for a single service account to support different environments or workflows.
  </Tab>
</Tabs>

<Warning>
  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.
</Warning>

For secure storage options, see [Store API keys securely](/products/wandb/platform/app/settings-page/user-settings#store-and-handle-api-keys-securely).

## Install the `wandb` library and log in

<Tabs>
  <Tab title="Command line">
    1. Set the `WANDB_API_KEY` [environment variable](/products/wandb/track/environment-variables). Replace `YOUR_API_KEY` with the API key you created.

       ```bash theme={"system"}
       export WANDB_API_KEY=YOUR_API_KEY
       ```

    2. Install the `wandb` library and log in:

       ```shell theme={"system"}
       pip install wandb
       wandb login
       ```
  </Tab>

  <Tab title="Python">
    1. Install the W\&B Python SDK with `pip`:

       ```bash theme={"system"}
       pip install wandb
       ```

    2. Import the W\&B Python SDK and log in to Weights & Biases from your Python script with `wandb.login()`:

       ```python theme={"system"}
       import wandb

       wandb.login()
       ```
  </Tab>

  <Tab title="Python notebook">
    1. Use shell escape (`!`) to install the W\&B Python SDK:

       ```notebook theme={"system"}
       !pip install wandb
       ```

    2. Import the W\&B Python SDK and log in to Weights & Biases from your notebook with `wandb.login()`:

       ```notebook theme={"system"}
       import wandb
       wandb.login()
       ```
  </Tab>
</Tabs>

## Initialize a run and track hyperparameters

In your Python script or notebook, initialize a W\&B run object with [`wandb.init()`](/products/wandb/ref/python/experiments/run). Use a dictionary for the `config` parameter
to specify hyperparameter names and values. Within the `with` statement, you can log metrics and other information to Weights & Biases.

```python theme={"system"}
import wandb

wandb.login()

# Project that the run is recorded to
project = "my-awesome-project"

# Dictionary with hyperparameters
config = {
    'epochs' : 10,
    'lr' : 0.01
}

with wandb.init(project=project, config=config) as run:
    # Training code here
    # Log values to W&B with run.log()
    run.log({"accuracy": 0.9, "loss": 0.1})
```

For a complete example that simulates a training run and logs accuracy and loss metrics to Weights & Biases, see [Create a machine learning training experiment](#create-a-machine-learning-training-experiment).

<Info>
  A [run](/products/wandb/runs) is a core element of Weights & Biases. You use runs to [track metrics](/products/wandb/track), [create logs](/products/wandb/track/log), and track artifacts.
</Info>

## Create a machine learning training experiment

This mock training script logs simulated accuracy and loss metrics to Weights & Biases. Copy and paste the following code into a Python script or notebook cell and run it:

```python theme={"system"}
import wandb
import random

wandb.login()

# Project that the run is recorded to
project = "my-awesome-project"

# Dictionary with hyperparameters
config = {
    'epochs' : 10,
    'lr' : 0.01
}

with wandb.init(project=project, config=config) as run:
    offset = random.random() / 5
    print(f"lr: {config['lr']}")

    # Simulate a training run
    for epoch in range(2, config['epochs']):
        acc = 1 - 2**-config['epochs'] - random.random() / config['epochs'] - offset
        loss = 2**-config['epochs'] + random.random() / config['epochs'] + offset
        print(f"epoch={config['epochs']}, accuracy={acc}, loss={loss}")
        run.log({"accuracy": acc, "loss": loss})
```

Visit [your Weights & Biases dashboard](https://forge.coreweave.com/wandb) to view recorded metrics such as accuracy and loss, and to see how they change during each training step. The following image shows the loss and accuracy tracked from each run. Each run object appears in the **Runs** column with a generated name.

<Frame>
  <img src="https://mintcdn.com/coreweave-dbfa0e8d/3Dv_sw2eg8feUJlx/products/wandb/_media/quickstart_image.png?fit=max&auto=format&n=3Dv_sw2eg8feUJlx&q=85&s=bd51b523b4bce2c7009d3877740b7a96" alt="A project workspace in Forge, with seven runs listed in the Runs column and their loss and accuracy charts" width="1152" height="653" data-path="products/wandb/_media/quickstart_image.png" />
</Frame>

## Next steps

Explore more Weights & Biases features:

* Learn about and create your first [run](/products/wandb/runs).
* Track models, datasets, and other files with [W\&B Artifacts](/products/wandb/artifacts).
* Automate hyperparameter searches and optimize models with [W\&B Sweeps](/products/wandb/sweeps).
* Share models, prompts, and datasets with [Registry](/products/registry).
* Analyze runs, visualize model predictions, and view artifacts in your project's [dashboard](/products/wandb/track/workspaces).
* Summarize findings and share updates with collaborators with [W\&B Reports](/products/wandb/reports).
* Trace and evaluate LLM applications with [W\&B Weave](/products/wandb/weave/quickstart).


## Related topics

- [Experiments overview](/products/wandb/track.md)
