Skip to content

fix: preserve forward slashes in HF repo ID on Windows#11

Open
RAVINDRA8008 wants to merge 1 commit intofacebookresearch:mainfrom
RAVINDRA8008:fix/windows-backslash-repo-id
Open

fix: preserve forward slashes in HF repo ID on Windows#11
RAVINDRA8008 wants to merge 1 commit intofacebookresearch:mainfrom
RAVINDRA8008:fix/windows-backslash-repo-id

Conversation

@RAVINDRA8008
Copy link
Copy Markdown

Summary

Fixes #10
On Windows, Path("facebook/tribev2") converts the forward slash to a backslash, producing "facebook\tribev2" when cast back to str(). This causes huggingface_hub.errors.HFValidationError because the Hub expects forward slashes in repo IDs.

Changes

tribev2/demo_utils.py - TribeModel.from_pretrained():

  • Save the original checkpoint_dir string before converting to pathlib.Path
    • Use the preserved string (with forward slashes) as the HuggingFace Hub repo_id
+        checkpoint_dir_str = str(checkpoint_dir)
         checkpoint_dir = Path(checkpoint_dir)
         ...
-            repo_id = str(checkpoint_dir)
- +            repo_id = checkpoint_dir_str
- ```
## Testing
Verified on Windows 11 (Python 3.13):
- `str(Path("facebook/tribev2"))` -> `"facebook\\tribev2"` (bug confirmed)
- - After fix: `repo_id` correctly preserves `"facebook/tribev2"`

On Windows, Path('facebook/tribev2') converts the forward slash to a
backslash, producing 'facebook\tribev2' when cast back to str().
This breaks huggingface_hub validation which expects forward slashes.

Fix: save the original checkpoint_dir string before converting to
Path, and use that preserved string as the HuggingFace Hub repo ID.

Closes facebookresearch#10
@meta-cla meta-cla bot added the CLA Signed This label is managed by the Meta Open Source bot. label Mar 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Windows: from_pretrained("org/repo") fails HF validation — str(Path(repo_id)) uses backslashes

1 participant