visual_prompt upload package
This folder contains the upload helper for packaging the four instant-streaming
colloquial JSON files and the MP4 files referenced by their videos fields.
Target Hugging Face repo:
spw2000/visual_prompt
Files included
The upload script packages these four metadata files:
test_instant_streaming.colloquial.en.json
test_instant_streaming.colloquial.zh.json
train_instant_streaming.colloquial.en.json
train_instant_streaming.colloquial.zh.json
It scans each JSON file, reads every videos list, deduplicates all referenced
video paths, rewrites packaged JSON video paths to be relative to the extracted
metadata/ directory, and packages the corresponding video files.
Uploaded structure
Running 2_upload.py creates hf_archives/ locally and uploads that folder to
Hugging Face:
README.md
manifest.json
visual_prompt_metadata.tar.gz
visual_prompt_videos-00000-of-XXXXX.tar.gz
visual_prompt_videos-00001-of-XXXXX.tar.gz
...
visual_prompt_metadata.tar.gz contains:
README.md
manifest.json
metadata/test_instant_streaming.colloquial.en.json
metadata/test_instant_streaming.colloquial.zh.json
metadata/train_instant_streaming.colloquial.en.json
metadata/train_instant_streaming.colloquial.zh.json
The JSON files inside this archive are rewritten copies. The source JSON files
in hf_upload/ are not modified.
Each visual_prompt_videos-*.tar.gz contains videos using paths relative to the
RGA3-release-local project root. For example:
mp4/datasets/VideoInfer-Release/frames/MOSE/train/e607450d/00002.mp4
Install dependency
pip install huggingface_hub
Upload
Recommended usage:
cd /home/dyvm6xra/dyvm6xrauser04/peiwensun/project/RGA3-release-local/hf_upload
export HF_TOKEN="YOUR_HUGGINGFACE_TOKEN"
python 2_upload.py
You can also pass the token directly:
python 2_upload.py --token "YOUR_HUGGINGFACE_TOKEN"
Before uploading, you can scan and print the package plan:
python 2_upload.py --dry-run
To only build local archives without uploading:
python 2_upload.py --skip-upload
Common options:
python 2_upload.py \
--repo-id spw2000/visual_prompt \
--repo-type dataset \
--max-shard-size 20GB \
--scan-workers 32 \
--num-workers 8
By default the script uses Hugging Face upload_large_folder, which is
resumable and supports parallel upload workers through --num-workers. This is
recommended for the generated archive folder. If you need a single normal commit
message upload instead, disable it:
python 2_upload.py --no-upload-large-folder
Download and extract
After downloading the uploaded files from Hugging Face, extract them into one dataset directory:
mkdir -p visual_prompt
tar -xzf visual_prompt_metadata.tar.gz -C visual_prompt
for shard in visual_prompt_videos-*.tar.gz; do
tar -xzf "$shard" -C visual_prompt
done
The extracted structure will look like:
visual_prompt/
README.md
manifest.json
metadata/
test_instant_streaming.colloquial.en.json
test_instant_streaming.colloquial.zh.json
train_instant_streaming.colloquial.en.json
train_instant_streaming.colloquial.zh.json
mp4/
datasets/
VideoInfer-Release/
frames/
...
Resolving video paths
The packaged JSON files use paths relative to their own metadata/ directory.
For example, a source video path under local RGA3-release-local/mp4/... is
written into the uploaded JSON as:
../mp4/datasets/VideoInfer-Release/frames/MOSE/train/e607450d/00002.mp4
If you read a JSON file from visual_prompt/metadata/, resolve each video path
against the JSON file's parent directory:
from pathlib import Path
json_path = Path("visual_prompt/metadata/train_instant_streaming.colloquial.en.json")
raw_video_path = "../mp4/datasets/VideoInfer-Release/frames/MOSE/train/e607450d/00002.mp4"
video_path = (json_path.parent / raw_video_path).resolve()
manifest.json records archive names, SHA256 checksums, per-JSON videos
array counts, video-reference counts, video counts, missing-video count, and
compressed/uncompressed sizes. It also records that packaged JSON video paths
use the ../mp4/... layout.