Skip to content

Add HPU support to leakpro#425

Open
Muhaddisabarat wants to merge 5 commits into
mainfrom
LDG-13-leakpro-habana
Open

Add HPU support to leakpro#425
Muhaddisabarat wants to merge 5 commits into
mainfrom
LDG-13-leakpro-habana

Conversation

@Muhaddisabarat
Copy link
Copy Markdown
Collaborator

@Muhaddisabarat Muhaddisabarat commented May 26, 2026

Description

Summary of changes

  • Many files have been modified mostly based on import get.device

  • 2 files added.
    a) leakpro/utils/hardware_setup.py (Hardware selection order )

    1. Habana Gaudi HPU (if habana_frameworks.torch is installed and reports an available device).
    2. NVIDIA CUDA (if torch.cuda.is_available()).
    3. CPU. )

    b) leakpro/utils/device.py (Hardware detection utility for selecting the runtime device).

@Muhaddisabarat Muhaddisabarat requested a review from fazelehh May 26, 2026 14:44
@review-notebook-app
Copy link
Copy Markdown

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

- leakpro/__init__.py: drop typing.Any in __getattr__ (use object +
  TYPE_CHECKING block so `from leakpro import LeakPro` still resolves for
  type checkers); replace inner try/except/pass with contextlib.suppress to
  silence S110; suppress PLC0415 on the deliberate deferred imports that
  keep `import leakpro` resilient to a broken torch install.
- leakpro/utils/hardware_setup.py: same PLC0415 suppression on the
  intentional fault-tolerant `import torch` and lazy get_device import.
- leakpro/utils/seed.py: PLC0415 suppression on the habana_frameworks
  import that only fires when the device is HPU.

Verified with `ruff==0.11.2 check leakpro/` (matches CI version).
@Muhaddisabarat Muhaddisabarat force-pushed the LDG-13-leakpro-habana branch from e0af62f to 01c875d Compare May 27, 2026 13:26
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