Download conv.py from sk1700/tus: direct link, hf CLI and curl.
- Browser
- Download file 1.81 kB
-
https://huggingface.co/datasets/sk1700/tus/resolve/main/conv.py
- Command line
-
hf download hf://datasets/sk1700/tus/conv.py
-
curl -L -o conv.py https://huggingface.co/datasets/sk1700/tus/resolve/main/conv.py
1.81 kB
| import json | |
| import pandas as pd | |
| from pathlib import Path | |
| # Path to your dataset | |
| DATASET_ROOT = Path(r"C:\Users\h28176\OneDrive - Centria ammattikorkeakoulu Oy\python_projects\RTDE_python\Ur5e_RTDE\lerobot_dataset_ur5e_dualcam") | |
| # --- Update info.json to v3.0 --- | |
| info_path = DATASET_ROOT / "meta" / "info.json" | |
| with open(info_path, "r") as f: | |
| info = json.load(f) | |
| info["codebase_version"] = "v3.0" | |
| # Include your desired features | |
| info["features"] = { | |
| "observation.images.wrist": { | |
| "dtype": "video", | |
| "shape": [480, 640, 3], | |
| "info": {"video.fps": 15, "video.codec": "h264"}, | |
| }, | |
| "observation.images.context": { | |
| "dtype": "video", | |
| "shape": [480, 640, 3], | |
| "info": {"video.fps": 15, "video.codec": "h264"}, | |
| }, | |
| "observation.state": {"dtype": "float32", "shape": [6]}, | |
| "action": {"dtype": "float32", "shape": [6]}, | |
| "timestamp": {"dtype": "float32", "shape": []}, | |
| "frame_index": {"dtype": "int64", "shape": []}, | |
| "episode_index": {"dtype": "int64", "shape": []}, | |
| "index": {"dtype": "int64", "shape": []}, | |
| "task_index": {"dtype": "int64", "shape": []}, | |
| } | |
| with open(info_path, "w") as f: | |
| json.dump(info, f, indent=4) | |
| print("✅ Updated info.json to v3.0 with your desired features.") | |
| # --- Add missing columns to each parquet if needed --- | |
| data_dir = DATASET_ROOT / "data" / "chunk-000" | |
| for pq in data_dir.glob("*.parquet"): | |
| df = pd.read_parquet(pq) | |
| if "index" not in df.columns: | |
| df["index"] = range(len(df)) | |
| if "task_index" not in df.columns: | |
| df["task_index"] = 0 # Default single task dataset | |
| df.to_parquet(pq, index=False) | |
| print(f"🧩 Updated {pq.name}") | |
| print("🎉 Dataset fully converted to LeRobot v3.0 structure.") | |