multimodalart HF Staff commited on
Commit
ddd0e8f
·
verified ·
1 Parent(s): 115cd65

Upload app.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. app.py +14 -8
app.py CHANGED
@@ -50,18 +50,24 @@ processor: Any = AutoProcessor.from_pretrained(MODEL_ID, trust_remote_code=True,
50
 
51
 
52
  def _load_model() -> Any:
53
- """SDPA is the reference deployment's attention backend (transformers default).
54
-
55
- The authors' `deploy_hf_liberoplus.py` never requests flash_attention_2, so SDPA is
56
- the reference-faithful path — and it avoids CUDA-extension ABI churn entirely.
 
 
 
 
 
 
57
  """
58
  m: Any = AutoModel.from_pretrained(
59
  MODEL_ID,
60
  trust_remote_code=True,
61
  dtype=torch.bfloat16,
62
- attn_implementation="sdpa",
63
  )
64
- print("[load] attention backend: sdpa (reference default)", flush=True)
65
  return m.to("cuda")
66
 
67
 
@@ -325,9 +331,9 @@ with gr.Blocks(theme=gr.themes.Citrus(), css=CSS, title="ERVLA — robot action
325
  label="Full predicted action chunk",
326
  datatype=["number"] * 8,
327
  )
328
- status_out = gr.Textbox(label="Status", interactive=False, show_copy_button=True)
329
  csv_out = gr.Textbox(label="Chunk as CSV", lines=8, interactive=False,
330
- show_copy_button=True)
331
  with gr.Accordion("Advanced", open=False):
332
  robot_type = gr.Dropdown(
333
  choices=LIBERO_ROBOT_TYPES, value="libero_10", label="LIBERO suite (robot type)"
 
50
 
51
 
52
  def _load_model() -> Any:
53
+ """Load with eager attention.
54
+
55
+ The custom `MiBoTForActionGeneration` class declares `_supports_flash_attn` but not
56
+ `_supports_sdpa`, so under transformers 4.57.1 the only universally available
57
+ backends are flash_attention_2 and eager. The prebuilt Blackwell flash-attn wheel
58
+ (pt212) has a torch-ABI mismatch against the runtime's preinstalled torch 2.13
59
+ (`undefined symbol: ...materialize_cow_storage`), so eager it is — transformers'
60
+ own suggested fallback. The workload is a single forward pass (~700 vision+text
61
+ tokens, /no_cot, no autoregressive decoding) + 5 small DiT flow steps, where eager
62
+ attention costs only a few hundred ms over FA2.
63
  """
64
  m: Any = AutoModel.from_pretrained(
65
  MODEL_ID,
66
  trust_remote_code=True,
67
  dtype=torch.bfloat16,
68
+ attn_implementation="eager",
69
  )
70
+ print("[load] attention backend: eager", flush=True)
71
  return m.to("cuda")
72
 
73
 
 
331
  label="Full predicted action chunk",
332
  datatype=["number"] * 8,
333
  )
334
+ status_out = gr.Textbox(label="Status", interactive=False, buttons=["copy"])
335
  csv_out = gr.Textbox(label="Chunk as CSV", lines=8, interactive=False,
336
+ buttons=["copy"])
337
  with gr.Accordion("Advanced", open=False):
338
  robot_type = gr.Dropdown(
339
  choices=LIBERO_ROBOT_TYPES, value="libero_10", label="LIBERO suite (robot type)"