Skip to content

StatefulDataLoader crashes with latest PyTorch nightly: torch.set_vital removed #1536

@joecummings

Description

@joecummings

StatefulDataLoader.__init__ calls torch.set_vital("Dataloader", "enabled", "True"), but torch.set_vital was removed from PyTorch in pytorch/pytorch#178479 ("Remove TorchVitals", merged 2026-03-26).

Installing the latest PyTorch nightly with the current release of torchdata produces:

AttributeError: module 'torch' has no attribute 'set_vital'

The call is at:
https://github.com/pytorch/data/blob/main/torchdata/stateful_dataloader/stateful_dataloader.py

torch.set_vital("Dataloader", "enabled", "True")  # type: ignore[attr-defined]

The fix should be straightforward: remove or guard this call (e.g. if hasattr(torch, "set_vital"): ...).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions