mirror of
https://github.com/huggingface/lerobot.git
synced 2026-07-23 01:41:54 +00:00
chore(jobs): guard LeRobotDataset import with require_package
Surface a clear "install lerobot[dataset]" error if the datasets extra is missing, instead of a raw ImportError, before pushing a local dataset.
This commit is contained in:
@@ -24,6 +24,7 @@ from __future__ import annotations
|
|||||||
from typing import TYPE_CHECKING
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
from lerobot.utils.constants import HF_LEROBOT_HOME
|
from lerobot.utils.constants import HF_LEROBOT_HOME
|
||||||
|
from lerobot.utils.import_utils import require_package
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from huggingface_hub import HfApi
|
from huggingface_hub import HfApi
|
||||||
@@ -49,6 +50,7 @@ def ensure_dataset_available(repo_id: str, *, api: HfApi, tags: list[str] | None
|
|||||||
|
|
||||||
print(f"[dataset] '{repo_id}' is local-only; pushing to a PRIVATE Hub repo...")
|
print(f"[dataset] '{repo_id}' is local-only; pushing to a PRIVATE Hub repo...")
|
||||||
# Lazy import: LeRobotDataset pulls in heavy dataset deps; defer until actually needed.
|
# Lazy import: LeRobotDataset pulls in heavy dataset deps; defer until actually needed.
|
||||||
|
require_package("datasets", extra="dataset")
|
||||||
from lerobot.datasets import LeRobotDataset
|
from lerobot.datasets import LeRobotDataset
|
||||||
|
|
||||||
LeRobotDataset(repo_id).push_to_hub(private=True, tags=tags)
|
LeRobotDataset(repo_id).push_to_hub(private=True, tags=tags)
|
||||||
|
|||||||
Reference in New Issue
Block a user