mirror of
https://github.com/modelscope/modelscope.git
synced 2026-02-24 04:01:10 +01:00
## 查看改动点 ↓↓↓
### vision efficient tuning finetune
- Model模块改造成适配训练的
- Model模块在支持训练同时向下兼容之前发布的modecard
- Pipline兼容modelcard加载的preprocessor或直接定义的
- 添加 ImageClassificationPreprocessor (非mmcv版本)
- 添加 VisionEfficientTuningTrainer
- ~~添加 opencv_transforms==0.0.6~~ (以源代码引入必要)
### Modelcard
- test pipeline和trainer合并到一起
- 新增3个模型的test
- 新增demo service
### 公共组件
- ms_dataset.py: fix warning, [UserWarning: To copy construct from a tensor, it is recommended to use sourceTensor.clone().detach() or xxx]
- preprocessor添加common:ToNumpy、Rename、Identity
- preprocessor common对于dict进行key判断再取值。
- ~~修复learning rate在iter级别变化的逻辑。~~ (本次不做了)
- ~~修复非dist状态下train data没有进行shuffle的bug。~~ (Master已有人改了)
- 修复训练时调用util中非cv包的异常 zhconv。
### 其他
- 为防止新引入的preprocessor模块在config中被原代码加载,导致在其他人做CI时会报错;所以暂时没有添加新的tag,等CR完成后,会进行打tag再rerun CI。
Link: https://code.alibaba-inc.com/Ali-MaaS/MaaS-lib/codereview/11762108
* support vision efficient tuning finetune
* update test case
* update shuffle on IterableDataset
* update bitfit & sidetuning
* compatible with base trainer
41 lines
1.6 KiB
Python
41 lines
1.6 KiB
Python
# Copyright (c) Alibaba, Inc. and its affiliates.
|
|
from typing import TYPE_CHECKING
|
|
|
|
from modelscope.utils.import_utils import LazyImportModule
|
|
|
|
if TYPE_CHECKING:
|
|
from .video_super_resolution import (VideoReader)
|
|
from .video_stabilization import (stabilization_preprocessor)
|
|
from .mmcls_preprocessor import ImageClassificationMmcvPreprocessor
|
|
|
|
from .image_quality_assessment_mos import ImageQualityAssessmentMosPreprocessor
|
|
from .image_restoration_preprocessor import ImageRestorationPreprocessor
|
|
from .bad_image_detecting_preprocessor import BadImageDetectingPreprocessor
|
|
from .controllable_image_generation import ControllableImageGenerationPreprocessor
|
|
from .image_classification_preprocessor import ImageClassificationPreprocessor
|
|
|
|
else:
|
|
_import_structure = {
|
|
'video_super_resolution': ['VideoReader'],
|
|
'video_stabilization': ['stabilization_preprocessor'],
|
|
'mmcls_preprocessor': ['ImageClassificationMmcvPreprocessor'],
|
|
'image_quality_assessment_mos':
|
|
['ImageQualityAssessmentMosPreprocessor'],
|
|
'image_restoration_preprocessor': ['ImageRestorationPreprocessor'],
|
|
'bad_image_detecting_preprocessor': ['BadImageDetectingPreprocessor'],
|
|
'controllable_image_generation':
|
|
['ControllableImageGenerationPreprocessor'],
|
|
'image_classification_preprocessor':
|
|
['ImageClassificationPreprocessor']
|
|
}
|
|
|
|
import sys
|
|
|
|
sys.modules[__name__] = LazyImportModule(
|
|
__name__,
|
|
globals()['__file__'],
|
|
_import_structure,
|
|
module_spec=__spec__,
|
|
extra_objects={},
|
|
)
|