Looking Ahead: Modeling Future Evolution in Autoregressive Video Generation
Run inference on Windows
hiroki-abe-58710309727dde
diff --git a/src/utils/attention.py b/src/utils/attention.pyindex 14fc90e..e2a3421 100644--- a/src/utils/attention.py+++ b/src/utils/attention.py@@ -6,7 +6,11 @@ from transformers.utils.import_utils import is_flash_attn_4_availableFLASH_ATTN_4_AVAILABLE = is_flash_attn_4_available()if FLASH_ATTN_4_AVAILABLE:- import flash_attn.cute+ try:+ import flash_attn.cute+ except ImportError:+ # Installed but not importable, e.g. on Windows, where its quack dependency imports fcntl.+ FLASH_ATTN_4_AVAILABLE = False__all__ = [diff --git a/src/utils/ckpt_cache.py b/src/utils/ckpt_cache.pyindex fb9e3ee..c5e6bde 100644--- a/src/utils/ckpt_cache.py+++ b/src/utils/ckpt_cache.py@@ -58,6 +58,11 @@ import timeimport torch+try:+ import fcntl+except ImportError: # Windows has no flock; checkpoints then load from their own path.+ fcntl = None+__all__ = ["stage_ckpt_to_local","load_ckpt",@@ -100,7 +105,7 @@ def _should_stage(path: str) -> bool:to ``cache/y`` would be pointless and would also break the"directory hash -> staged subdir" mapping."""- if not _CKPT_LOCAL_CACHE_ENABLE:+ if fcntl is None or not _CKPT_LOCAL_CACHE_ENABLE:return Falseif _REMOTE_FUSE_PREFIX:return path.startswith(_REMOTE_FUSE_PREFIX)@@ -157,7 +162,6 @@ def stage_ckpt_to_local(path: str, *, logger=None, copy_siblings: bool = True) -if not _should_stage(path):return path- import fcntlimport hashlibimport shutildiff --git a/src/utils/wan_wrapper.py b/src/utils/wan_wrapper.pyindex 54945bd..807723d 100644--- a/src/utils/wan_wrapper.py+++ b/src/utils/wan_wrapper.py@@ -7,6 +7,11 @@ from contextlib import contextmanager, nullcontextimport torch+try:+ import fcntl+except ImportError: # Windows has no flock; the base model then loads from WAN_ROOT directly.+ fcntl = None+from src.utils.scheduler import FlowMatchSchedulerfrom src.utils.wan_model_family import get_wan_model_familyfrom src.wan.modules.t5 import umt5_xxl@@ -198,7 +203,7 @@ def _resolve_wan_model_dir(model_name: str) -> str:already_local = wan_root_abs == cache_root_abs or wan_root_abs.startswith(cache_root_abs.rstrip("/") + "/")- if not WAN_LOCAL_CACHE_ENABLE or already_local or not os.path.isdir(src):+ if fcntl is None or not WAN_LOCAL_CACHE_ENABLE or already_local or not os.path.isdir(src):_RESOLVED_MODEL_DIRS[model_name] = srcreturn src@@ -213,8 +218,6 @@ def _resolve_wan_model_dir(model_name: str) -> str:_RESOLVED_MODEL_DIRS[model_name] = dstreturn dst- import fcntl-os.makedirs(dst, exist_ok=True)logging.info(f"[wan-cache] staging {src} -> {dst} "diff --git a/src/wan/modules/attention.py b/src/wan/modules/attention.pyindex 1a80e25..bb003b0 100644--- a/src/wan/modules/attention.py+++ b/src/wan/modules/attention.py@@ -4,7 +4,11 @@ import torchfrom transformers.utils.import_utils import is_flash_attn_4_availableFLASH_ATTN_4_AVAILABLE = is_flash_attn_4_available()if FLASH_ATTN_4_AVAILABLE:- import flash_attn.cute+ try:+ import flash_attn.cute+ except ImportError:+ # Installed but not importable, e.g. on Windows, where its quack dependency imports fcntl.+ FLASH_ATTN_4_AVAILABLE = Falseimport warningsdiff --git a/src/wan/modules/model.py b/src/wan/modules/model.pyindex 52d2f59..f88bd9a 100644--- a/src/wan/modules/model.py+++ b/src/wan/modules/model.py@@ -2,7 +2,7 @@# Copyright 2024-2025 The Alibaba Wan Team Authors. All rights reserved.import torchimport torch.nn as nn-from .attention import flash_attention+from .attention import attentionclass WanRMSNorm(nn.Module):@@ -84,7 +84,7 @@ class WanT2VCrossAttention(WanSelfAttention):v = self.v(context).view(b, -1, n, d)# compute attention- x = flash_attention(q, k, v, k_lens=context_lens)+ x = attention(q, k, v, k_lens=context_lens)# outputx = x.flatten(2)