mirror of
https://github.com/modelscope/modelscope.git
synced 2025-12-16 16:27:45 +01:00
Merge remote-tracking branch 'origin' into fix/trust_remote_code_
This commit is contained in:
8
.github/workflows/docker-image.yml
vendored
8
.github/workflows/docker-image.yml
vendored
@@ -26,8 +26,12 @@ on:
|
|||||||
other_params:
|
other_params:
|
||||||
description: 'Other params in --xxx xxx'
|
description: 'Other params in --xxx xxx'
|
||||||
required: false
|
required: false
|
||||||
|
python_version:
|
||||||
|
description: 'Python version to use, default is 3.10.14'
|
||||||
|
required: false
|
||||||
|
default: '3.10.14'
|
||||||
|
|
||||||
run-name: Docker-${{ inputs.modelscope_branch }}-${{ inputs.image_type }}-${{ inputs.workflow_name }}-by-@${{ github.actor }}
|
run-name: Docker-${{ inputs.modelscope_branch }}-${{ inputs.image_type }}-${{ inputs.workflow_name }}-${{ inputs.python_version }}-by-@${{ github.actor }}
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
@@ -51,4 +55,4 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
set -e
|
set -e
|
||||||
source ~/.bashrc
|
source ~/.bashrc
|
||||||
python docker/build_image.py --image_type ${{ github.event.inputs.image_type }} --modelscope_branch ${{ github.event.inputs.modelscope_branch }} --modelscope_version ${{ github.event.inputs.modelscope_version }} --swift_branch ${{ github.event.inputs.swift_branch }} --ci_image ${{ github.event.inputs.ci_image }} ${{ github.event.inputs.other_params }}
|
python docker/build_image.py --image_type ${{ github.event.inputs.image_type }} --python_version ${{ github.event.inputs.python_version }} --modelscope_branch ${{ github.event.inputs.modelscope_branch }} --modelscope_version ${{ github.event.inputs.modelscope_version }} --swift_branch ${{ github.event.inputs.swift_branch }} --ci_image ${{ github.event.inputs.ci_image }} ${{ github.event.inputs.other_params }}
|
||||||
|
|||||||
@@ -345,7 +345,7 @@ def _patch_pretrained_class(all_imported_modules, wrap=False):
|
|||||||
else:
|
else:
|
||||||
all_available_modules.append(
|
all_available_modules.append(
|
||||||
get_wrapped_class(var, **ignore_file_pattern_kwargs))
|
get_wrapped_class(var, **ignore_file_pattern_kwargs))
|
||||||
except: # noqa
|
except Exception:
|
||||||
all_available_modules.append(var)
|
all_available_modules.append(var)
|
||||||
else:
|
else:
|
||||||
if has_from_pretrained and not hasattr(var,
|
if has_from_pretrained and not hasattr(var,
|
||||||
@@ -370,9 +370,10 @@ def _patch_pretrained_class(all_imported_modules, wrap=False):
|
|||||||
if has_get_config_dict and not hasattr(var,
|
if has_get_config_dict and not hasattr(var,
|
||||||
'_get_config_dict_origin'):
|
'_get_config_dict_origin'):
|
||||||
var._get_config_dict_origin = var.get_config_dict
|
var._get_config_dict_origin = var.get_config_dict
|
||||||
var.get_config_dict = classmethod(
|
var.get_config_dict = partial(
|
||||||
partial(patch_get_config_dict,
|
patch_pretrained_model_name_or_path,
|
||||||
**ignore_file_pattern_kwargs))
|
ori_func=var._get_config_dict_origin,
|
||||||
|
**ignore_file_pattern_kwargs)
|
||||||
|
|
||||||
all_available_modules.append(var)
|
all_available_modules.append(var)
|
||||||
return all_available_modules
|
return all_available_modules
|
||||||
@@ -618,6 +619,11 @@ def _patch_hub():
|
|||||||
# Patch repocard.validate
|
# Patch repocard.validate
|
||||||
from huggingface_hub import repocard
|
from huggingface_hub import repocard
|
||||||
if not hasattr(repocard.RepoCard, '_validate_origin'):
|
if not hasattr(repocard.RepoCard, '_validate_origin'):
|
||||||
|
|
||||||
|
def load(*args, **kwargs): # noqa
|
||||||
|
from huggingface_hub.errors import EntryNotFoundError
|
||||||
|
raise EntryNotFoundError(message='API not supported.')
|
||||||
|
|
||||||
repocard.RepoCard._validate_origin = repocard.RepoCard.validate
|
repocard.RepoCard._validate_origin = repocard.RepoCard.validate
|
||||||
repocard.RepoCard.validate = lambda *args, **kwargs: None
|
repocard.RepoCard.validate = lambda *args, **kwargs: None
|
||||||
repocard.RepoCard._load_origin = repocard.RepoCard.load
|
repocard.RepoCard._load_origin = repocard.RepoCard.load
|
||||||
|
|||||||
Reference in New Issue
Block a user