NeerajCodz commited on
Commit
ae129df
·
1 Parent(s): f2456ca

fix: use as_posix() for HF repo paths (Windows backslash bug in upload)

Browse files
Files changed (1) hide show
  1. scripts/upload_models_to_hub.py +3 -4
scripts/upload_models_to_hub.py CHANGED
@@ -171,10 +171,9 @@ def main():
171
 
172
  for subdir in subdirs:
173
  rel = subdir.relative_to(version_path)
174
- repo_path = f"{version}/{rel}".rstrip("/.")
175
- # Remove trailing /. for version root
176
- if repo_path.endswith("/."):
177
- repo_path = version
178
 
179
  files_in_sub = [
180
  f for f in subdir.iterdir()
 
171
 
172
  for subdir in subdirs:
173
  rel = subdir.relative_to(version_path)
174
+ # Use as_posix() to ensure forward slashes on Windows
175
+ rel_posix = rel.as_posix()
176
+ repo_path = version if rel_posix == "." else f"{version}/{rel_posix}"
 
177
 
178
  files_in_sub = [
179
  f for f in subdir.iterdir()