mirror of
https://github.com/huggingface/lerobot.git
synced 2026-07-22 09:21:53 +00:00
refactor(leaderboard): use a single positional file arg for repo IDs
Replace --repo-ids and --repo-ids-file with a single positional repo_ids_file argument. Lines starting with # are ignored. Made-with: Cursor
This commit is contained in:
@@ -21,14 +21,8 @@ sortable, filterable leaderboard table.
|
|||||||
|
|
||||||
Usage::
|
Usage::
|
||||||
|
|
||||||
lerobot-leaderboard \
|
# models.txt contains one HF repo ID per line (lines starting with # are ignored)
|
||||||
--repo-ids user/model_a,user/model_b \
|
lerobot-leaderboard models.txt --output leaderboard.html
|
||||||
--output leaderboard.html
|
|
||||||
|
|
||||||
# Or from a file listing repo IDs (one per line):
|
|
||||||
lerobot-leaderboard \
|
|
||||||
--repo-ids-file models.txt \
|
|
||||||
--output leaderboard.html
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
@@ -548,15 +542,8 @@ def parse_args(argv: list[str] | None = None) -> argparse.Namespace:
|
|||||||
description="Generate an interactive eval leaderboard from Hub model repos.",
|
description="Generate an interactive eval leaderboard from Hub model repos.",
|
||||||
)
|
)
|
||||||
p.add_argument(
|
p.add_argument(
|
||||||
"--repo-ids",
|
"repo_ids_file",
|
||||||
type=str,
|
type=str,
|
||||||
default=None,
|
|
||||||
help="Comma-separated list of HF model repo IDs.",
|
|
||||||
)
|
|
||||||
p.add_argument(
|
|
||||||
"--repo-ids-file",
|
|
||||||
type=str,
|
|
||||||
default=None,
|
|
||||||
help="Path to a text file with one repo ID per line.",
|
help="Path to a text file with one repo ID per line.",
|
||||||
)
|
)
|
||||||
p.add_argument(
|
p.add_argument(
|
||||||
@@ -577,17 +564,13 @@ def parse_args(argv: list[str] | None = None) -> argparse.Namespace:
|
|||||||
def main(argv: list[str] | None = None):
|
def main(argv: list[str] | None = None):
|
||||||
args = parse_args(argv)
|
args = parse_args(argv)
|
||||||
|
|
||||||
repo_ids: list[str] = []
|
path = Path(args.repo_ids_file)
|
||||||
if args.repo_ids:
|
if not path.exists():
|
||||||
repo_ids.extend(r.strip() for r in args.repo_ids.split(",") if r.strip())
|
logger.error(f"File not found: {path}")
|
||||||
if args.repo_ids_file:
|
sys.exit(1)
|
||||||
path = Path(args.repo_ids_file)
|
repo_ids = [line.strip() for line in path.read_text().splitlines() if line.strip() and not line.startswith("#")]
|
||||||
if not path.exists():
|
|
||||||
logger.error(f"File not found: {path}")
|
|
||||||
sys.exit(1)
|
|
||||||
repo_ids.extend(line.strip() for line in path.read_text().splitlines() if line.strip())
|
|
||||||
if not repo_ids:
|
if not repo_ids:
|
||||||
logger.error("No repo IDs provided. Use --repo-ids or --repo-ids-file.")
|
logger.error(f"No repo IDs found in {path}")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
entries = fetch_all(repo_ids)
|
entries = fetch_all(repo_ids)
|
||||||
|
|||||||
Reference in New Issue
Block a user