multimodalart HF Staff commited on
Commit
50e859a
verified
1 Parent(s): a3b1781

Upload app.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. app.py +28 -0
app.py CHANGED
@@ -464,6 +464,32 @@ def analyze(
464
  desc=f"Value pass {len(pred_value)}/{len(eval_indices)}",
465
  )
466
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
467
  progress(0.82, desc="Generating analysis...")
468
  input_ids = final_sample["input_ids"].to("cuda").long()
469
  with torch.inference_mode():
@@ -506,6 +532,8 @@ def analyze(
506
  f"{pred_value[-1]:.2f} s at the last frame "
507
  f"(video is {(total - 1) / fps:.1f} s long, {total} frames decoded).",
508
  "",
 
 
509
  f"<sub>{len(eval_indices)} prefix evaluations 路 {num_frames} frames per prefix 路 "
510
  f"{gpu_seconds:.1f} s on GPU</sub>",
511
  ]
 
464
  desc=f"Value pass {len(pred_value)}/{len(eval_indices)}",
465
  )
466
 
467
+ # --- DEBUG: single-pass per-frame readout (model card "Programmatic Usage") ---
468
+ dbg_idx = np.linspace(0, total - 1, num_frames, dtype=int)
469
+ dbg_sample = processor.process_episode(
470
+ instruction=instruction,
471
+ images=[model_images[j] for j in dbg_idx],
472
+ robot_description=robot_description,
473
+ camera_description=camera_description,
474
+ )
475
+ with torch.inference_mode():
476
+ dbg_out = model(
477
+ input_ids=dbg_sample["input_ids"].to("cuda").long(),
478
+ attention_mask=dbg_sample["attention_mask"].to("cuda").long(),
479
+ pixel_values=dbg_sample["pixel_values"].flatten(0, 1).to("cuda"),
480
+ image_grid_thw=dbg_sample["image_grid_thw"].flatten(0, 1).to("cuda").long(),
481
+ )
482
+ dbg_pred = dbg_out.value.pred_value.float().reshape(-1).tolist()
483
+ dbg_rel = dbg_out.relative.pred_value.float().reshape(-1).tolist()
484
+ debug_lines = [
485
+ "```",
486
+ "SINGLE-PASS values: " + ", ".join(f"{v:.2f}" for v in dbg_pred),
487
+ "SINGLE-PASS deltas: " + ", ".join(f"{v:.2f}" for v in dbg_rel),
488
+ "PREFIX last-slot : " + ", ".join(f"{v:.2f}" for v in pred_value),
489
+ f"fps={fps:.2f} total={total}",
490
+ "```",
491
+ ]
492
+
493
  progress(0.82, desc="Generating analysis...")
494
  input_ids = final_sample["input_ids"].to("cuda").long()
495
  with torch.inference_mode():
 
532
  f"{pred_value[-1]:.2f} s at the last frame "
533
  f"(video is {(total - 1) / fps:.1f} s long, {total} frames decoded).",
534
  "",
535
+ "\n".join(debug_lines),
536
+ "",
537
  f"<sub>{len(eval_indices)} prefix evaluations 路 {num_frames} frames per prefix 路 "
538
  f"{gpu_seconds:.1f} s on GPU</sub>",
539
  ]