Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Experiments: Reproduce experiments #1057

Merged
merged 6 commits into from
Feb 11, 2025
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
92 changes: 92 additions & 0 deletions content/guides/models/track/reproduce_experiments.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
---
menu:
default:
identifier: reproduce_experiments
parent: track
title: Reproduce experiments
weight: 7
---

Use W&B to reproduce an experiment that a team member creates. Reproducing a machine learning experiment is a crucial part in verifying and validating the results of that experiment.
ngrayluna marked this conversation as resolved.
Show resolved Hide resolved

Before you reproduce an experiment, make note of the:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Before you reproduce an experiment, make note of the:
You need the name of the project and run you want to reproduce.


* Name of the project the run was logged to
* Name of the run you want to reproduce

{{% alert %}}
This section assumes you know the name of the project that contains the run you want to reproduce.
{{% /alert %}}
ngrayluna marked this conversation as resolved.
Show resolved Hide resolved

Once you have the name of the project and run you want to reproduce, you can reproduce an experiment that a team member created by:
ngrayluna marked this conversation as resolved.
Show resolved Hide resolved

1. Navigate to the project where the run is logged to.
2. Select the **Workspace** tab in the left sidebar.
3. From the list of runs, select the run that you want to reproduce.
4. Click **Overview**.

Depending on how your team member configured their project, you can reproduce an experiment by either checking out their GitHub repository or downloading their code.
ngrayluna marked this conversation as resolved.
Show resolved Hide resolved

{{< tabpane text=true >}}
{{% tab "Download Python script or notebook" %}}

Download a Python script or notebook that your teammate used to create the experiment:
ngrayluna marked this conversation as resolved.
Show resolved Hide resolved

1. Note of the Python script or notebook in the **Command** field. This is the script that your teammate used to create the experiment.
2. Select the **Code** tab in the left navigation bar.
3. Download the Python script or notebook specified in the **Command** field. Click on the **Download** button next to the name of the file.
ngrayluna marked this conversation as resolved.
Show resolved Hide resolved


{{% /tab %}}
{{% tab "GitHub" %}}

{{% alert %}}
Before you continue, ensure you have access to the GitHub repository that your teammate used to create the experiment.
{{% /alert %}}

Clone the GitHub repository your teammate used when creating the experiment. To do this,

ngrayluna marked this conversation as resolved.
Show resolved Hide resolved
1. Copy and paste the GitHub repository URL specified in the **Git repository** field.
ngrayluna marked this conversation as resolved.
Show resolved Hide resolved
```bash
git clone https://github.com/your-repo.git && cd your-repo
```
ngrayluna marked this conversation as resolved.
Show resolved Hide resolved
2. Copy and paste **Git state** into your terminal. The Git state is a set of Git commands that will check out the exact commit that your teammate used to create the experiment. Replace values specified in the proceeding code snippet with your own:
ngrayluna marked this conversation as resolved.
Show resolved Hide resolved
```bash
git checkout -b "<run-name>" 0123456789012345678901234567890123456789
```



{{% /tab %}}
{{< /tabpane >}}

5. Select **Files** in the left navigation bar.
6. Download the `requirements.txt` file and store it in your working directory. This directory should contain either the cloned GitHub repository or the downloaded Python script or notebook.
7. (Recommended) Create a Python virtual environment.
8. Install the requirements specified in the `requirements.txt` file.
```bash
pip install -r requirements.txt
```

Now that you have the code and dependencies, you can run the script or notebook to reproduce the experiment. If you cloned a repository, you might need to navigate to the directory where the script or notebook is located. Otherwise, you can run the script or notebook from your working directory.
ngrayluna marked this conversation as resolved.
Show resolved Hide resolved

{{< tabpane text=true >}}
{{% tab "Python notebook" %}}

If you downloaded a Python notebook, navigate to the directory where you downloaded the notebook and run the following command in your terminal:
```bash
jupyter notebook
```

{{% /tab %}}
{{% tab "Python script" %}}

If you downloaded a Python script, navigate to the directory where you downloaded the script and run the following command in your terminal; Replace values enclosed in `<>` with your own:

```bash
python <your-script-name>.py
```


{{% /tab %}}
{{< /tabpane >}}