Skip to main content

Interact with wandb from python

Project description

dr_wandb

A command-line utility for downloading and archiving Weights & Biases experiment data to local storage formats optimized for offline analysis. Stores to PostgreSQL db + Parquet files, supports incremental updates and selective data retrieval.

For shared context and onboarding steps, see the Agent Guide.

Installation

uv add dr_wandb

Prerequisites

  • Python 3.12 or higher
  • PostgreSQL database server
  • Weights & Biases account with API access
  • PyArrow for Parquet file operations

Authentication

Configure Weights & Biases authentication using one of these methods:

wandb login

Or set the API key as an environment variable:

export WANDB_API_KEY=your_api_key_here

Basic Usage

Download all runs from a Weights & Biases project:

wandb-download --entity your_entity --project your_project

Options:
  --entity TEXT        WandB entity (username or team name)
  --project TEXT       WandB project name
  --runs-only          Download only run metadata, skip training history
  --force-refresh      Download all data, ignoring existing records
  --db-url TEXT        PostgreSQL connection string
  --output-dir TEXT    Directory for exported Parquet files
  --help              Show help message and exit

The tool creates a PostgreSQL database, downloads experiment data, and exports Parquet files to the configured output directory. It tool tracks existing data and downloads only new or updated runs by default. A run is considered for update if:

  • It does not exist in the local database
  • Its state is "running" (indicating potential new data)

Use --force-refresh to download all runs regardless of existing data.

Environment Variables

The tool reads configuration from environment variables with the DR_WANDB_ prefix and supports .env files:

Variable Description Default
DR_WANDB_ENTITY Weights & Biases entity name None
DR_WANDB_PROJECT Weights & Biases project name None
DR_WANDB_DATABASE_URL PostgreSQL connection string postgresql+psycopg2://localhost/wandb
DR_WANDB_OUTPUT_DIR Directory for exported files ./data

Database Configuration

The PostgreSQL connection string follows the standard format:

postgresql+psycopg2://username:password@host:port/database_name

If the specified database does not exist, the tool will attempt to create it automatically.

Data Schema

The tool generates the following files in the output directory:

  • runs_metadata.parquet - Complete run metadata including configurations, summaries, and system information
  • runs_history.parquet - Training metrics and logged values over time
  • runs_metadata_{component}.parquet - Component-specific files for config, summary, wandb_metadata, system_metrics, system_attrs, and sweep_info

Run Records

  • run_id: Unique identifier for the experiment run
  • run_name: Human-readable name assigned to the run
  • state: Current state (finished, running, crashed, failed, killed)
  • project: Project name
  • entity: Entity name
  • created_at: Timestamp of run creation
  • config: Experiment configuration parameters (JSONB)
  • summary: Final metrics and outputs (JSONB)
  • wandb_metadata: Platform-specific metadata (JSONB)
  • system_metrics: Hardware and system information (JSONB)
  • system_attrs: Additional system attributes (JSONB)
  • sweep_info: Hyperparameter sweep information (JSONB)

Training History Records

  • run_id: Reference to the parent run
  • step: Training step number
  • timestamp: Time of metric logging
  • runtime: Elapsed time since run start
  • wandb_metadata: Platform logging metadata (JSONB)
  • metrics: All logged metrics and values (JSONB, flattened in Parquet export)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dr_wandb-0.1.1.tar.gz (53.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dr_wandb-0.1.1-py3-none-any.whl (13.6 kB view details)

Uploaded Python 3

File details

Details for the file dr_wandb-0.1.1.tar.gz.

File metadata

  • Download URL: dr_wandb-0.1.1.tar.gz
  • Upload date:
  • Size: 53.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.3

File hashes

Hashes for dr_wandb-0.1.1.tar.gz
Algorithm Hash digest
SHA256 99ecdf81b9a68330850e4bef55ceb07a3df57f32b99ffb437932f8a3edfd1a21
MD5 c3f16c2078d9c973270f2d20e52b6b93
BLAKE2b-256 9fcdaca019266ebf63cfadc848eb46dd7037590c630f4923f0f60a86d09dcf80

See more details on using hashes here.

File details

Details for the file dr_wandb-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: dr_wandb-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 13.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.3

File hashes

Hashes for dr_wandb-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 335a7c96daf056510bcb2046ad67dee03ddabb500a3ec7117af79309f9fdda32
MD5 e831ab6f9bfff1907f89f84e81dc03d4
BLAKE2b-256 3daa18c96d0808e4904932f235b7e90a9210933fe666c07f7716a4b2b53dd753

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page