docs(lerobot): use the hf CLI for Hugging Face login and dataset id#724
docs(lerobot): use the hf CLI for Hugging Face login and dataset id#724jiwenc-nv wants to merge 1 commit into
Conversation
Split the combined login/cd prerequisite into two steps and switch from the deprecated huggingface-cli to the hf CLI (hf auth login); derive the example dataset repo_id from hf auth whoami. Signed-off-by: Jiwen Cai <jiwenc@nvidia.com>
|
📝 Docs preview is not auto-deployed for fork PRs. A maintainer with write access to |
📝 WalkthroughWalkthroughDocumentation updates to the real data collection getting-started guide replace the login instruction with Estimated code review effort: 1 (Trivial) | ~3 minutes Compact metadata:
Related issues: None referenced Poem: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
/preview-docs |
|
✅ Preview deployed: https://NVIDIA.github.io/IsaacTeleop/preview/pr-724/ |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@docs/source/getting_started/lerobot/data_collection_real.rst`:
- Line 84: The `hf auth whoami --format json` examples in the getting-started
docs are using the wrong JSON field, so `dataset.repo_id` can become invalid.
Update both occurrences in the documentation to use the `name` property instead
of `user`, keeping the surrounding `dataset.repo_id` example intact.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: 3417b31a-15e4-4a67-b0a6-50c83e2b9402
📒 Files selected for processing (1)
docs/source/getting_started/lerobot/data_collection_real.rst
| --teleop.type=xr_controller \ | ||
| --robot.cameras="{ front: {type: opencv, index_or_path: 0, width: 640, height: 480, fps: 30}}" \ | ||
| --dataset.repo_id=<hf_user>/<dataset_name> \ | ||
| --dataset.repo_id=$(hf auth whoami --format json | jq -r '.user')/my_test_dataset \ |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
hf auth whoami --format json | jq -r '.name'Repository: NVIDIA/IsaacTeleop
Length of output: 192
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Show the relevant doc sections with line numbers.
sed -n '70,170p' docs/source/getting_started/lerobot/data_collection_real.rst
# Find other whoami usages in the repo.
rg -n "hf auth whoami|jq -r '\\.(user|name)'" docs/source/getting_started/lerobot/data_collection_real.rst docs -S || trueRepository: NVIDIA/IsaacTeleop
Length of output: 5606
🌐 Web query:
huggingface_hub CLI hf auth whoami --format json name user payload docs
💡 Result:
The huggingface_hub CLI command hf auth whoami is used to identify the currently authenticated Hugging Face account [1][2]. To receive the output in JSON format, you can use the --format json option [1][3]. The command also supports a shorthand --json flag [3]. When --format json is specified, the CLI outputs the full response from the underlying whoami API call as a pretty-printed JSON object [3]. The default output format is table, which prints formatted text including your username and the organizations you are a member of [3][2][4]. Example usage: $ hf auth whoami --format json This feature is designed to facilitate scripting and programmatic access to your authentication status [3][5].
Citations:
- 1: https://huggingface.co/docs/huggingface_hub/en/package_reference/cli
- 2: https://huggingface.co/docs/huggingface_hub/main/en/guides/cli
- 3: [CLI] add
--format jsontohf auth whoami+ clarify info commands output format huggingface/huggingface_hub#3938 - 4: https://github.com/huggingface/huggingface_hub/blob/0b55fb46/src/huggingface_hub/cli/auth.py
- 5: https://huggingface.co/docs/huggingface_hub/en/guides/cli
🌐 Web query:
huggingface_hub whoami JSON payload name field user field auth.py source
💡 Result:
The whoami functionality in the huggingface_hub library calls the Hub API endpoint /api/whoami-v2, which returns a JSON response containing information about the authenticated entity [1][2]. In the context of the huggingface_hub Python library, specifically in auth.py and related CLI implementations, the 'name' field in the returned dictionary corresponds to the unique username of the authenticated user or organization [3][4][5][6]. The 'user' field itself is not a standard key within the root level of this specific JSON payload; rather, the CLI code accesses the 'name' key directly from the dictionary returned by the whoami function [3][4][6]. Key details: - The JSON response typically includes keys such as 'type' (user, org, or app), 'id', 'name', 'fullname', and an 'orgs' list [7][1]. - In the CLI source code (e.g., src/huggingface_hub/cli/auth.py), the output is formatted by accessing info['name'] to display the account username [3][4]. - While some developer discussions have proposed formalizing these fields into typed dataclasses, the primary interaction remains through a dictionary returned by the API [7]. - The /api/whoami-v2 response is documented in the broader Hugging Face Hub API specification and includes an 'auth' object containing details about the access token itself (e.g., role, display name) [7][1].
Citations:
- 1: https://github.com/huggingface/huggingface.js/blob/main/packages/hub/src/lib/who-am-i.ts
- 2: huggingface/huggingface_hub@00f12e5
- 3: https://github.com/huggingface/huggingface_hub/blob/0b55fb46/src/huggingface_hub/cli/auth.py
- 4: https://github.com/huggingface/huggingface_hub/blob/9e46a06f/src/huggingface_hub/cli/auth.py
- 5: huggingface/huggingface_hub@ddfeff2
- 6: https://github.com/huggingface/huggingface_hub/blob/9e46a06f/src/huggingface_hub/commands/user.py
- 7: Type
whoamioutput type huggingface/huggingface_hub#1902
Use name instead of user in both hf auth whoami --format json examples. .user resolves to null, so dataset.repo_id becomes invalid.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@docs/source/getting_started/lerobot/data_collection_real.rst` at line 84, The
`hf auth whoami --format json` examples in the getting-started docs are using
the wrong JSON field, so `dataset.repo_id` can become invalid. Update both
occurrences in the documentation to use the `name` property instead of `user`,
keeping the surrounding `dataset.repo_id` example intact.
Split the combined login/cd prerequisite into two steps and switch from the deprecated huggingface-cli to the hf CLI (hf auth login); derive the example dataset repo_id from hf auth whoami.
Description
Fixes #(issue)
Type of change
Testing
Checklist
SKIP=check-copyright-year pre-commit run --all-filesgit commit -s) per the DCOSummary by CodeRabbit