An open API service indexing awesome lists of open source software.

https://github.com/comet-ml/neptune-to-comet-exporter


https://github.com/comet-ml/neptune-to-comet-exporter

Last synced: 10 days ago
JSON representation

Awesome Lists containing this project

README

          

# Neptune to Comet Exporter

A tool for migrating experiment data from Neptune.ai to Comet ML.

## Overview

This exporter transfers all non-deleted runs from a Neptune project to a Comet project, including:
- Hyperparameters
- Training and validation metrics
- Final metrics
- Metadata
- Owner information

## Installation

Install the required dependencies:

```bash
pip install comet_ml neptune
```

Or use a virtual environment:

```bash
python3 -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
pip install comet_ml neptune
```

## Usage

### Basic Usage

```bash
python3 neptune_exporter.py \
--neptune-project-name "workspace/project-name" \
--neptune-api-token "your-neptune-api-token" \
--comet-workspace "your-workspace" \
--comet-project-name "your-project-name"
```

Make sure to set your Comet API key as an environment variable:

```bash
export COMET_API_KEY="your-comet-api-key"
```

### Using Environment Variables

You can also use environment variables instead of command-line arguments:

```bash
export NEPTUNE_PROJECT="workspace/project-name"
export NEPTUNE_API_TOKEN="your-neptune-api-token"
export COMET_WORKSPACE="your-workspace"
export COMET_PROJECT_NAME="your-project-name"
export COMET_API_KEY="your-comet-api-key"

python3 neptune_exporter.py \
--neptune-project-name "$NEPTUNE_PROJECT" \
--comet-workspace "$COMET_WORKSPACE" \
--comet-project-name "$COMET_PROJECT_NAME"
```

## Getting Your Credentials

### Neptune

- **Project name**: Format is `workspace/project-name`
- **API token**: Get it from [Neptune Settings](https://app.neptune.ai/get_my_api_token)

### Comet

- **Workspace**: Your Comet workspace name
- **Project name**: The Comet project name (will be created if it doesn't exist)
- **API key**: Get it from [Comet Settings](https://www.comet.com/settings/profile)

## What Gets Exported

The exporter transfers the following data from Neptune to Comet:

- **Hyperparameters**: All parameters from `parameters` or `hyperparameters` namespace
- **Metrics**: Training and validation metrics including:
- `train/loss`, `train/accuracy`
- `val/loss`, `val/accuracy`
- `training/train/epoch/accuracy`, `training/train/epoch/loss`
- `training/train/batch/accuracy`, `training/train/batch/loss`
- `training/test/epoch/accuracy`, `training/test/epoch/loss`
- `training/test/batch/accuracy`, `training/test/batch/loss`
- **Final metrics**: Metrics from the `final` namespace
- **Metadata**: Additional metadata from the `metadata` namespace
- **Owner information**: User information from `sys/owner`

## Verify the Migration

After running the exporter, check the output for experiment URLs. Each exported run will display a Comet experiment URL:

```
created comet experiment: https://www.comet.com/your-workspace/your-project-name/experiment-id
```

Visit these URLs to verify that all data was transferred correctly.

## Troubleshooting

### Missing dependencies

If you get `ModuleNotFoundError`, make sure you've installed the required packages:

```bash
pip install comet_ml neptune
```

### Invalid API token

If you get a `NeptuneInvalidApiTokenException`, verify your Neptune API token is correct. You can get it from [Neptune Settings](https://app.neptune.ai/get_my_api_token).

### Project not found

Make sure the Neptune project name is in the format `workspace/project-name` and that you have access to it.

### No data transferred

If experiments are created but no data appears, check:
- The Neptune runs contain data in the expected paths (`parameters`, `train/loss`, etc.)
- Your Comet API key has write permissions to the workspace
- The script completed without errors

## License

Apache 2.0 License