Skip to content

fix(utils): avoid mutating caller ignore patterns - #10001

Open
gry67673905 wants to merge 1 commit into
modelscope:mainfrom
gry67673905:codex/fix-ignore-pattern-mutation
Open

fix(utils): avoid mutating caller ignore patterns#10001
gry67673905 wants to merge 1 commit into
modelscope:mainfrom
gry67673905:codex/fix-ignore-pattern-mutation

Conversation

@gry67673905

Copy link
Copy Markdown

PR type

  • Bug Fix
  • New Feature
  • Document Updates
  • More Models or Datasets Support

PR information

safe_snapshot_download(..., download_model=False) appended weight-file exclusions to a caller-owned ignore_patterns list. Reusing that list for a subsequent full download could therefore still exclude .bin and .safetensors weights.

Copy the list when adding metadata-only exclusions so the caller's patterns remain unchanged. The regression test covers a metadata-only download followed by a full download using the same list.

Experiment results

  • .venv/bin/python -m unittest tests.utils.test_hub_utils
  • .venv/bin/pre-commit run --all-files

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant