Views
No views yet
| File | Size | Description |
|---|---|---|
best_model.pt | 51MB | GazeQwen checkpoint (f_theta weights + LoRA weights) |
wget https://dl.fbaipublicfiles.com/vjepa2/vjepa2_1_vitb_dist_vitG_384.pt1checkpoint = torch.load("best_model.pt", map_location="cpu", weights_only=False)
2# Keys:
3# "state_dict" - GazeQwen f_theta module weights
4# "config" - f_theta architecture config dict
5# "lora_state_dict" - LoRA adapter weights for Qwen2.5-VL LLM
6# "lora_config" - {"rank": 8, "alpha": 16.0}1import torch
2from gazeqwen.model import GazeLens
3from gazeqwen.hooks import GazeLensContext, register_gazelens_hooks
4from gazeqwen.lora import apply_lora, load_lora_state_dict
5from gazeqwen.vjepa_features import VJEPAFeatureExtractor
6from transformers import Qwen2_5_VLForConditionalGeneration, AutoProcessor
7
8# Load frozen Qwen2.5-VL-7B
9model = Qwen2_5_VLForConditionalGeneration.from_pretrained(
10 "Qwen/Qwen2.5-VL-7B-Instruct",
11 torch_dtype="auto", device_map="auto", attn_implementation="eager",
12)
13processor = AutoProcessor.from_pretrained("Qwen/Qwen2.5-VL-7B-Instruct")
14
15# Load GazeQwen checkpoint
16checkpoint = torch.load("best_model.pt", map_location="cpu", weights_only=False)
17f_theta = GazeLens(**checkpoint["config"])
18f_theta.load_state_dict(checkpoint["state_dict"])
19
20# Apply LoRA
21lora_cfg = checkpoint["lora_config"]
22apply_lora(model, rank=lora_cfg["rank"], alpha=lora_cfg["alpha"])
23load_lora_state_dict(model, checkpoint["lora_state_dict"])
24
25# Register hooks and run inference
26ctx = GazeLensContext(f_theta.to(model.device))
27register_gazelens_hooks(model, ctx)
28vjepa = VJEPAFeatureExtractor(device=model.device)
29
30# scanpath: (N, 4) tensor [x, y, midpoint_time, duration]
31# frame_times: list of float timestamps
32# features: list of (H*W, 768) tensors from vjepa.extract_from_raw_frames()
33# with ctx.active(scanpath, frame_times, backbone_features=features):
34# output = model(**inputs)Input Video + Eye Tracking Scanpath
│ │
Qwen2.5-VL V-JEPA 2.1
(frozen) (frozen)
│ │
│ ┌─────┴─────┐
│ │ Coord-PE │ ← Fixation (x,y) encoding
│ │ Gaze │
│ └─────┬─────┘
│ │
│ ┌──────────┴──────────┐
│ │ Voila Perceiver │ ← 32 latents, 2 blocks
│ │ (per-layer × 4) │ 4 independent modules
│ └──────────┬──────────┘
│ │
LLM Layers ◄──── Residual Bias (added at layers 6, 13, 20, 27)
│
+ LoRA (Q/V)
│
Answer (A/B/C/D)| Task | no_gaze | GazeQwen | Delta | p-value |
|---|---|---|---|---|
| OTP (Object Transition Prediction) | 37.3% | 64.4% | +27.1% | 0.002 |
| NFI (Non-Fixated Identification) | 36.9% | 70.2% | +33.3% | <0.001 |
| FAP (Future Action Prediction) | 33.1% | 45.9% | +12.8% | 0.005 |
| OAR (Object Attribute Recognition) | 51.2% | 81.3% | +30.1% | <0.001 |
| OI-E (Object Identification Easy) | 54.8% | 62.2% | +7.4% | 0.038 |
| OI-H (Object Identification Hard) | 50.0% | 76.2% | +26.2% | <0.001 |
| GTA (Gaze-Triggered Alert) | 65.6% | 63.6% | -1.9% | 0.729 |
| OAA (Object Appearance Alert) | 51.4% | 74.3% | +22.9% | <0.001 |
| Overall | 50.4% | 70.3% | +20.0% | <0.001 |