diff --git a/src/twinkle/kernel/builtin.py b/src/twinkle/kernel/builtin.py index faffb4e7..7675767b 100644 --- a/src/twinkle/kernel/builtin.py +++ b/src/twinkle/kernel/builtin.py @@ -90,10 +90,11 @@ def npu_builtin(model: nn.Module | None = None) -> dict[Any, dict[str, Any]]: if exists('mindspeed>=0.12.1') and exists('flash-linear-attention'): apply_qwen3_5_fla(model) else: - logger.warning('[NPU] [FLA] mindspeed or flash-linear-attention is not installed, or mindspeed version smaller than 0.12.1; ' - 'FLA patch for Qwen3.5 requires mindspeed and flash-linear-attention. ' - 'Install them with: pip install flash-linear-attention and mindspeed from source code via https://gitcode.com/Ascend/MindSpeed.' - 'Other NPU patches will still apply.') + logger.warning( + '[NPU] [FLA] mindspeed or flash-linear-attention is not installed, or mindspeed version smaller than 0.12.1; ' + 'FLA patch for Qwen3.5 requires mindspeed and flash-linear-attention. ' + 'Install them with: pip install flash-linear-attention and mindspeed from source code via https://gitcode.com/Ascend/MindSpeed.' + 'Other NPU patches will still apply.') return bundle diff --git a/src/twinkle/model/transformers/transformers.py b/src/twinkle/model/transformers/transformers.py index c8fec86d..9be48cae 100644 --- a/src/twinkle/model/transformers/transformers.py +++ b/src/twinkle/model/transformers/transformers.py @@ -384,7 +384,7 @@ def _router_replay_setup(self, router_replay_action, routed_experts=None, batch_ Returns ``cleanup_fn``. Call *cleanup_fn* after the forward to gather recorded indices(when RECORD) and clear global state. """ - if not self._router_replay_enabled: + if not getattr(self, '_router_replay_enabled', False): return lambda: None self._maybe_apply_router_replay() diff --git a/src/twinkle/utils/device_mesh.py b/src/twinkle/utils/device_mesh.py index 7215f7fc..20cda0cf 100644 --- a/src/twinkle/utils/device_mesh.py +++ b/src/twinkle/utils/device_mesh.py @@ -538,6 +538,7 @@ class DeviceGroup: ranks: Union[List[int], int] device_type: str gpus_per_worker: int = 1 + visible_devices: Optional[Union[List[str], List[int], str, int]] = None _device_mesh: Dict[str, DeviceMesh] = field(default_factory=dict)