Add mindspeed dependency check for NPU-specific paths (FLA & Megatron)#246
Add mindspeed dependency check for NPU-specific paths (FLA & Megatron)#2460hujun wants to merge 4 commits into
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces checks for the 'mindspeed' package before applying NPU-specific patches and adapters. In builtin.py, the Qwen3.5 FLA patch is now conditionally applied with a warning logged if 'mindspeed' is not installed. In _mindspeed_runtime.py, a call to requires('mindspeed') was added. The reviewer pointed out a critical bug where requires is used without being imported, which will lead to a NameError at runtime, and provided a code suggestion to import it.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Motivation
Some NPU patches depend on
mindspeed, but lacked explicit dependency checks:try/except+ warning), making it hard for users to noticeChanges
kernel/builtin.py— Guard the FLA section withexists('mindspeed'): if present, enable FLA; if missing, log a warning and skip FLA while letting other NPU patches apply normally.model/megatron/megatron.py&multi_lora_megatron.py— Addrequires('mindspeed')in src/twinkle/model/megatron/_mindspeed_runtime.py