Skip to content

Make wandb and lerobot optional across default callbacks and datasets - #169

Open
james77777778 wants to merge 1 commit into
NVIDIA:mainfrom
james77777778:hongyuc/make-lerobot-wandb-optional
Open

Make wandb and lerobot optional across default callbacks and datasets#169
james77777778 wants to merge 1 commit into
NVIDIA:mainfrom
james77777778:hongyuc/make-lerobot-wandb-optional

Conversation

@james77777778

Copy link
Copy Markdown
Contributor

Why

  • wandb: Due to security/CVE vulnerability concerns.
  • lerobot: Avoids forcing heavy PyTorch version constraints and dependencies.

Missing Dependency Test

import sys, importlib.util

# 1. Simulate missing wandb & lerobot
sys.modules["wandb"] = None
sys.modules["wandb.util"] = None
sys.modules["lerobot"] = None
sys.modules["lerobot.datasets"] = None

from cosmos_framework.utils import wandb_util
from cosmos_framework.utils.callback import WandBCallback
from cosmos_framework.callbacks.device_monitor import DeviceMonitor
from cosmos_framework.callbacks.grad_clip import GradClip
from cosmos_framework.callbacks.iter_speed import IterSpeed
from cosmos_framework.callbacks.mfu import MFUCallback
from cosmos_framework.callbacks.norm_monitor import NormMonitor
from cosmos_framework.callbacks.ofu import OFUCallback
from cosmos_framework.callbacks.sequence_packing_padding import SequencePackingPadding
from cosmos_framework.callbacks.sigma_loss_analysis import SigmaLossAnalysis

# wandb disabled mode test without wandb installed (returns cleanly)
wandb_util.init_wandb(type("Cfg", (), {"job": type("J", (), {"wandb_mode": "disabled"})()})(), model=None)

# 2. lerobot dataset guard test (lerobot is None; raises controlled ImportError on init)
spec = importlib.util.spec_from_file_location("cosmos3_action_lerobot", "cosmos_framework/data/generator/action/datasets/cosmos3_action_lerobot.py")
mod = importlib.util.module_from_spec(spec)
spec.loader.exec_module(mod)

assert mod.lerobot is None
try:
    mod.BaseActionLeRobotDataset(
        fps=10, chunk_length=1, split_seed=0, split_val_ratio=0.1, split="train", mode="train", embodiment_type="droid_lerobot", viewpoint="ego_view"
    )
except ImportError as e:
    print(f"Controlled ImportError on instantiation: {e}")

@james77777778
james77777778 force-pushed the hongyuc/make-lerobot-wandb-optional branch from 876ce0c to 148094d Compare August 8, 2026 07:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant