Skip to content

scripts: Fix remote option in Windows (#14102) #14100

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 19, 2025
Merged

Conversation

pqnet
Copy link
Contributor

@pqnet pqnet commented Jun 10, 2025

Make sure to read the contributing guidelines before submitting a PR

@pqnet
Copy link
Contributor Author

pqnet commented Jun 10, 2025

fixes #14102

@pqnet pqnet marked this pull request as ready for review June 10, 2025 12:07
@CISC
Copy link
Collaborator

CISC commented Jun 10, 2025

The model arg should probably not be a Path, but only assigned to dir_model as a path when not remote.

@pqnet
Copy link
Contributor Author

pqnet commented Jun 10, 2025

The model arg should probably not be a Path, but only assigned to dir_model as a path when not remote.

Probably. I do not know enough of the codebase to do this kind of change so I just fixed the errors I got while running the script

@pqnet pqnet changed the title Fix remote option in Windows scripts: Fix remote option in Windows (#14102) Jun 10, 2025
@CISC
Copy link
Collaborator

CISC commented Jun 10, 2025

The model arg should probably not be a Path, but only assigned to dir_model as a path when not remote.

Probably. I do not know enough of the codebase to do this kind of change so I just fixed the errors I got while running the script

Would you be willing to give it a go? It's fairly simple.

Change this:

"model", type=Path,

Change this to args.model:

repo_id=str(dir_model),

Move this assignment into an else clause, converting it to Path:

dir_model = args.model
if args.remote:
from huggingface_hub import snapshot_download
local_dir = snapshot_download(
repo_id=str(dir_model),
allow_patterns=["LICENSE", "*.json", "*.md", "*.txt", "tokenizer.model"])
dir_model = Path(local_dir)
logger.info(f"Downloaded config and tokenizer to {local_dir}")

No str needed any more:

fname_out = Path("./" + str(args.model).replace("/", "-") + "-{ftype}.gguf")

@CISC
Copy link
Collaborator

CISC commented Jun 13, 2025

@pqnet Nice, will merge once you fix linting failure.

@CISC CISC merged commit 5fc7856 into ggml-org:master Jun 19, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
python python script changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Misc. bug: option --remote of convert_hf_to_gguf.py does not work in Windows
2 participants