victor HF Staff commited on
Commit
fa0fb1e
·
verified ·
1 Parent(s): 2c14b53

revert batched-CFG attempt: FA3 has no sm_120 build; drop kernels dep (broke diffusers import)

Browse files
app.py CHANGED
@@ -74,17 +74,6 @@ def _read_example(name: str) -> str:
74
  return (EXAMPLES_DIR / name).read_text(encoding="utf-8").strip()
75
 
76
 
77
- # Warm the FA3 kernel cache (download only; the binary is loaded lazily inside
78
- # the GPU worker on first use). batch_cfg has a per-call sequential fallback.
79
- HAS_FA3 = True
80
- try:
81
- from huggingface_hub import snapshot_download as _sd
82
-
83
- _sd("kernels-community/flash-attn3", allow_patterns=["build/torch211-cxx11-cu130*", "*.json", "*.md"])
84
- except Exception as _fa3_exc: # noqa: BLE001
85
- print(f"[startup] FA3 kernel prefetch failed (lazy load will retry): {_fa3_exc}", flush=True)
86
- print(f"[startup] batched CFG (FA3) enabled: {HAS_FA3}", flush=True)
87
-
88
  print(f"[startup] downloading {MODEL_ID} (refiner excluded) ...", flush=True)
89
  t0 = time.perf_counter()
90
  model_dir = snapshot_download(
@@ -290,14 +279,9 @@ def _video_gpu_duration(caption, height, width, num_frames, steps, *args, **kwar
290
 
291
 
292
  def _run_pipe(target, **call_kwargs):
293
- """Run with batched CFG (one packed forward per step) when FA3 is present;
294
- fall back to sequential CFG if the packed path fails on this GPU."""
295
- if HAS_FA3:
296
- try:
297
- return target(**call_kwargs, batch_cfg=True), "batched"
298
- except Exception as exc: # noqa: BLE001
299
- print(f"[fallback] batch_cfg failed ({type(exc).__name__}: {str(exc)[:150]}), "
300
- "retrying sequential CFG", flush=True)
301
  return target(**call_kwargs, batch_cfg=False), "sequential"
302
 
303
 
 
74
  return (EXAMPLES_DIR / name).read_text(encoding="utf-8").strip()
75
 
76
 
 
 
 
 
 
 
 
 
 
 
 
77
  print(f"[startup] downloading {MODEL_ID} (refiner excluded) ...", flush=True)
78
  t0 = time.perf_counter()
79
  model_dir = snapshot_download(
 
279
 
280
 
281
  def _run_pipe(target, **call_kwargs):
282
+ # Sequential CFG. Batched CFG requires FA3 varlen attention, and the
283
+ # kernels-community FA3 binaries only target sm_80/sm_90a ZeroGPU's
284
+ # RTX PRO 6000 is sm_120, so the packed path cannot run here.
 
 
 
 
 
285
  return target(**call_kwargs, batch_cfg=False), "sequential"
286
 
287
 
lingbot_video/transformer_lingbot_video.py CHANGED
@@ -15,10 +15,7 @@ from diffusers.models.modeling_outputs import Transformer2DModelOutput
15
  from diffusers.models.modeling_utils import ModelMixin
16
 
17
  try:
18
- # Space-local shim: lazily loads the kernels-community FA3 build. Named
19
- # fa3_shim because a metadata-less top-level flash_attn_interface module
20
- # breaks diffusers' import-time flash-attn probing.
21
- from fa3_shim import flash_attn_varlen_func as flash_attn_varlen_func_v3
22
  except Exception: # pragma: no cover - optional CUDA kernel.
23
  flash_attn_varlen_func_v3 = None
24
 
 
15
  from diffusers.models.modeling_utils import ModelMixin
16
 
17
  try:
18
+ from flash_attn_interface import flash_attn_varlen_func as flash_attn_varlen_func_v3
 
 
 
19
  except Exception: # pragma: no cover - optional CUDA kernel.
20
  flash_attn_varlen_func_v3 = None
21
 
requirements.txt CHANGED
@@ -10,4 +10,3 @@ numpy>=1.26
10
  pillow>=10.4.0
11
  scipy>=1.11
12
  json_repair>=0.30
13
- kernels>=0.6
 
10
  pillow>=10.4.0
11
  scipy>=1.11
12
  json_repair>=0.30