Skip to main content

Generated from aind-library-template

Project description

aind-disrnn-result-access

License Code Style semantic-release: angular Interrogate Coverage Python

This repo is part of the aind-disrnn-pipeline project, providing post-hoc access to training results stored in W&B.

disRNN pipeline workflow

Usage

This package provides a Python API for accessing disRNN training results stored in Weights & Biases (W&B). Make sure you are authenticated with W&B (wandb login) before using the client.

Quick Start

from aind_disrnn_result_access import WandbClient

# Initialize client (defaults to entity="AIND-disRNN")
client = WandbClient()

# List available projects
projects = client.get_projects()
# e.g. ["test", "han_mice_disrnn", "han_cpu_gpu_test"]

Browse Run Metadata

# List runs in a project
runs = client.get_runs(project="han_mice_disrnn")
for run in runs:
    print(run.name, run.state, run.summary.get("likelihood"))

# Filter runs (uses MongoDB-style queries)
finished = client.get_runs(
    project="han_mice_disrnn",
    filters={"state": "finished"},
)

# Control sorting and pagination
recent_runs = client.get_runs(
    project="han_mice_disrnn",
    order="-created_at",  # most recent first
    per_page=100,
)

# Get a specific run by ID
run = client.get_run("abc123", project="test")
print(run.config)   # training configuration
print(run.summary)  # final metrics
print(run.tags)     # run tags

Get Runs as DataFrame

# Get runs as a pandas DataFrame (similar to W&B web UI table)
# Config and summary values are flattened with dot notation
df = client.get_runs_dataframe(project="han_mice_disrnn")

# Filter and sort DataFrame
finished_df = df[df["state"] == "finished"]
best_runs = df.nlargest(5, "summary.likelihood")

# Access nested config values
print(df[["name", "config.model.lr", "summary.likelihood"]])

Get Time-Series History

# Get time-series metrics (e.g., train/loss over training steps)
history = client.get_run_history("abc123", project="test")
# Returns DataFrame with _step, _wall_time (elapsed seconds), and metrics
print(history[["_step", "_wall_time", "train/loss", "valid/loss"]])

# Get only specific metrics
history = client.get_run_history(
    "abc123",
    project="test",
    keys=["train/loss", "valid/loss"],
)

# Plot training curves vs wall time
history.plot(x="_wall_time", y=["train/loss", "valid/loss"])

Download Artifacts

# Download training outputs (params, plots, CSVs) for a single run
artifacts = client.download_artifact("abc123", project="test")
for art in artifacts:
    print(art.download_path)  # local path to downloaded files
    print(art.files)          # list of file names

# Download specific artifact type
artifacts = client.download_artifact(
    "abc123",
    project="test",
    artifact_type="training-output",
)

# Download only specific files from artifacts
artifacts = client.download_artifact(
    "abc123",
    project="test",
    files=["model_params.pkl", "training_curves.csv"],
)

# Batch download for multiple runs
all_artifacts = client.download_artifacts(
    ["run1", "run2", "run3"],
    project="han_mice_disrnn",
    output_dir="./my_artifacts",
)

Set a Default Project

# Avoid passing project= on every call
client = WandbClient(project="han_mice_disrnn")
runs = client.get_runs()  # uses default project

See notebook/example_usage.ipynb for a full interactive walkthrough.

Level of Support

Please indicate a level of support:

  • Supported: We are releasing this code to the public as a tool we expect others to use. Issues are welcomed, and we expect to address them promptly; pull requests will be vetted by our staff before inclusion.
  • Occasional updates: We are planning on occasional updating this tool with no fixed schedule. Community involvement is encouraged through both issues and pull requests.
  • Unsupported: We are not currently supporting this code, but simply releasing it to the community AS IS but are not able to provide any guarantees of support. The community is welcome to submit issues, but you should not expect an active response.

Release Status

GitHub's tags and Release features can be used to indicate a Release status.

  • Stable: v1.0.0 and above. Ready for production.
  • Beta: v0.x.x or indicated in the tag. Ready for beta testers and early adopters.
  • Alpha: v0.x.x or indicated in the tag. Still in early development.

Installation

To use the software, in the root directory, run

pip install -e .

To develop the code, run

pip install -e . --group dev

Note: --group flag is available only in pip versions >=25.1

Alternatively, if using uv, run

uv sync

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

aind_disrnn_result_access-0.1.0.tar.gz (15.0 kB view details)

Uploaded Source

Built Distribution

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

aind_disrnn_result_access-0.1.0-py3-none-any.whl (9.2 kB view details)

Uploaded Python 3

File details

Details for the file aind_disrnn_result_access-0.1.0.tar.gz.

File metadata

File hashes

Hashes for aind_disrnn_result_access-0.1.0.tar.gz
Algorithm Hash digest
SHA256 a8f4d92f0dd0d02f3ad7c02d5e69f519c8c34b478e563cd60f19938df6f30b2b
MD5 ee089992759a77cf685790873af3eb75
BLAKE2b-256 458cec5746fe00f4bd86c44362b1c8387ac6fd6076a0ffb98961d18d3718930b

See more details on using hashes here.

File details

Details for the file aind_disrnn_result_access-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for aind_disrnn_result_access-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e19a14d00455d29022cdf9241f09550ec92087d3398e53530cf21d3aa10b9f0f
MD5 203323dfee3725a10c05a68d797945d0
BLAKE2b-256 e1e664e20afe78d97de1ec3c80e6f30288077045a7ed250d14eb70687e717e07

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