Conversation
Add import_lerobot method to import LeRobot v3 datasets into FastLabel robotics projects. Includes optional dependencies (pandas, pyarrow) via pip install fastlabel[robotics]. v2 datasets are detected and rejected with an error message. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
| [project.optional-dependencies] | ||
| robotics = ["pandas>=2.0.0", "pyarrow>=14.0.0"] | ||
|
|
There was a problem hiding this comment.
pip install fastlabel[robotics] でダウンロードできるようにしています。pandas, pyarrow くらいであれば分ける必要はないと思っているんですが、今後、Lerobot 用のパッケージがなどが入るので、先にこうしています。
| if version == "v2": | ||
| raise FastLabelInvalidException( | ||
| "LeRobot dataset v2 is not supported. Please convert to v3.", | ||
| 422, | ||
| ) |
There was a problem hiding this comment.
まずはメインで使われている v3 をサポートしています。
v2 に関しては、必要今後検討します。
|
こちら、サンプルのために録画した lerobot のデータになります。 |
There was a problem hiding this comment.
@rikunosuke
拝見させていただきました!
ロボット周りがあまりわかってないので、変なこと言ってたら無視してください🙇
localhostに向けて動かして、問題なく動くことは確認しました!

(sdk) kmtkm@193-TakumaKamei fastlabel-python-sdk % python -c "
dquote> from fastlabel.lerobot import common
from pathlib import Path
data_path = Path('sample-realman')
# 1. バージョン検出
print('Version:', common.detect_version(data_path))
# 2. カメラ一覧
for cam_dir, name in common.get_camera_dirs(data_path):
print(f'Camera: {name}')
"
Version: v3
Camera: cam_high
Camera: cam_left_wrist
Camera: cam_right_wrist
Camera: camera_01
(sdk) kmtkm@193-TakumaKamei fastlabel-python-sdk % python -c "
from fastlabel.lerobot import v3
from pathlib import Path
data_path = Path('sample-realman')
# エピソード一覧
indices = v3.get_episode_indices(data_path)
print('Episodes:', indices)
# 最初のエピソードで ZIP 生成
zip_path = v3.create_episode_zip(data_path, indices[0])
print('ZIP:', zip_path)
# ZIP の中身を確認
import zipfile
with zipfile.ZipFile(zip_path) as zf:
for name in zf.namelist():
print(f' {name}')
"
Episodes: [0]
ZIP: /var/folders/s_/yw3yzchj76vgrqzw9vg24z0h0000gn/T/tmpcuq297nn/episode_000000.zip
cam_left_wrist.mp4
cam_right_wrist.mp4
cam_high.mp4
episode_000000.json
camera_01.mp4
(sdk) kmtkm@193-TakumaKamei fastlabel-python-sdk % python -c "
import fastlabel
client = fastlabel.Client()
results = client.import_lerobot(
project='robotics-task-classification',
lerobot_data_path='sample-realman',
episode_indices=[0],
)
print(results)
"
[{'episode': 'episode_000000', 'success': True, 'result': {'id': '7c310bf6-1937-4d48-99cb-04a704317229', 'status': 'running', 'msgCode': 'none', 'userName': '', 'credentialName': 'test', 'createdAt': '2026-03-12T23:01:56.137Z', 'updatedAt': '2026-03-12T23:01:56.137Z'}}]
| "action": row["action"].tolist(), | ||
| "frame_index": int(row["frame_index"]), | ||
| "timestamp": float(row["timestamp"]), | ||
| } |
There was a problem hiding this comment.
ロボット詳しくなくてすみません、ここのキー名って決め打ちで大丈夫でしたかね?
observation.stateとかactionとかってロボットが変わっても変わらずあるぜっていうキーなのかどうかがちょっと心配になりました。
もしキーが存在しなかったらKeyエラーが出そうだなとmm
There was a problem hiding this comment.
observation.state と action は lerobot の仕様でロボットごとの差異はないので、決め打ちで大丈夫です!
ただ、key がない可能性を考慮できていなかったので、確認をするようにしました🙇
There was a problem hiding this comment.
@rikunosuke
ご対応いただきありがとうございます!
required_keys がなかった場合に [] を返していますが、この場合動画ファイルはあるものの中身が空の JSON が入った ZIP がアップロードされ、success: True として記録されるかと思います。
仕様上 required_keys が必ず存在するとのことなので実害はなさそうですが、
万が一入った時に気づけるよう warning ログを出すなどしてもいいかもとは思いましたが、軽微なので判断はお任せします!
The docstring incorrectly described files as nested under an
{episode_name}/ directory, but the implementation places files
at the ZIP root.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Return an empty list when required parquet columns (observation.state, action, frame_index, timestamp) are missing, preventing KeyError on datasets from different robot types. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Use all parts after "observation." joined with "_" for content_name (e.g. observation.images.top -> images_top) instead of only the last part. Also replace assert with FastLabelInvalidException for non-observation camera directories. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
@kamei-takuma |
kamei-takuma
left a comment
There was a problem hiding this comment.
@rikunosuke
全てご対応いただきありがとうございました!
一件コメントは入れさせていただきましたが、軽微なのでapproveはさせていただきます🙆
Summary
import_lerobotメソッドを追加pip install fastlabel[robotics]でオプション依存(pandas, pyarrow)をインストール可能にTest plan
import_lerobot動作確認pip install fastlabel[robotics]で pandas, pyarrow がインストールされることを確認🤖 Generated with Claude Code