Skip to content

Commit bd5bb83

Browse files
fixed W&B migration script by fetching projects only from the requested W&B entity, and defaulting Neptune projects to have priv visibility (#360)
1 parent ba3bf08 commit bd5bb83

File tree

2 files changed

+32
-27
lines changed

2 files changed

+32
-27
lines changed

utils/migration_tools/from_wandb/README.md

Lines changed: 28 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
This script allows you to copy run metadata from Weights and Biases to Neptune `2.x`.
44

55
## Prerequisites
6+
67
- A Weights and Biases account, `wandb` library installed, and environment variables set.
78
- A neptune.ai account, `neptune` python library installed, and environment variables set. Read the [docs](https://docs-legacy.neptune.ai/setup/installation/) to learn how to set up your installation.
89

@@ -16,30 +17,30 @@ To use the script, follow these steps:
1617
1. Enter the number of workers to use to copy the metadata. Leave blank to let `ThreadPoolExecutor` decide.
1718
1. Enter the W&B projects you want to export as comma-separated values. Leave blank to export all projects.
1819
1. The script will generate run logs in the working directory. You can change the directory with `logging.basicConfig()`. Live progress bars will also be rendered in the console.
19-
1. Neptune projects corresponding to the W&B projects will be created with [*workspace*](https://docs-legacy.neptune.ai/about/workspaces_and_projects/#privacy-and-access-control) visibility if they don't exist. You can change the visibility later [from the WebApp](https://docs-legacy.neptune.ai/management/changing_project_privacy/) once the project has been created, or by updating L339 in the script.
20-
1. The project description will be set as *Exported from <W&B project URL>*. You can change the description later [from the WebApp](https://docs-legacy.neptune.ai/setup/creating_project/#creating-a-project) once the project has been created, or by updating L338 in the script.
20+
1. Neptune projects corresponding to the W&B projects will be created with [_private_](https://docs-legacy.neptune.ai/about/workspaces_and_projects/#privacy-and-access-control) visibility if they don't exist. You can change the visibility later [from the WebApp](https://docs-legacy.neptune.ai/management/changing_project_privacy/) once the project has been created, or by updating L319 in the script.
21+
1. The project description will be set as _Exported from <W&B project URL>_. You can change the description later [from the WebApp](https://docs-legacy.neptune.ai/setup/creating_project/#creating-a-project) once the project has been created, or by updating L338 in the script.
2122

2223
## Metadata mapping from W&B to Neptune
2324

24-
| Metadata | W&B | Neptune |
25-
| :-: | :-: | :-: |
26-
| Project name | example_project | example-project<sup>1</sup> |
27-
| Project URL | project.url | project.wandb_url |
28-
| Run name | run.name | run.sys.name |
29-
| Run ID | run.id | run.sys.custom_run_id<sup>2</sup> |
30-
| Notes | run.notes | run.sys.description |
31-
| Tags | run.tags | run.sys.tags |
32-
| Group | run.group | run.sys.group_tags |
33-
| Config | run.config | run.config<sup>3</sup> |
34-
| Run summary | run.summary | run.summary<sup>3</sup> |
35-
| Run metrics | run.scan_history() | run.<METRIC_NAME><sup>4</sup> |
36-
| System metrics | run.history(stream="system") | run.monitoring.<METRIC_NAME><sup>5</sup> |
37-
| System logs | output.log | run.monitoring.stdout |
38-
| Source code | code/* | run.source_code.files |
39-
| requirements.txt | requirements.txt | run.source_code.requirements |
40-
| Model checkpoints | \*.ckpt/\*checkpoint\* | run.checkpoints |
41-
| Other files | run.files() | run.files |
42-
| All W&B attributes | run.* | run.wandb.* |
25+
| Metadata | W&B | Neptune |
26+
| :----------------: | :--------------------------: | :--------------------------------------: |
27+
| Project name | example_project | example-project<sup>1</sup> |
28+
| Project URL | project.url | project.wandb_url |
29+
| Run name | run.name | run.sys.name |
30+
| Run ID | run.id | run.sys.custom_run_id<sup>2</sup> |
31+
| Notes | run.notes | run.sys.description |
32+
| Tags | run.tags | run.sys.tags |
33+
| Group | run.group | run.sys.group_tags |
34+
| Config | run.config | run.config<sup>3</sup> |
35+
| Run summary | run.summary | run.summary<sup>3</sup> |
36+
| Run metrics | run.scan_history() | run.<METRIC_NAME><sup>4</sup> |
37+
| System metrics | run.history(stream="system") | run.monitoring.<METRIC_NAME><sup>5</sup> |
38+
| System logs | output.log | run.monitoring.stdout |
39+
| Source code | code/\* | run.source_code.files |
40+
| requirements.txt | requirements.txt | run.source_code.requirements |
41+
| Model checkpoints | \*.ckpt/\*checkpoint\* | run.checkpoints |
42+
| Other files | run.files() | run.files |
43+
| All W&B attributes | run.\* | run.wandb.\* |
4344

4445
<sup>1</sup> Underscores `_` in a W&B project name are replaced by a hyphen `-` in Neptune
4546
<sup>2</sup> Passing the wandb.run.id as neptune.run.custom_run_id ensures that duplicate Neptune runs are not created for the same W&B run even if the script is run multiple times
@@ -48,6 +49,7 @@ To use the script, follow these steps:
4849
<sup>5</sup> `system.` prefix is removed when logging to Neptune
4950

5051
## What is not exported
52+
5153
- Models
5254
- W&B specific objects and data types
5355
- `run.summary` keys starting with `_`
@@ -57,11 +59,12 @@ To use the script, follow these steps:
5759
† These have been excluded at the code level to prevent redundancy and noise, but can be included.
5860

5961
## Post-migration
60-
* W&B Workspace views can be recreated using Neptune's [overlaid charts](https://docs-legacy.neptune.ai/app/charts/) and [reports](https://docs-legacy.neptune.ai/app/reports/)
61-
* W&B Runs table views can be recreated using Neptune's [custom views](https://docs-legacy.neptune.ai/app/experiments/#custom-views)
62+
63+
- W&B Workspace views can be recreated using Neptune's [overlaid charts](https://docs-legacy.neptune.ai/app/charts/) and [reports](https://docs-legacy.neptune.ai/app/reports/)
64+
- W&B Runs table views can be recreated using Neptune's [custom views](https://docs-legacy.neptune.ai/app/experiments/#custom-views)
6265
![Example W&B Runs table view recreated in Neptune](https://neptune.ai/wp-content/uploads/2024/07/wandb_table.png)
63-
* W&B Run Overview can be recreated using Neptune's [custom dashboards](https://docs-legacy.neptune.ai/app/custom_dashboard/)
64-
![Example W&B Run Overview recreated in Neptune](https://neptune.ai/wp-content/uploads/2024/07/overview.png)
66+
- W&B Run Overview can be recreated using Neptune's [custom dashboards](https://docs-legacy.neptune.ai/app/custom_dashboard/)
67+
![Example W&B Run Overview recreated in Neptune](https://neptune.ai/wp-content/uploads/2024/07/overview.png)
6568

6669
## Performance benchmarks
6770

utils/migration_tools/from_wandb/wandb_to_neptune.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,9 @@ def exc_handler(exctype, value, tb):
102102
logger.info(f"Temporary directory created at {tmpdirname}")
103103

104104
# %%
105-
wandb_projects = [project for project in client.projects()] # sourcery skip: identity-comprehension
105+
wandb_projects = [
106+
project for project in client.projects(entity=wandb_entity)
107+
] # sourcery skip: identity-comprehension
106108
wandb_project_names = [project.name for project in wandb_projects]
107109

108110
print(f"W&B projects found ({len(wandb_project_names)}): {wandb_project_names}")
@@ -316,7 +318,7 @@ def copy_project(wandb_project: client.project) -> None:
316318
management.create_project(
317319
name=f"{neptune_workspace}/{wandb_project_name}",
318320
description=f"Exported from {wandb_project.url}",
319-
visibility="workspace",
321+
visibility="priv",
320322
)
321323

322324
with neptune.init_project(

0 commit comments

Comments
 (0)