[transformers backend] flash-linear-attention availability check misses NPU (device whitelist cuda/xpu/mlu)

Đang mở
#410 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 2 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
55/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
python
Lĩnh vực
machine-learning

Hướng nghiên cứu

Start by locating Twinkle’s linear_attention_sp availability check and how it uses Transformers’ is_flash_linear_attention_available(); the issue does not name a file or test. Compare the current check with the reported successful fla import on Ascend NPU, then verify that the availability decision allows the reported Qwen3.5 packing/SP path to use FLA. The issue says a patch has been submitted and a PR is to follow, so check for that work before starting.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

bug
Checklist / 检查清单
  • I have searched existing issues, and this is a new bug report. / 我已经搜索过现有的 issues,确认这是一个新的 bug report。
Bug Description / Bug 描述

Qwen3.5 GatedDeltaNet 在 SP/packing 布局下依赖 flash-linear-attention(import 名为
fla)。twinkle 复用 transformers 的 is_flash_linear_attention_available(),其设备
白名单只含 cuda/xpu/mlu——Ascend NPU 上即使 fla 已安装且 triton-ascend 内核可用,
也被误判为不可用,GDN 走慢路径或直接报错。

How to Reproduce / 如何复现
  1. Ascend NPU + torch_npu + triton(带 ascend backend)+ pip install flash-linear-attention
  2. python: import fla 成功,但 twinkle 的 linear_attention_sp 判定 FLA 不可用
    (is_flash_linear_attention_available() 返回 False)。
  3. Qwen3.5-4B packing/SP 训练时 GDN 无法使用 FLA 内核。

期望:改为包探测(importlib.util.find_spec('fla')),或设备白名单加入 NPU。

Additional Information / 补充信息
  • twinkle: dev-swift-v5 @ dd3d68f
  • Hardware: Ascend910 x2, torch_npu 2.10.0.post7, triton-ascend 3.6.0+
  • fla 0.6.0 在 NPU 上实测可用(Qwen3.5-4B / MoE SP 训练 20 步 PASS)
  • 我们提交了包探测补丁(与 transformers 白名单取"或",CUDA 行为不变),PR to follow。
Ngôn ngữ chính
Python
Star
270
Fork
68
Merge trung bình
2 ngày 16 giờ
Pull request đã merge (30 ngày)
38

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của modelscope/twinkle

Tất cả issue của modelscope/twinkle

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.