Skip to main content

Community tools for NVIDIA's Alpamayo/PhysicalAI-AV ecosystem

Project description

alpamayo-tools

Community tools for NVIDIA's Alpamayo-R1 and PhysicalAI-AV ecosystem.

Overview

This package provides:

  • PhysicalAIDataset — PyTorch Dataset that handles video decoding, egomotion interpolation, and coordinate transformation to ego-frame. Useful for training your own models on PhysicalAI-AV without writing the data loading boilerplate.

  • alpamayo-generate-labels — CLI for running Alpamayo-R1 inference at scale. Supports checkpointing, resume, and multi-GPU sharding. Useful for distillation workflows where you need teacher labels for thousands of clips.

  • CoCEmbedder — Sentence embedding for Chain-of-Cognition reasoning text. Useful for retrieval, clustering, or analyzing Alpamayo's reasoning outputs.

All trajectory data is automatically transformed to the ego vehicle's local frame at t0 (the coordinate system Alpamayo-R1 expects).

Installation

pip install alpamayo-tools

With optional dependencies:

pip install alpamayo-tools[embeddings]  # CoC embeddings
pip install alpamayo-tools[inference]   # Alpamayo inference wrapper
pip install alpamayo-tools[all]         # Everything

For inference, also install alpamayo_r1:

pip install git+https://github.com/NVlabs/alpamayo.git

Usage

DataLoader

from alpamayo_tools import PhysicalAIDataset, DatasetConfig, collate_fn
from torch.utils.data import DataLoader

config = DatasetConfig(
    clip_ids=["clip_001", "clip_002"],
    cameras=("camera_front_wide_120fov", "camera_front_tele_30fov"),
    num_frames=4,
    stream=True,
)

dataset = PhysicalAIDataset(config)
loader = DataLoader(dataset, batch_size=4, collate_fn=collate_fn)

for batch in loader:
    frames = batch["frames"]  # (B, N_cam, T, 3, H, W)
    history = batch["ego_history_xyz"]  # (B, 16, 3)
    future = batch["ego_future_xyz"]  # (B, 64, 3)

Inference

from alpamayo_tools.inference import AlpamayoPredictor
import torch

predictor = AlpamayoPredictor.from_pretrained("nvidia/Alpamayo-R1-10B", dtype=torch.bfloat16)
result = predictor.predict_from_clip("clip_001", t0_us=5_100_000)

print(result.trajectory_xyz.shape)  # (64, 3)
print(result.reasoning_text)

Generate Teacher Labels

alpamayo-generate-labels \
    --clip-ids-file train_clips.parquet \
    --output-dir ./labels

# Multi-GPU
CUDA_VISIBLE_DEVICES=0 alpamayo-generate-labels --clip-ids-file clips.parquet --output-dir ./labels --shard 0/4
CUDA_VISIBLE_DEVICES=1 alpamayo-generate-labels --clip-ids-file clips.parquet --output-dir ./labels --shard 1/4

# Resume after interruption
alpamayo-generate-labels --clip-ids-file clips.parquet --output-dir ./labels --resume

CoC Embeddings

from alpamayo_tools import CoCEmbedder

embedder = CoCEmbedder()
embeddings = embedder.embed(["The vehicle ahead is braking."])  # (1, 384)

Dataset Output

Key Shape Description
frames (N_cam, T, 3, H, W) Camera frames (uint8)
ego_history_xyz (16, 3) Past 1.6s trajectory in ego frame
ego_history_rot (16, 3, 3) Past rotations in ego frame
ego_future_xyz (64, 3) Future 6.4s trajectory in ego frame
ego_future_rot (64, 3, 3) Future rotations in ego frame
clip_id str Clip identifier
t0_us int Reference timestamp (microseconds)

Requirements

  • Python 3.12+
  • PyTorch 2.0+
  • For inference: GPU with 24GB+ VRAM

Related

License

MIT

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

alpamayo_tools-0.1.0.tar.gz (117.5 kB view details)

Uploaded Source

Built Distribution

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

alpamayo_tools-0.1.0-py3-none-any.whl (16.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: alpamayo_tools-0.1.0.tar.gz
  • Upload date:
  • Size: 117.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for alpamayo_tools-0.1.0.tar.gz
Algorithm Hash digest
SHA256 e9382a1c6df64ab39c3a1556e6c8c7130fc24f8a933699fe8eff2012a99190f1
MD5 5e4a7bb9f1560f57accdc762d0a18896
BLAKE2b-256 e4354ba46d468b3c4dbca4d803a4bc3bdfc4db3173e085ca4166eb742e605bbc

See more details on using hashes here.

File details

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

File metadata

  • Download URL: alpamayo_tools-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 16.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for alpamayo_tools-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a8881eac57eda3e657ab273732d402a9587de0d4a4f4d2210e44f6252df9780b
MD5 b70fbf877686772c89ef5c500236834a
BLAKE2b-256 a0b0bd1879b40582249e64c8589e3082d1d066f7a88ef48213d62f86eff14074

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