Clarify VLAC-Cut evaluation workflow and metrics
Browse files
README.md
CHANGED
|
@@ -10,7 +10,7 @@ license: other
|
|
| 10 |
|
| 11 |
# Video-Progress Benchmark Release
|
| 12 |
|
| 13 |
-
Video-Progress Benchmark is a benchmark for evaluating progress prediction in long-horizon robot manipulation. This release provides the benchmark split files, the minimal subset of raw videos required by the benchmark protocol, and a frame-extraction workflow for reproducible evaluation.
|
| 14 |
|
| 15 |
## Contents
|
| 16 |
|
|
@@ -25,14 +25,13 @@ benchmark_splits/
|
|
| 25 |
scripts/
|
| 26 |
unpack_data.sh
|
| 27 |
extract_vlac2_release_frames.py
|
| 28 |
-
|
| 29 |
evaluate_vpb_predictions.py
|
| 30 |
vlac2_release_common.py
|
| 31 |
vpb_public_eval_utils.py
|
| 32 |
-
upload_vlac2_release_archives_to_hf.sbatch
|
| 33 |
|
| 34 |
docs/
|
| 35 |
-
|
| 36 |
|
| 37 |
data/
|
| 38 |
train_videos.tar
|
|
@@ -77,38 +76,38 @@ __VLAC2_FRAMES_ROOT__/
|
|
| 77 |
|
| 78 |
Replace `__VLAC2_FRAMES_ROOT__` with the absolute path to the extracted-frame directory. For example, `__VLAC2_FRAMES_ROOT__/...` should be resolved as `/path/to/data_extracted_frames/...`.
|
| 79 |
|
| 80 |
-
### 4. Build
|
| 81 |
|
| 82 |
```bash
|
| 83 |
-
python scripts/
|
| 84 |
--benchmark-root benchmark_splits \
|
| 85 |
--frames-root /path/to/data_extracted_frames \
|
| 86 |
-
--out manifests/
|
| 87 |
```
|
| 88 |
|
| 89 |
-
|
| 90 |
|
| 91 |
For trajectory-level VLAC-Cut predictions, keep the manifest's 2Hz `frames` list in each prediction row. The evaluator maps predictions by original frame id and scores only the public 1Hz `eval_frames` for global progress and terminal metrics.
|
| 92 |
|
| 93 |
-
By default, each manifest row is one trajectory with a list of sampled frame paths for
|
| 94 |
|
| 95 |
-
### 5. Evaluate predictions
|
| 96 |
|
| 97 |
```bash
|
| 98 |
python scripts/evaluate_vpb_predictions.py \
|
| 99 |
--benchmark-root benchmark_splits \
|
| 100 |
-
--predictions
|
| 101 |
-
--out-json reports/
|
| 102 |
-
--out-md reports/
|
| 103 |
```
|
| 104 |
|
| 105 |
-
The evaluator reports global progress metrics, terminal success metrics, local direction AP on adjacent semantic anchors
|
| 106 |
|
| 107 |
### 6. Evaluate VLAC-Cut
|
| 108 |
|
| 109 |
VLAC-Cut is released separately at <https://huggingface.co/InternRobotics/VLAC-Cut>. This benchmark release does not vendor model weights or a VLAC-Cut batch inference runner; it only defines the benchmark frames, prediction schema, and evaluator.
|
| 110 |
|
| 111 |
-
For
|
| 112 |
|
| 113 |
## Notes
|
| 114 |
|
|
|
|
| 10 |
|
| 11 |
# Video-Progress Benchmark Release
|
| 12 |
|
| 13 |
+
Video-Progress Benchmark is a benchmark for evaluating progress prediction in long-horizon robot manipulation. This release provides the benchmark split files, the minimal subset of raw videos required by the benchmark protocol, and a frame-extraction workflow for reproducible evaluation of VLAC-Cut benchmark metrics.
|
| 14 |
|
| 15 |
## Contents
|
| 16 |
|
|
|
|
| 25 |
scripts/
|
| 26 |
unpack_data.sh
|
| 27 |
extract_vlac2_release_frames.py
|
| 28 |
+
build_vlac_cut_eval_manifest.py
|
| 29 |
evaluate_vpb_predictions.py
|
| 30 |
vlac2_release_common.py
|
| 31 |
vpb_public_eval_utils.py
|
|
|
|
| 32 |
|
| 33 |
docs/
|
| 34 |
+
evaluate_vlac_cut_on_vpb.md
|
| 35 |
|
| 36 |
data/
|
| 37 |
train_videos.tar
|
|
|
|
| 76 |
|
| 77 |
Replace `__VLAC2_FRAMES_ROOT__` with the absolute path to the extracted-frame directory. For example, `__VLAC2_FRAMES_ROOT__/...` should be resolved as `/path/to/data_extracted_frames/...`.
|
| 78 |
|
| 79 |
+
### 4. Build a VLAC-Cut evaluation manifest
|
| 80 |
|
| 81 |
```bash
|
| 82 |
+
python scripts/build_vlac_cut_eval_manifest.py \
|
| 83 |
--benchmark-root benchmark_splits \
|
| 84 |
--frames-root /path/to/data_extracted_frames \
|
| 85 |
+
--out manifests/vlac_cut_vpb_eval.jsonl
|
| 86 |
```
|
| 87 |
|
| 88 |
+
For our VLAC-Cut benchmark evaluation, the manifest samples 2Hz video input frames and also records the public 1Hz evaluation frames from the main view of each trajectory. The 2Hz setting is an evaluation choice for VLAC-Cut input, not a benchmark-wide requirement. Metrics are computed on the released 1Hz evaluation frames.
|
| 89 |
|
| 90 |
For trajectory-level VLAC-Cut predictions, keep the manifest's 2Hz `frames` list in each prediction row. The evaluator maps predictions by original frame id and scores only the public 1Hz `eval_frames` for global progress and terminal metrics.
|
| 91 |
|
| 92 |
+
By default, each manifest row is one trajectory with a list of sampled frame paths for VLAC-Cut inference.
|
| 93 |
|
| 94 |
+
### 5. Evaluate VLAC-Cut predictions
|
| 95 |
|
| 96 |
```bash
|
| 97 |
python scripts/evaluate_vpb_predictions.py \
|
| 98 |
--benchmark-root benchmark_splits \
|
| 99 |
+
--predictions vlac_cut_predictions.jsonl \
|
| 100 |
+
--out-json reports/vlac_cut_vpb_eval.json \
|
| 101 |
+
--out-md reports/vlac_cut_vpb_eval.md
|
| 102 |
```
|
| 103 |
|
| 104 |
+
The evaluator reports global progress metrics, terminal success metrics, and local direction AP on adjacent semantic anchors. Global progress is shown for the 4-bucket overall split and each bucket; terminal metrics and local direction AP are shown for 4-bucket overall, seen merged, and unseen merged. See `docs/evaluate_vlac_cut_on_vpb.md` for the accepted prediction schema and metric definitions.
|
| 105 |
|
| 106 |
### 6. Evaluate VLAC-Cut
|
| 107 |
|
| 108 |
VLAC-Cut is released separately at <https://huggingface.co/InternRobotics/VLAC-Cut>. This benchmark release does not vendor model weights or a VLAC-Cut batch inference runner; it only defines the benchmark frames, prediction schema, and evaluator.
|
| 109 |
|
| 110 |
+
For our VLAC-Cut evaluation, run the model on the 2Hz `image_paths` from the trajectory manifest instead of re-sampling the full raw video. This 2Hz input setting is what we use for VLAC-Cut evaluation; the public benchmark metrics themselves are computed on the 1Hz `eval_frames`. Write one prediction row per trajectory with `global_episode_id`, `frames`, and either the raw VLAC-Cut `response` or an aligned `pred_progress_sequence`, then run `evaluate_vpb_predictions.py` as above. The evaluator parses VLAC-style keypoint responses, reconstructs the prediction curve, and reports global progress, terminal success, and local direction AP. The exact adapter contract is documented in `docs/evaluate_vlac_cut_on_vpb.md`.
|
| 111 |
|
| 112 |
## Notes
|
| 113 |
|
docs/{vpb_public_evaluation.md → evaluate_vlac_cut_on_vpb.md}
RENAMED
|
@@ -1,27 +1,40 @@
|
|
| 1 |
-
#
|
| 2 |
|
| 3 |
-
This
|
| 4 |
-
|
|
|
|
| 5 |
|
| 6 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
|
| 8 |
-
The
|
| 9 |
-
|
| 10 |
-
each released dense video timeline:
|
| 11 |
|
| 12 |
-
- split scope: `test_expert_seen`, `test_expert_unseen`,
|
|
|
|
| 13 |
- view scope: the `metadata.main_path` view only
|
| 14 |
-
- video input points: `--input-sample-hz 2.0`
|
| 15 |
- evaluation points: `--eval-points time_hz --sample-hz 1.0`
|
| 16 |
- global progress metrics: `MAE`, `PRC`, and `VOC` for expert bucket rows
|
| 17 |
- terminal metrics: final progress threshold `90%`
|
| 18 |
-
- local direction metrics: `AP+`, `AP-`, and `MacroAP_D` on adjacent
|
| 19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
|
| 21 |
The released JSON files also contain dense frame-level progress. Use
|
| 22 |
-
`--eval-points dense` only for diagnostics; it is not the paper-comparable
|
|
|
|
| 23 |
|
| 24 |
-
##
|
| 25 |
|
| 26 |
Unpack videos:
|
| 27 |
|
|
@@ -37,77 +50,41 @@ python scripts/extract_vlac2_release_frames.py \
|
|
| 37 |
--frames-root /path/to/frames
|
| 38 |
```
|
| 39 |
|
| 40 |
-
Build
|
| 41 |
|
| 42 |
```bash
|
| 43 |
-
python scripts/
|
| 44 |
--benchmark-root benchmark_splits \
|
| 45 |
--frames-root /path/to/frames \
|
| 46 |
-
--out manifests/
|
| 47 |
```
|
| 48 |
|
| 49 |
-
|
| 50 |
-
`timestamps_sec`, and `image_paths` lists for one 2Hz video trajectory. The row
|
| 51 |
-
also contains `eval_frames` and `eval_timestamps_sec`, which define the 1Hz
|
| 52 |
-
frames used by the evaluator. For frame-level models, add `--record-format point`
|
| 53 |
-
to emit one row per 1Hz evaluation frame.
|
| 54 |
-
|
| 55 |
-
### 2Hz input and 1Hz evaluation mapping
|
| 56 |
-
|
| 57 |
-
The public benchmark GT is evaluated at 1Hz, but VLAC-Cut is run with 2Hz video
|
| 58 |
-
input. The release keeps these two frame sets explicit:
|
| 59 |
-
|
| 60 |
-
- `frames` / `input_frames`: the 2Hz frames passed to the video model.
|
| 61 |
-
- `image_paths` / `input_image_paths`: the frame images corresponding to those
|
| 62 |
-
2Hz frames.
|
| 63 |
-
- `eval_frames`: the 1Hz frames used for global progress and terminal metrics.
|
| 64 |
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
`
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
|
| 73 |
-
|
| 74 |
-
|
|
|
|
|
|
|
| 75 |
|
| 76 |
-
|
| 77 |
-
{
|
| 78 |
-
"global_episode_id": "ARX-data/.../episode_000000",
|
| 79 |
-
"pred_progress_by_frame": {
|
| 80 |
-
"0": 0.0,
|
| 81 |
-
"30": 12.5,
|
| 82 |
-
"60": 28.0
|
| 83 |
-
}
|
| 84 |
-
}
|
| 85 |
-
```
|
| 86 |
|
| 87 |
-
|
| 88 |
|
| 89 |
-
``
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
}
|
| 95 |
-
```
|
| 96 |
-
|
| 97 |
-
If your inference output is a sequence aligned with the trajectory manifest,
|
| 98 |
-
include the frame list so the evaluator can map 2Hz predictions back to frame ids:
|
| 99 |
-
|
| 100 |
-
```json
|
| 101 |
-
{
|
| 102 |
-
"global_episode_id": "ARX-data/.../episode_000000",
|
| 103 |
-
"frames": [0, 15, 30, 45, 60],
|
| 104 |
-
"pred_progress_sequence": [0.0, 5.0, 12.5, 20.0, 28.0]
|
| 105 |
-
}
|
| 106 |
-
```
|
| 107 |
|
| 108 |
-
|
| 109 |
-
or parsed keypoints and applies the same index-normalized curve alignment as the
|
| 110 |
-
formal VLAC evaluation code:
|
| 111 |
|
| 112 |
```json
|
| 113 |
{
|
|
@@ -117,53 +94,23 @@ formal VLAC evaluation code:
|
|
| 117 |
}
|
| 118 |
```
|
| 119 |
|
| 120 |
-
|
| 121 |
-
|
| 122 |
-
|
| 123 |
-
|
| 124 |
-
|
| 125 |
-
Evaluate:
|
| 126 |
-
|
| 127 |
-
```bash
|
| 128 |
-
python scripts/evaluate_vpb_predictions.py \
|
| 129 |
-
--benchmark-root benchmark_splits \
|
| 130 |
-
--predictions predictions.jsonl \
|
| 131 |
-
--out-json reports/vpb_eval.json \
|
| 132 |
-
--out-md reports/vpb_eval.md
|
| 133 |
-
```
|
| 134 |
-
|
| 135 |
-
## Evaluating VLAC-Cut
|
| 136 |
-
|
| 137 |
-
The VLAC-Cut model release is hosted separately at
|
| 138 |
-
<https://huggingface.co/InternRobotics/VLAC-Cut>. The benchmark release does
|
| 139 |
-
not vendor model weights or a separate VLAC-Cut batch inference runner. Use the
|
| 140 |
-
model release to produce a prediction JSONL in the evaluator schema above.
|
| 141 |
|
| 142 |
-
|
| 143 |
-
|
| 144 |
-
trajectory manifest produced by `build_vpb_inference_manifest.py` and feed the
|
| 145 |
-
listed 2Hz `image_paths` to VLAC-Cut as the video frames. This preserves the
|
| 146 |
-
benchmark `start_idx`, main-view selection, and 2Hz input protocol.
|
| 147 |
-
|
| 148 |
-
A minimal VLAC-Cut adapter should do only this:
|
| 149 |
-
|
| 150 |
-
1. Read each trajectory row from `manifests/vpb_test_1hz.jsonl`.
|
| 151 |
-
2. Build the same `chunk_all` prompt from `task_instruction` and
|
| 152 |
-
`task_description`.
|
| 153 |
-
3. Run VLAC-Cut on `image_paths` with the frame list order unchanged.
|
| 154 |
-
4. Write one prediction row per trajectory with the raw response:
|
| 155 |
|
| 156 |
```json
|
| 157 |
{
|
| 158 |
"global_episode_id": "ARX-data/.../episode_000000",
|
| 159 |
"frames": [0, 15, 30, 45, 60],
|
| 160 |
-
"
|
| 161 |
}
|
| 162 |
```
|
| 163 |
|
| 164 |
-
|
| 165 |
-
formal VLAC index-normalized alignment rule, and then takes the 1Hz subset from
|
| 166 |
-
the aligned 2Hz predictions:
|
| 167 |
|
| 168 |
```bash
|
| 169 |
python scripts/evaluate_vpb_predictions.py \
|
|
@@ -173,11 +120,9 @@ python scripts/evaluate_vpb_predictions.py \
|
|
| 173 |
--out-md reports/vlac_cut_vpb_eval.md
|
| 174 |
```
|
| 175 |
|
| 176 |
-
|
| 177 |
-
|
| 178 |
-
|
| 179 |
-
progress, terminal success, local direction AP, local keypoint progress, and
|
| 180 |
-
prediction diagnostics.
|
| 181 |
|
| 182 |
## Metrics
|
| 183 |
|
|
@@ -186,16 +131,20 @@ prediction diagnostics.
|
|
| 186 |
For each trajectory, the evaluator compares predictions against the released
|
| 187 |
`dense_kinematic_progress` values at the selected 1Hz frames.
|
| 188 |
|
| 189 |
-
- `MAE`: mean absolute error over valid points in one trajectory, then averaged
|
| 190 |
-
|
| 191 |
-
- `
|
|
|
|
|
|
|
|
|
|
|
|
|
| 192 |
|
| 193 |
The report shows 4-bucket overall and four per-bucket rows. VOC is omitted for
|
| 194 |
the 4-bucket overall and non-expert bucket rows.
|
| 195 |
|
| 196 |
### Terminal Success
|
| 197 |
|
| 198 |
-
Terminal success uses the last selected evaluation frame:
|
| 199 |
|
| 200 |
- GT success: final GT progress `>= 90`
|
| 201 |
- predicted success: final predicted progress `>= 90`
|
|
@@ -226,28 +175,13 @@ Stagnation transitions are negatives inside each AP ranking, but are not
|
|
| 226 |
averaged as a separate third AP class. The report shows 4-bucket overall, seen
|
| 227 |
merged, and unseen merged rows.
|
| 228 |
|
| 229 |
-
##
|
| 230 |
-
|
| 231 |
-
Local keypoint progress evaluates predictions at all released
|
| 232 |
-
`semantic_anchors`. Prediction values at anchor frames are obtained by linear
|
| 233 |
-
interpolation over the model's valid predicted curve.
|
| 234 |
-
|
| 235 |
-
- `MAE`: trajectory-equal mean absolute error over semantic-anchor keypoints.
|
| 236 |
-
- `PRC`: trajectory-equal Spearman correlation between anchor GT progress and predicted anchor progress.
|
| 237 |
-
- `VOC`: trajectory-equal Spearman correlation between predicted anchor progress and chronological anchor order for expert bucket rows.
|
| 238 |
-
|
| 239 |
-
The report shows 4-bucket overall and four per-bucket rows. VOC is omitted for
|
| 240 |
-
the 4-bucket overall and non-expert bucket rows.
|
| 241 |
|
| 242 |
Missing predictions are not silently filled in strict mode. The report includes
|
| 243 |
-
coverage, missing final counts, duplicate prediction counts, unknown episode
|
| 244 |
-
|
| 245 |
-
|
| 246 |
-
`--clip-pred` is set.
|
| 247 |
-
|
| 248 |
-
Use `--interpolate-missing` only when evaluating sparse model outputs that do
|
| 249 |
-
not include the 1Hz evaluation frame ids. Reports generated with interpolation
|
| 250 |
-
are not strict paper-comparable outputs.
|
| 251 |
|
| 252 |
## Quick Checks
|
| 253 |
|
|
@@ -260,9 +194,9 @@ python scripts/evaluate_vpb_predictions.py --self-test
|
|
| 260 |
Build a small smoke-test manifest:
|
| 261 |
|
| 262 |
```bash
|
| 263 |
-
python scripts/
|
| 264 |
--benchmark-root benchmark_splits \
|
| 265 |
--frames-root /path/to/frames \
|
| 266 |
-
--out /tmp/
|
| 267 |
--limit-trajectories 2
|
| 268 |
```
|
|
|
|
| 1 |
+
# Evaluating VLAC-Cut on Video-Progress Benchmark
|
| 2 |
|
| 3 |
+
This document describes how to evaluate VLAC-Cut benchmark metrics using only
|
| 4 |
+
the public Video-Progress Benchmark release files. It does not require private
|
| 5 |
+
workspace paths or private metric code.
|
| 6 |
|
| 7 |
+
The VLAC-Cut model release is hosted separately at
|
| 8 |
+
<https://huggingface.co/InternRobotics/VLAC-Cut>. This benchmark release
|
| 9 |
+
contains the split files, frame extraction scripts, a VLAC-Cut evaluation
|
| 10 |
+
manifest builder, and a prediction evaluator. It does not vendor model weights
|
| 11 |
+
or a VLAC-Cut batch inference runner.
|
| 12 |
+
|
| 13 |
+
## Evaluation Scope
|
| 14 |
|
| 15 |
+
The public benchmark metrics are computed on the released 1Hz evaluation frames
|
| 16 |
+
reconstructed from each dense video timeline:
|
|
|
|
| 17 |
|
| 18 |
+
- split scope: `test_expert_seen`, `test_expert_unseen`,
|
| 19 |
+
`test_nonexpert_seen`, `test_nonexpert_unseen`
|
| 20 |
- view scope: the `metadata.main_path` view only
|
|
|
|
| 21 |
- evaluation points: `--eval-points time_hz --sample-hz 1.0`
|
| 22 |
- global progress metrics: `MAE`, `PRC`, and `VOC` for expert bucket rows
|
| 23 |
- terminal metrics: final progress threshold `90%`
|
| 24 |
+
- local direction metrics: `AP+`, `AP-`, and `MacroAP_D` on adjacent
|
| 25 |
+
`semantic_anchors` with `tau=0`
|
| 26 |
+
|
| 27 |
+
For our VLAC-Cut evaluation, we feed the model video frames sampled at 2Hz. This
|
| 28 |
+
2Hz input rate is an evaluation setting for VLAC-Cut, not a benchmark-wide
|
| 29 |
+
protocol requirement. The evaluator maps VLAC-Cut predictions back to original
|
| 30 |
+
frame ids and computes the benchmark metrics on the public 1Hz evaluation
|
| 31 |
+
frames.
|
| 32 |
|
| 33 |
The released JSON files also contain dense frame-level progress. Use
|
| 34 |
+
`--eval-points dense` only for diagnostics; it is not the paper-comparable
|
| 35 |
+
default.
|
| 36 |
|
| 37 |
+
## Workflow
|
| 38 |
|
| 39 |
Unpack videos:
|
| 40 |
|
|
|
|
| 50 |
--frames-root /path/to/frames
|
| 51 |
```
|
| 52 |
|
| 53 |
+
Build the VLAC-Cut evaluation manifest:
|
| 54 |
|
| 55 |
```bash
|
| 56 |
+
python scripts/build_vlac_cut_eval_manifest.py \
|
| 57 |
--benchmark-root benchmark_splits \
|
| 58 |
--frames-root /path/to/frames \
|
| 59 |
+
--out manifests/vlac_cut_vpb_eval.jsonl
|
| 60 |
```
|
| 61 |
|
| 62 |
+
Each trajectory-level manifest row contains:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 63 |
|
| 64 |
+
- `frames` / `input_frames`: the 2Hz frame ids used as VLAC-Cut video input.
|
| 65 |
+
- `image_paths` / `input_image_paths`: the extracted images for those 2Hz
|
| 66 |
+
frames.
|
| 67 |
+
- `eval_frames`: the public 1Hz frame ids used for global progress and terminal
|
| 68 |
+
metrics.
|
| 69 |
+
- `task_instruction` and `task_description`: text fields used to build the
|
| 70 |
+
VLAC-Cut prompt.
|
| 71 |
|
| 72 |
+
For this release, the default 1Hz `eval_frames` are a subset of the default 2Hz
|
| 73 |
+
`input_frames`. Keep the 2Hz `frames` list in each VLAC-Cut prediction row. The
|
| 74 |
+
evaluator stores predictions by original frame id, then compares only the 1Hz
|
| 75 |
+
`eval_frames` against the released `dense_kinematic_progress` GT.
|
| 76 |
|
| 77 |
+
## VLAC-Cut Prediction Rows
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 78 |
|
| 79 |
+
A minimal VLAC-Cut adapter should:
|
| 80 |
|
| 81 |
+
1. Read each row from `manifests/vlac_cut_vpb_eval.jsonl`.
|
| 82 |
+
2. Build the same VLAC-Cut prompt from `task_instruction` and
|
| 83 |
+
`task_description`.
|
| 84 |
+
3. Run VLAC-Cut on `image_paths` with the frame order unchanged.
|
| 85 |
+
4. Write one prediction row per trajectory with the raw VLAC-Cut response.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 86 |
|
| 87 |
+
Example:
|
|
|
|
|
|
|
| 88 |
|
| 89 |
```json
|
| 90 |
{
|
|
|
|
| 94 |
}
|
| 95 |
```
|
| 96 |
|
| 97 |
+
The evaluator parses VLAC-style keypoint responses, aligns the parsed progress
|
| 98 |
+
curve to the provided 2Hz `frames` list using the same index-normalized
|
| 99 |
+
alignment rule as the formal VLAC evaluation code, and then takes the 1Hz subset
|
| 100 |
+
for metric computation.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 101 |
|
| 102 |
+
If your adapter has already converted the response into a progress sequence
|
| 103 |
+
aligned to the 2Hz frames, this format is also accepted:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 104 |
|
| 105 |
```json
|
| 106 |
{
|
| 107 |
"global_episode_id": "ARX-data/.../episode_000000",
|
| 108 |
"frames": [0, 15, 30, 45, 60],
|
| 109 |
+
"pred_progress_sequence": [0.0, 5.0, 12.5, 20.0, 28.0]
|
| 110 |
}
|
| 111 |
```
|
| 112 |
|
| 113 |
+
Run evaluation:
|
|
|
|
|
|
|
| 114 |
|
| 115 |
```bash
|
| 116 |
python scripts/evaluate_vpb_predictions.py \
|
|
|
|
| 120 |
--out-md reports/vlac_cut_vpb_eval.md
|
| 121 |
```
|
| 122 |
|
| 123 |
+
Use `--interpolate-missing` only for sparse outputs that do not contain the 1Hz
|
| 124 |
+
evaluation frame ids. Reports generated with interpolation are not strict
|
| 125 |
+
paper-comparable outputs.
|
|
|
|
|
|
|
| 126 |
|
| 127 |
## Metrics
|
| 128 |
|
|
|
|
| 131 |
For each trajectory, the evaluator compares predictions against the released
|
| 132 |
`dense_kinematic_progress` values at the selected 1Hz frames.
|
| 133 |
|
| 134 |
+
- `MAE`: mean absolute error over valid points in one trajectory, then averaged
|
| 135 |
+
equally over trajectories.
|
| 136 |
+
- `PRC`: Spearman correlation between GT progress and predicted progress in one
|
| 137 |
+
trajectory, then averaged equally over valid trajectories.
|
| 138 |
+
- `VOC`: Spearman correlation between predicted progress and chronological
|
| 139 |
+
frame order in one trajectory, then averaged equally over valid expert-bucket
|
| 140 |
+
trajectories.
|
| 141 |
|
| 142 |
The report shows 4-bucket overall and four per-bucket rows. VOC is omitted for
|
| 143 |
the 4-bucket overall and non-expert bucket rows.
|
| 144 |
|
| 145 |
### Terminal Success
|
| 146 |
|
| 147 |
+
Terminal success uses the last selected 1Hz evaluation frame:
|
| 148 |
|
| 149 |
- GT success: final GT progress `>= 90`
|
| 150 |
- predicted success: final predicted progress `>= 90`
|
|
|
|
| 175 |
averaged as a separate third AP class. The report shows 4-bucket overall, seen
|
| 176 |
merged, and unseen merged rows.
|
| 177 |
|
| 178 |
+
## Diagnostics
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 179 |
|
| 180 |
Missing predictions are not silently filled in strict mode. The report includes
|
| 181 |
+
coverage, missing final counts, duplicate prediction counts, unknown episode
|
| 182 |
+
ids, prediction frames outside the selected 1Hz evaluation points, and counts
|
| 183 |
+
for predictions outside the nominal `[0, 100]` range. The nominal range counts
|
| 184 |
+
are diagnostics only; predictions are not clipped unless `--clip-pred` is set.
|
|
|
|
|
|
|
|
|
|
|
|
|
| 185 |
|
| 186 |
## Quick Checks
|
| 187 |
|
|
|
|
| 194 |
Build a small smoke-test manifest:
|
| 195 |
|
| 196 |
```bash
|
| 197 |
+
python scripts/build_vlac_cut_eval_manifest.py \
|
| 198 |
--benchmark-root benchmark_splits \
|
| 199 |
--frames-root /path/to/frames \
|
| 200 |
+
--out /tmp/vlac_cut_vpb_manifest_smoke.jsonl \
|
| 201 |
--limit-trajectories 2
|
| 202 |
```
|
scripts/{build_vpb_inference_manifest.py → build_vlac_cut_eval_manifest.py}
RENAMED
|
@@ -25,7 +25,7 @@ from vpb_public_eval_utils import (
|
|
| 25 |
def parse_args() -> argparse.Namespace:
|
| 26 |
release_root = SCRIPT_DIR.parent
|
| 27 |
parser = argparse.ArgumentParser(
|
| 28 |
-
description="Build a public Video-Progress Benchmark
|
| 29 |
)
|
| 30 |
parser.add_argument(
|
| 31 |
"--benchmark-root",
|
|
@@ -69,7 +69,7 @@ def parse_args() -> argparse.Namespace:
|
|
| 69 |
"--input-sample-hz",
|
| 70 |
type=float,
|
| 71 |
default=2.0,
|
| 72 |
-
help="Trajectory-level video input sampling rate. The default
|
| 73 |
)
|
| 74 |
parser.add_argument(
|
| 75 |
"--view",
|
|
|
|
| 25 |
def parse_args() -> argparse.Namespace:
|
| 26 |
release_root = SCRIPT_DIR.parent
|
| 27 |
parser = argparse.ArgumentParser(
|
| 28 |
+
description="Build a VLAC-Cut evaluation manifest for the public Video-Progress Benchmark."
|
| 29 |
)
|
| 30 |
parser.add_argument(
|
| 31 |
"--benchmark-root",
|
|
|
|
| 69 |
"--input-sample-hz",
|
| 70 |
type=float,
|
| 71 |
default=2.0,
|
| 72 |
+
help="Trajectory-level video input sampling rate. The default is the 2Hz input setting used in our VLAC-Cut evaluation.",
|
| 73 |
)
|
| 74 |
parser.add_argument(
|
| 75 |
"--view",
|
scripts/evaluate_vpb_predictions.py
CHANGED
|
@@ -673,67 +673,6 @@ def summarize_local_direction_ap(
|
|
| 673 |
}
|
| 674 |
|
| 675 |
|
| 676 |
-
def summarize_local_keypoint_progress(
|
| 677 |
-
trajectories: list[Trajectory],
|
| 678 |
-
pred_map: PredMap,
|
| 679 |
-
*,
|
| 680 |
-
include_voc: bool,
|
| 681 |
-
) -> dict[str, Any]:
|
| 682 |
-
point_total = 0
|
| 683 |
-
point_valid = 0
|
| 684 |
-
traj_total = 0
|
| 685 |
-
traj_with_valid_pred = 0
|
| 686 |
-
mae_values: list[float] = []
|
| 687 |
-
prc_values: list[float] = []
|
| 688 |
-
voc_values: list[float] = []
|
| 689 |
-
|
| 690 |
-
for traj in trajectories:
|
| 691 |
-
frames = traj.semantic_anchor_frames
|
| 692 |
-
progress = traj.semantic_anchor_progress
|
| 693 |
-
if not frames:
|
| 694 |
-
continue
|
| 695 |
-
traj_total += 1
|
| 696 |
-
point_total += len(frames)
|
| 697 |
-
gt_curve: list[float] = []
|
| 698 |
-
pred_curve: list[float] = []
|
| 699 |
-
for frame, gt in zip(frames, progress):
|
| 700 |
-
pred = interpolated_prediction_for_frame(pred_map, traj.global_episode_id, frame)
|
| 701 |
-
if pred is None or not math.isfinite(float(pred)):
|
| 702 |
-
continue
|
| 703 |
-
point_valid += 1
|
| 704 |
-
gt_curve.append(float(gt))
|
| 705 |
-
pred_curve.append(float(pred))
|
| 706 |
-
|
| 707 |
-
if gt_curve:
|
| 708 |
-
traj_with_valid_pred += 1
|
| 709 |
-
mae_values.append(
|
| 710 |
-
sum(abs(gt - pred) for gt, pred in zip(gt_curve, pred_curve))
|
| 711 |
-
/ len(gt_curve)
|
| 712 |
-
)
|
| 713 |
-
prc = spearman_corr(gt_curve, pred_curve)
|
| 714 |
-
if prc is not None:
|
| 715 |
-
prc_values.append(prc)
|
| 716 |
-
if include_voc:
|
| 717 |
-
voc = spearman_corr(pred_curve, [float(i) for i in range(1, len(pred_curve) + 1)])
|
| 718 |
-
if voc is not None:
|
| 719 |
-
voc_values.append(voc)
|
| 720 |
-
|
| 721 |
-
return {
|
| 722 |
-
"event_source": "semantic_anchors",
|
| 723 |
-
"traj_base_total": int(traj_total),
|
| 724 |
-
"traj_with_valid_pred": int(traj_with_valid_pred),
|
| 725 |
-
"point_base_total": int(point_total),
|
| 726 |
-
"point_valid": int(point_valid),
|
| 727 |
-
"point_coverage_to_base": (point_valid / point_total) if point_total else None,
|
| 728 |
-
"mae": mean_or_none(mae_values),
|
| 729 |
-
"mae_valid_traj": int(len(mae_values)),
|
| 730 |
-
"prc": mean_or_none(prc_values),
|
| 731 |
-
"prc_valid_traj": int(len(prc_values)),
|
| 732 |
-
"voc": mean_or_none(voc_values) if include_voc else None,
|
| 733 |
-
"voc_valid_traj": int(len(voc_values)) if include_voc else 0,
|
| 734 |
-
}
|
| 735 |
-
|
| 736 |
-
|
| 737 |
def finalize_terminal_counter(counter: Counter[str]) -> dict[str, Any]:
|
| 738 |
support = int(counter.get("support", 0))
|
| 739 |
valid_final = int(counter.get("valid_final", 0))
|
|
@@ -854,14 +793,6 @@ def build_report(
|
|
| 854 |
)
|
| 855 |
for bucket, bucket_trajs in by_bucket.items()
|
| 856 |
}
|
| 857 |
-
local_keypoint_per_bucket = {
|
| 858 |
-
bucket: summarize_local_keypoint_progress(
|
| 859 |
-
bucket_trajs,
|
| 860 |
-
pred_map,
|
| 861 |
-
include_voc=(bucket in EXPERT_BUCKETS),
|
| 862 |
-
)
|
| 863 |
-
for bucket, bucket_trajs in by_bucket.items()
|
| 864 |
-
}
|
| 865 |
local_direction_per_bucket = {
|
| 866 |
bucket: summarize_local_direction_ap(
|
| 867 |
bucket_trajs,
|
|
@@ -934,14 +865,6 @@ def build_report(
|
|
| 934 |
),
|
| 935 |
"per_bucket": local_direction_per_bucket,
|
| 936 |
},
|
| 937 |
-
"local_keypoint_progress": {
|
| 938 |
-
"overall_4bucket": summarize_local_keypoint_progress(
|
| 939 |
-
trajectories,
|
| 940 |
-
pred_map,
|
| 941 |
-
include_voc=False,
|
| 942 |
-
),
|
| 943 |
-
"per_bucket": local_keypoint_per_bucket,
|
| 944 |
-
},
|
| 945 |
}
|
| 946 |
|
| 947 |
|
|
@@ -971,7 +894,7 @@ def build_markdown(report: dict[str, Any]) -> str:
|
|
| 971 |
lines.append(f"- interpolate_missing: `{config['interpolate_missing']}`")
|
| 972 |
lines.append("- Curve metrics are trajectory-equal means.")
|
| 973 |
lines.append("- VOC is reported only for expert bucket rows.")
|
| 974 |
-
lines.append("- Local Direction AP
|
| 975 |
lines.append("")
|
| 976 |
|
| 977 |
curve_rows: list[list[Any]] = []
|
|
@@ -1086,32 +1009,6 @@ def build_markdown(report: dict[str, Any]) -> str:
|
|
| 1086 |
)
|
| 1087 |
lines.append("")
|
| 1088 |
|
| 1089 |
-
keypoint_rows: list[list[Any]] = []
|
| 1090 |
-
keypoint_sources = [("overall_4bucket", report["local_keypoint_progress"]["overall_4bucket"])]
|
| 1091 |
-
for bucket in selected_buckets:
|
| 1092 |
-
keypoint_sources.append((bucket, report["local_keypoint_progress"]["per_bucket"][bucket]))
|
| 1093 |
-
for scope, item in keypoint_sources:
|
| 1094 |
-
keypoint_rows.append(
|
| 1095 |
-
[
|
| 1096 |
-
scope,
|
| 1097 |
-
format_percent(item.get("point_coverage_to_base")),
|
| 1098 |
-
point_ratio(item),
|
| 1099 |
-
traj_ratio(item),
|
| 1100 |
-
format_metric(item.get("mae")),
|
| 1101 |
-
format_metric(item.get("prc")),
|
| 1102 |
-
format_metric(item.get("voc")) if scope in EXPERT_BUCKETS else "n/a",
|
| 1103 |
-
]
|
| 1104 |
-
)
|
| 1105 |
-
lines.append("## Local Keypoint Progress")
|
| 1106 |
-
lines.append("")
|
| 1107 |
-
lines.append(
|
| 1108 |
-
markdown_table(
|
| 1109 |
-
["scope", "coverage", "point_valid/keypoints", "traj_valid/base", "MAE", "PRC", "VOC"],
|
| 1110 |
-
keypoint_rows,
|
| 1111 |
-
)
|
| 1112 |
-
)
|
| 1113 |
-
lines.append("")
|
| 1114 |
-
|
| 1115 |
lines.append("## Prediction Diagnostics")
|
| 1116 |
lines.append("")
|
| 1117 |
stats = report["prediction_input"]["stats"]
|
|
@@ -1201,7 +1098,6 @@ def run_self_test() -> None:
|
|
| 1201 |
assert report["benchmark"]["traj_total"] == 4
|
| 1202 |
assert report["curve"]["overall_4bucket"]["mae"] == 0.0
|
| 1203 |
assert report["terminal"]["overall_4bucket"]["tsa"] == 1.0
|
| 1204 |
-
assert report["local_keypoint_progress"]["overall_4bucket"]["mae"] == 0.0
|
| 1205 |
assert report["local_direction_ap"]["overall_4bucket"]["ap_positive"] == 1.0
|
| 1206 |
print("[self-test] ok")
|
| 1207 |
|
|
|
|
| 673 |
}
|
| 674 |
|
| 675 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 676 |
def finalize_terminal_counter(counter: Counter[str]) -> dict[str, Any]:
|
| 677 |
support = int(counter.get("support", 0))
|
| 678 |
valid_final = int(counter.get("valid_final", 0))
|
|
|
|
| 793 |
)
|
| 794 |
for bucket, bucket_trajs in by_bucket.items()
|
| 795 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 796 |
local_direction_per_bucket = {
|
| 797 |
bucket: summarize_local_direction_ap(
|
| 798 |
bucket_trajs,
|
|
|
|
| 865 |
),
|
| 866 |
"per_bucket": local_direction_per_bucket,
|
| 867 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 868 |
}
|
| 869 |
|
| 870 |
|
|
|
|
| 894 |
lines.append(f"- interpolate_missing: `{config['interpolate_missing']}`")
|
| 895 |
lines.append("- Curve metrics are trajectory-equal means.")
|
| 896 |
lines.append("- VOC is reported only for expert bucket rows.")
|
| 897 |
+
lines.append("- Local Direction AP uses adjacent released `semantic_anchors`; predictions are linearly interpolated at anchor frames.")
|
| 898 |
lines.append("")
|
| 899 |
|
| 900 |
curve_rows: list[list[Any]] = []
|
|
|
|
| 1009 |
)
|
| 1010 |
lines.append("")
|
| 1011 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1012 |
lines.append("## Prediction Diagnostics")
|
| 1013 |
lines.append("")
|
| 1014 |
stats = report["prediction_input"]["stats"]
|
|
|
|
| 1098 |
assert report["benchmark"]["traj_total"] == 4
|
| 1099 |
assert report["curve"]["overall_4bucket"]["mae"] == 0.0
|
| 1100 |
assert report["terminal"]["overall_4bucket"]["tsa"] == 1.0
|
|
|
|
| 1101 |
assert report["local_direction_ap"]["overall_4bucket"]["ap_positive"] == 1.0
|
| 1102 |
print("[self-test] ok")
|
| 1103 |
|
scripts/upload_vlac2_release_archives_to_hf.sbatch
DELETED
|
@@ -1,159 +0,0 @@
|
|
| 1 |
-
#!/bin/bash
|
| 2 |
-
#SBATCH -J vlac2-release-hf
|
| 3 |
-
#SBATCH -p wam_critic
|
| 4 |
-
#SBATCH -A research
|
| 5 |
-
#SBATCH -N 1
|
| 6 |
-
#SBATCH --ntasks=1
|
| 7 |
-
#SBATCH --cpus-per-task=4
|
| 8 |
-
#SBATCH --mem=16G
|
| 9 |
-
#SBATCH --time=1-00:00:00
|
| 10 |
-
#SBATCH --output=slurm/%x_%j.out
|
| 11 |
-
#SBATCH --error=slurm/%x_%j.err
|
| 12 |
-
|
| 13 |
-
set -euo pipefail
|
| 14 |
-
|
| 15 |
-
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
| 16 |
-
RELEASE_ROOT="${RELEASE_ROOT:-$(cd "${SCRIPT_DIR}/.." && pwd)}"
|
| 17 |
-
HF_REPO_ID="${HF_REPO_ID:-InternRobotics/VLAC-Cut-Benchmark}"
|
| 18 |
-
HF_REPO_TYPE="${HF_REPO_TYPE:-dataset}"
|
| 19 |
-
ARCHIVE_NAMES=(
|
| 20 |
-
vlac2_release_data_part01_arx_group_a.tar.zst
|
| 21 |
-
vlac2_release_data_part02_arx_group_b.tar.zst
|
| 22 |
-
vlac2_release_data_part03_arx_group_c.tar.zst
|
| 23 |
-
vlac2_release_data_part04_droid_group_a.tar.zst
|
| 24 |
-
vlac2_release_data_part05_droid_group_b.tar.zst
|
| 25 |
-
vlac2_release_data_part06_droid_group_c.tar.zst
|
| 26 |
-
vlac2_release_data_part07_other_sources.tar.zst
|
| 27 |
-
)
|
| 28 |
-
|
| 29 |
-
if [[ -z "${HF_TOKEN:-}" ]]; then
|
| 30 |
-
echo "HF_TOKEN is required" >&2
|
| 31 |
-
exit 1
|
| 32 |
-
fi
|
| 33 |
-
|
| 34 |
-
HF_STAGE_ROOT="${RELEASE_ROOT}/vlac2_release_data/.hf_upload_stage"
|
| 35 |
-
mkdir -p "${HF_STAGE_ROOT}"
|
| 36 |
-
|
| 37 |
-
python3 - "${RELEASE_ROOT}" "${HF_REPO_ID}" "${HF_REPO_TYPE}" "${HF_TOKEN}" "${ARCHIVE_NAMES[@]}" <<'PY'
|
| 38 |
-
import fnmatch
|
| 39 |
-
import sys
|
| 40 |
-
from pathlib import Path
|
| 41 |
-
|
| 42 |
-
from huggingface_hub import HfApi
|
| 43 |
-
|
| 44 |
-
release_root = Path(sys.argv[1]).resolve()
|
| 45 |
-
repo_id = sys.argv[2]
|
| 46 |
-
repo_type = sys.argv[3]
|
| 47 |
-
token = sys.argv[4]
|
| 48 |
-
archive_names = sys.argv[5:]
|
| 49 |
-
api = HfApi(token=token)
|
| 50 |
-
|
| 51 |
-
required = [
|
| 52 |
-
release_root / "README.md",
|
| 53 |
-
release_root / "docs" / "vpb_public_evaluation.md",
|
| 54 |
-
release_root / "scripts" / "build_vpb_inference_manifest.py",
|
| 55 |
-
release_root / "scripts" / "evaluate_vpb_predictions.py",
|
| 56 |
-
release_root / "scripts" / "unpack_data.sh",
|
| 57 |
-
release_root / "scripts" / "upload_vlac2_release_archives_to_hf.sbatch",
|
| 58 |
-
release_root / "scripts" / "extract_vlac2_release_frames.py",
|
| 59 |
-
release_root / "scripts" / "vlac2_release_common.py",
|
| 60 |
-
release_root / "scripts" / "vpb_public_eval_utils.py",
|
| 61 |
-
]
|
| 62 |
-
required.extend(sorted((release_root / "benchmark_splits").glob("**/video_progress_benchmark_file.json")))
|
| 63 |
-
required.extend(release_root / "vlac2_release_data" / name for name in archive_names)
|
| 64 |
-
missing = [str(p) for p in required if not p.exists()]
|
| 65 |
-
if missing:
|
| 66 |
-
raise SystemExit(f"missing required local files: {missing}")
|
| 67 |
-
|
| 68 |
-
delete_candidates = [
|
| 69 |
-
"_extracted_frames/_GENERATED",
|
| 70 |
-
"docs/vlac2_public_release.md",
|
| 71 |
-
"release_bundle_manifest.json",
|
| 72 |
-
"rebuild_validation_summary.json",
|
| 73 |
-
"benchmark_json/split_summary.json",
|
| 74 |
-
"benchmark_splits/split_summary.json",
|
| 75 |
-
"vlac2_release_data/vlac2_release_data_archives_manifest.json",
|
| 76 |
-
"vlac2_release_data/ARX-data/.gitkeep",
|
| 77 |
-
"vlac2_release_data/VLABench_5/.gitkeep",
|
| 78 |
-
"vlac2_release_data/dex_fold_v2_mix/.gitkeep",
|
| 79 |
-
"vlac2_release_data/droid_lerobot/.gitkeep",
|
| 80 |
-
"vlac2_release_data/libero/.gitkeep",
|
| 81 |
-
"vlac2_release_data/libero_zty50/.gitkeep",
|
| 82 |
-
"vlac2_release_data/README.md",
|
| 83 |
-
]
|
| 84 |
-
delete_patterns = [
|
| 85 |
-
"benchmark_json/*/benchmark_stats.json",
|
| 86 |
-
"benchmark_json/*/video_progress_benchmark_file.json",
|
| 87 |
-
"benchmark_splits/*/benchmark_stats.json",
|
| 88 |
-
]
|
| 89 |
-
remote_files = set(api.list_repo_files(repo_id=repo_id, repo_type=repo_type))
|
| 90 |
-
for path_in_repo in delete_candidates:
|
| 91 |
-
if path_in_repo in remote_files:
|
| 92 |
-
api.delete_file(
|
| 93 |
-
path_in_repo=path_in_repo,
|
| 94 |
-
repo_id=repo_id,
|
| 95 |
-
repo_type=repo_type,
|
| 96 |
-
commit_message=f"Delete {path_in_repo}",
|
| 97 |
-
)
|
| 98 |
-
for remote_path in sorted(remote_files):
|
| 99 |
-
if any(fnmatch.fnmatch(remote_path, pattern) for pattern in delete_patterns):
|
| 100 |
-
api.delete_file(
|
| 101 |
-
path_in_repo=remote_path,
|
| 102 |
-
repo_id=repo_id,
|
| 103 |
-
repo_type=repo_type,
|
| 104 |
-
commit_message=f"Delete {remote_path}",
|
| 105 |
-
)
|
| 106 |
-
|
| 107 |
-
for local_path in required[:len(required) - len(archive_names)]:
|
| 108 |
-
rel = local_path.relative_to(release_root).as_posix()
|
| 109 |
-
api.upload_file(
|
| 110 |
-
path_or_fileobj=str(local_path),
|
| 111 |
-
path_in_repo=rel,
|
| 112 |
-
repo_id=repo_id,
|
| 113 |
-
repo_type=repo_type,
|
| 114 |
-
commit_message=f"Update {rel}",
|
| 115 |
-
)
|
| 116 |
-
print(f"uploaded={rel}", flush=True)
|
| 117 |
-
PY
|
| 118 |
-
|
| 119 |
-
hf_remote_file_exists() {
|
| 120 |
-
local rel_path="$1"
|
| 121 |
-
python3 - "${rel_path}" "${HF_REPO_ID}" "${HF_REPO_TYPE}" "${HF_TOKEN}" <<'PY'
|
| 122 |
-
import sys
|
| 123 |
-
|
| 124 |
-
from huggingface_hub import HfApi
|
| 125 |
-
|
| 126 |
-
rel_path = sys.argv[1]
|
| 127 |
-
repo_id = sys.argv[2]
|
| 128 |
-
repo_type = sys.argv[3]
|
| 129 |
-
token = sys.argv[4]
|
| 130 |
-
api = HfApi(token=token)
|
| 131 |
-
remote_files = set(api.list_repo_files(repo_id=repo_id, repo_type=repo_type))
|
| 132 |
-
print("1" if rel_path in remote_files else "0")
|
| 133 |
-
PY
|
| 134 |
-
}
|
| 135 |
-
|
| 136 |
-
for archive_name in "${ARCHIVE_NAMES[@]}"; do
|
| 137 |
-
archive_path="${RELEASE_ROOT}/vlac2_release_data/${archive_name}"
|
| 138 |
-
remote_rel="vlac2_release_data/${archive_name}"
|
| 139 |
-
if [[ "$(hf_remote_file_exists "${remote_rel}")" == "1" ]]; then
|
| 140 |
-
echo "remote_exists=${archive_name}"
|
| 141 |
-
continue
|
| 142 |
-
fi
|
| 143 |
-
|
| 144 |
-
stage_path="${HF_STAGE_ROOT}/${remote_rel}"
|
| 145 |
-
mkdir -p "$(dirname "${stage_path}")"
|
| 146 |
-
if [[ ! -f "${stage_path}" ]] || [[ "$(stat -c '%d:%i' "${stage_path}" 2>/dev/null || true)" != "$(stat -c '%d:%i' "${archive_path}")" ]]; then
|
| 147 |
-
rm -f "${stage_path}"
|
| 148 |
-
ln "${archive_path}" "${stage_path}"
|
| 149 |
-
fi
|
| 150 |
-
|
| 151 |
-
hf upload-large-folder "${HF_REPO_ID}" "${HF_STAGE_ROOT}" \
|
| 152 |
-
--repo-type "${HF_REPO_TYPE}" \
|
| 153 |
-
--token "${HF_TOKEN}" \
|
| 154 |
-
--include "${remote_rel}" \
|
| 155 |
-
--num-workers 4
|
| 156 |
-
|
| 157 |
-
echo "uploaded=${remote_rel}"
|
| 158 |
-
rm -f "${stage_path}"
|
| 159 |
-
done
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|