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 (clip_ids when batched)
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.1.tar.gz (118.3 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.1-py3-none-any.whl (16.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: alpamayo_tools-0.1.1.tar.gz
  • Upload date:
  • Size: 118.3 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.1.tar.gz
Algorithm Hash digest
SHA256 9bd4bc6210844d8179df218a0a76079451fb800c4bb5c6094ac611d12f255d89
MD5 95252a30b0e7712f8caee4dee0106a61
BLAKE2b-256 fd594ddca64fa4178598fb6fd4d5f0caca05fe4c98fa907b12c4b28478285bf4

See more details on using hashes here.

File details

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

File metadata

  • Download URL: alpamayo_tools-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 16.9 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 42e7eb006e6e1c9332d30e2ad2a12a58c29f0a375c132bf31f5a4c2e80b76aaa
MD5 addfdfa3bb2b0af71fa5656519d88e65
BLAKE2b-256 3a6960a2fdac276e48117ba04b4bdd2beac0fe0bc5f9860139859366178854ef

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