dwko commited on
Commit
eb8d03a
·
verified ·
1 Parent(s): 82ca028

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +8 -23
README.md CHANGED
@@ -6,35 +6,29 @@ base_model:
6
  nvidia/Alpamayo-R1-10B 4bit Model.
7
 
8
 
9
- model download ./Alpamayo-R1-10B-4bit
10
 
11
- GPU 12G Memory Run abble, num_frames is 1 ~ 8, over OOM
12
 
13
- Transformers is 4.57.5 ( 5.0.0rc not run)
14
- -------------------------
 
 
15
  import torch
16
  import numpy as np
17
-
18
  from alpamayo_r1.models.alpamayo_r1 import AlpamayoR1
19
-
20
  from alpamayo_r1.load_physical_aiavdataset import load_physical_aiavdataset
21
-
22
  from alpamayo_r1 import helper
23
 
24
-
25
  model_path = "Alpamayo-R1-10B-4bit"
26
-
27
  model = AlpamayoR1.from_pretrained(model_path, dtype=torch.bfloat16).to("cuda")
28
 
29
  processor = helper.get_processor(model.tokenizer)
30
 
31
-
32
  clip_id = "030c760c-ae38-49aa-9ad8-f5650a545d26"
33
-
34
  print(f"Loading dataset for clip_id: {clip_id}...")
35
-
36
  data = load_physical_aiavdataset(clip_id, t0_us=15_100_000,num_frames=1)
37
-
38
  print("Dataset loaded.")
39
 
40
  messages = helper.create_message(data["image_frames"].flatten(0, 1))
@@ -55,11 +49,8 @@ model_inputs = {
55
  }
56
 
57
  model_inputs = helper.to_device(model_inputs, "cuda")
58
-
59
  torch.cuda.manual_seed_all(42)
60
-
61
  with torch.autocast("cuda", dtype=torch.bfloat16):
62
-
63
  pred_xyz, pred_rot, extra = model.sample_trajectories_from_data_with_vlm_rollout(
64
  data=model_inputs,
65
  top_p=0.98,
@@ -71,23 +62,17 @@ with torch.autocast("cuda", dtype=torch.bfloat16):
71
 
72
 
73
  print("Chain-of-Causation (per trajectory):\n", extra["cot"][0])
74
-
75
  gt_xy = data["ego_future_xyz"].cpu()[0, 0, :, :2].T.numpy()
76
-
77
  pred_xy = pred_xyz.cpu().numpy()[0, 0, :, :, :2].transpose(0, 2, 1)
78
-
79
  diff = np.linalg.norm(pred_xy - gt_xy[None, ...], axis=1).mean(-1)
80
-
81
  min_ade = diff.min()
82
-
83
  print("minADE:", min_ade, "meters")
84
-
85
  print(
86
  "Note: VLA-reasoning models produce nondeterministic outputs due to trajectory sampling, "
87
  "hardware differences, etc. With num_traj_samples=1 (set for GPU memory compatibility), "
88
  "variance in minADE is expected. For visual sanity checks, see notebooks/inference.ipynb"
89
  )
90
-
91
  --------------------
92
  Result:
93
 
 
6
  nvidia/Alpamayo-R1-10B 4bit Model.
7
 
8
 
9
+ model download ./Alpamayo-R1-10B-4bit
10
 
11
+ GPU 12G Memory Run abble, num_frames is 1 ~ 8, over OOM
12
 
13
+ Transformers is 4.57.5 ( 5.0.0rc not run)
14
+
15
+ -----------------------------------
16
+ ```python
17
  import torch
18
  import numpy as np
 
19
  from alpamayo_r1.models.alpamayo_r1 import AlpamayoR1
 
20
  from alpamayo_r1.load_physical_aiavdataset import load_physical_aiavdataset
 
21
  from alpamayo_r1 import helper
22
 
 
23
  model_path = "Alpamayo-R1-10B-4bit"
 
24
  model = AlpamayoR1.from_pretrained(model_path, dtype=torch.bfloat16).to("cuda")
25
 
26
  processor = helper.get_processor(model.tokenizer)
27
 
 
28
  clip_id = "030c760c-ae38-49aa-9ad8-f5650a545d26"
 
29
  print(f"Loading dataset for clip_id: {clip_id}...")
30
+ #need set access token or huggingface-cli login...
31
  data = load_physical_aiavdataset(clip_id, t0_us=15_100_000,num_frames=1)
 
32
  print("Dataset loaded.")
33
 
34
  messages = helper.create_message(data["image_frames"].flatten(0, 1))
 
49
  }
50
 
51
  model_inputs = helper.to_device(model_inputs, "cuda")
 
52
  torch.cuda.manual_seed_all(42)
 
53
  with torch.autocast("cuda", dtype=torch.bfloat16):
 
54
  pred_xyz, pred_rot, extra = model.sample_trajectories_from_data_with_vlm_rollout(
55
  data=model_inputs,
56
  top_p=0.98,
 
62
 
63
 
64
  print("Chain-of-Causation (per trajectory):\n", extra["cot"][0])
 
65
  gt_xy = data["ego_future_xyz"].cpu()[0, 0, :, :2].T.numpy()
 
66
  pred_xy = pred_xyz.cpu().numpy()[0, 0, :, :, :2].transpose(0, 2, 1)
 
67
  diff = np.linalg.norm(pred_xy - gt_xy[None, ...], axis=1).mean(-1)
 
68
  min_ade = diff.min()
 
69
  print("minADE:", min_ade, "meters")
 
70
  print(
71
  "Note: VLA-reasoning models produce nondeterministic outputs due to trajectory sampling, "
72
  "hardware differences, etc. With num_traj_samples=1 (set for GPU memory compatibility), "
73
  "variance in minADE is expected. For visual sanity checks, see notebooks/inference.ipynb"
74
  )
75
+ ```
76
  --------------------
77
  Result:
78