Rename `allow_regex` and `ignore_regex` in `snapshot_download` to be consistent with `fnmatch`
See original GitHub issueIn the above, fnmatch
is being used to filter files against allow_regex
and ignore_regex
. Acknowledging that I might be being overly pedantic here, the official docs for fnmatch include the following disclaimer at the top:
This module provides support for Unix shell-style wildcards, which are not the same as regular expressions (which are documented in the re module).
One place where this inconsistency might cause an issue is if someone is downloading a snapshot of a model with large weights and only wants weights for one particular framework. If they created regular expression strings for ignore_regex
, they’d be unpleasantly surprised with the function downloading everything anyway.
I can open a PR changing the names of the parameters if you’re open to making this change and let me know what you’d prefer them be changed to. Perhaps allow_patterns
and ignore_patterns
, respectively?
Thanks!
Issue Analytics
- State:
- Created a year ago
- Comments:5 (4 by maintainers)
Top GitHub Comments
Ok for me to rename the function arguments. I’d prefer to go over a deprecation cycle though that would still allow
allow_regex
andignore_regex
to be passed, but would throw a warning to instead useallow_patterns
.We should then also update the naming here:
Closed by https://github.com/huggingface/huggingface_hub/pull/994.