Skip to content

Examples use mps as accelerator #158

@tizianocitro

Description

@tizianocitro

Describe the bug

Example pipelines break on machines with no mps.

To reproduce

Steps to reproduce the behavior:

  1. Run make run examples/hgnn.py on a machine with no mps.

Expected behavior

It should be able to run on CUDA directly.

Additional context

make run examples/hgnn.py produces:

=== Run examples/hgnn.py ===
uv run python3 examples/hgnn.py
Loading and preparing dataset...
Enriching node features...
Creating dataloaders...
Starting training and evaluation...
Traceback (most recent call last):
  File "/workspace/hyperbench/examples/hgnn.py", line 143, in <module>
    with MultiModelTrainer(
         ^^^^^^^^^^^^^^^^^^
  File "/workspace/hyperbench/hyperbench/train/trainer.py", line 174, in __init__
    model_config.trainer = L.Trainer(
                           ^^^^^^^^^^
  File "/workspace/hyperbench/.venv/lib/python3.12/site-packages/lightning/pytorch/utilities/argparse.py", line 70, in insert_env_defaults
    return fn(self, **kwargs)
           ^^^^^^^^^^^^^^^^^^
  File "/workspace/hyperbench/.venv/lib/python3.12/site-packages/lightning/pytorch/trainer/trainer.py", line 417, in __init__
    self._accelerator_connector = _AcceleratorConnector(
                                  ^^^^^^^^^^^^^^^^^^^^^^
  File "/workspace/hyperbench/.venv/lib/python3.12/site-packages/lightning/pytorch/trainer/connectors/accelerator_connector.py", line 145, in __init__
    self._set_parallel_devices_and_init_accelerator()
  File "/workspace/hyperbench/.venv/lib/python3.12/site-packages/lightning/pytorch/trainer/connectors/accelerator_connector.py", line 356, in _set_parallel_devices_and_init_accelerator
    raise MisconfigurationException(
lightning.fabric.utilities.exceptions.MisconfigurationException: `MPSAccelerator` can not run on your system since the accelerator is not available. The following accelerator(s) is available and can be passed into `accelerator` argument of `Trainer`: ['cpu', 'cuda'].

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingdocsImprovements or additions to documentation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions