Skip to content

Avoid downloading unnecessary files for AutoConfig #1302

@gitlawr

Description

@gitlawr

To Reproduce

Run the following script

from modelscope import AutoConfig

ignore_file_pattern = [
    # The default
    r'\w+\.bin',
    r'\w+\.safetensors',
    r'\w+\.pth',
    r'\w+\.pt',
    r'\w+\.h5',
    r'\w+\.ckpt',
    # Additional
    r'\w+\.zip',
    r'\w+\.onnx',
]
AutoConfig.from_pretrained("Qwen/Qwen2.5-0.5B-Instruct", ignore_file_pattern=ignore_file_pattern)

Result

  File "/opt/homebrew/lib/python3.11/site-packages/modelscope/utils/hf_util/patcher.py", line 233, in from_pretrained
    model_dir = get_model_dir(
                ^^^^^^^^^^^^^^
TypeError: modelscope.utils.hf_util.patcher._patch_pretrained_class.<locals>.get_model_dir() got multiple values for keyword argument 'ignore_file_pattern'

Notes:
It works in modelscope v1.20.1
It does not work in modelscope v1.24.1

Model hub related: @liuyhwangyh @tastelikefeet @wangxingjun778

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions