Skip to content

Conversation

LxYuan0420
Copy link

This PR adds an early runtime check to catch macOS incompatibility due to flashinfer's dependency on triton, which is not supported on macOS.

This prevents obscure crashes (ModuleNotFoundError: triton) and replaces them with a clear, actionable error message:

RuntimeError: Tokasaurus currently depends on flashinfer, which in turn requires ‘triton’.
However, ‘triton’ is not supported on macOS.
Please run Tokasaurus in a Linux environment with a supported GPU.

Implementation

  • Introduced assert_flashinfer_supported() in tokasaurus/environment.py
  • Called it at the top of entry.py before any indirect flashinfer imports
  • Updated README with a "Platform Compatibility" note

This improves the developer experience for macOS users without affecting behavior on Linux.

Output:

(tokasaurus) ╭─lxyuan@devbox ~/personal_works/tokasaurus  ‹fix/macos-triton-guard›
╰─➤  toka model=meta-llama/Llama-3.2-1B-Instruct
Traceback (most recent call last):
  File "/Users/yuanlikxun/personal_works/tokasaurus/.venv/bin/toka", line 5, in <module>
    from tokasaurus.entry import main
  File "/Users/yuanlikxun/personal_works/tokasaurus/tokasaurus/entry.py", line 3, in <module>
    assert_flashinfer_supported()
  File "/Users/yuanlikxun/personal_works/tokasaurus/tokasaurus/environment.py", line 17, in assert_flashinfer_supported
    raise RuntimeError(
RuntimeError: Tokasaurus currently depends on flashinfer, which in turn requires 'triton'.
However, 'triton' is not supported on macOS.
Please run Tokasaurus in a Linux environment with a supported GPU.

- Introduced a new module, `environment.py`, to check platform compatibility for flashinfer and Triton.
- Added a function `is_flashinfer_supported()` to verify if flashinfer is usable on the current platform, with specific checks for unsupported macOS.
- Added `assert_flashinfer_supported()` in `entry.py` to raise a `RuntimeError` when the platform is not supported.
- Ensures users receive a clear error message to prevent execution on incompatible systems.
Updated the README.md to include a section on platform compatibility.
Added details indicating that Tokasaurus uses `flashinfer` and relies on
Triton, which is not supported on macOS due to the lack of CUDA. Users
on macOS may experience a `ModuleNotFoundError` for Triton. Recommended
running Tokasaurus in a Linux environment with a CUDA-compatible GPU to
ensure full functionality.
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