Commit Graph

23 Commits

Author SHA1 Message Date
tastelikefeet
75d54927e1 Support trust_remote_code for pipeline and model (#1333) 2025-05-13 22:52:57 +08:00
liuyhwangyh
672c32e7bd fix ci compatible issues,fix llmpipeline lazy import issue (#725)
* fix ci issue

* fix case issue

* modify lint to python3.10

* fix case issue

---------

Co-authored-by: mulin.lyh <mulin.lyh@taobao.com>
2024-01-17 22:19:05 +08:00
mulin.lyh
610cf981b1 fix test_export_speech_signal_process.py issue 2023-10-08 15:21:26 +08:00
mulin.lyh
c12b22ae3d fix onnxruntime providers parameter compatible issue 2023-09-28 17:20:21 +08:00
mulin.lyh
7f4fef0c3a fix provider bug 2023-09-28 17:20:21 +08:00
yuanzhi.zyz
860cdf5f48 add onnx exporter for ocr recognition model
1. 添加ocr recognition相关的exporter,支持现有三类模型转onnx
2. 更新lightweight模型
Link: https://code.alibaba-inc.com/Ali-MaaS/MaaS-lib/codereview/14135723
* add ocr recognition export and update lightweight model

* fix
2023-09-25 11:34:53 +08:00
xixing.tj
e7e712c5c2 add onnx exporter for ocr_detection db model
支持ocr_detection db pytorch模型转onnx
Link: https://code.alibaba-inc.com/Ali-MaaS/MaaS-lib/codereview/14117993
* add onnx exporter for ocr_detection db model

* add code for onnx convert

* fix bug
2023-09-25 11:34:28 +08:00
mulin.lyh
38ffb128c5 Merge branch 'master-github' into master-merge-github0901 2023-09-01 09:26:46 +08:00
XDUWQ
cf43991981 skip tests 2023-08-31 23:42:01 +08:00
mulin.lyh
cba4e40bc1 fix numpy pandas compatible issue
明确受影响的模型(damo):  
ONE-PEACE-4B	ModuleNotFoundError: MyCustomPipeline: MyCustomModel: No module named 'one_peace',缺少依赖。
cv_resnet50_face-reconstruction	 不兼容tf2  
nlp_automatic_post_editing_for_translation_en2de	tf2.0兼容性问题,tf1.x需要  
cv_resnet18_ocr-detection-word-level_damo	tf2.x兼容性问题  
cv_resnet18_ocr-detection-line-level_damo	tf兼容性问题  
cv_resnet101_detection_fewshot-defrcn	模型限制必须detection0.3+torch1.11.0"  
speech_dfsmn_ans_psm_48k_causal	"librosa, numpy兼容性问题  
cv_mdm_motion-generation	"依赖numpy版本兼容性问题:   File ""/opt/conda/lib/python3.8/site-packages/smplx/body_models.py"",  
cv_resnet50_ocr-detection-vlpt	numpy兼容性问题  
cv_clip-it_video-summarization_language-guided_en	tf兼容性问题

Link: https://code.alibaba-inc.com/Ali-MaaS/MaaS-lib/codereview/13744636
* numpy and pandas no version

* modify compatible issue

* fix numpy compatible issue

* modify ci

* fix lint issue

* replace Image.ANTIALIAS to Image.Resampling.LANCZOS pillow compatible

* skip uncompatible cases

* fix numpy compatible issue, skip cases that can not compatbile numpy or tensorflow2.x

* skip compatible cases

* fix clip model issue

* fix body 3d keypoints compatible issue
2023-08-22 23:04:31 +08:00
Wang Qiang
6942144ad7 Stable Diffusion model checkpoint export to onnx. (#340)
* stable diffusion export onnx

* fix pre commit bugs

* fix bugs

* safety checker support

* test export stable diffusion
2023-06-28 13:26:19 +08:00
lee.lcy
a524e01e47 feat: support onnx export for domain_specific_object_detection
Link: https://code.alibaba-inc.com/Ali-MaaS/MaaS-lib/codereview/12682688
2023-05-25 10:44:09 +08:00
bin.xue
6d68f0ea64 [to #42322933] add ONNX exporter for ans dfsmn 2023-04-28 10:33:32 +08:00
xianzhe.xxz
691443257c add onnx exporter for damoyolo
Link: https://code.alibaba-inc.com/Ali-MaaS/MaaS-lib/codereview/11889858
2023-03-07 23:01:03 +08:00
pangda
798aa93cba [to #42322933] add onnx/torchscript exporter for token classification models
Link: https://code.alibaba-inc.com/Ali-MaaS/MaaS-lib/codereview/11895085
2023-03-07 14:12:23 +08:00
yuxiang.tyx
09a178d171 support onnx export for SCRFD model
Link: https://code.alibaba-inc.com/Ali-MaaS/MaaS-lib/codereview/11826666
2023-03-01 10:02:49 +08:00
zhangzhicheng.zzc
f88b03ab72 [to #47307896] update backbone-head
The original backbone-head abstraction was not articheted well enough, the input and output parameters of backbone and head were in the form of **kwargs, which was implicit and might cause confustion. Therefore, the following adjustments were made:
原有backbone head抽象程度不够深,backbone 以及head输入输出参数为**kwargs,比较晦涩,同时很多功能无法支持扩展,因此做了如下调整:

1. Divide the basic model based on the structure to: encoder-only model, decoder-only model, single stage model, two stage model, etc., . Now, the encoder-only model was accomplished, while others are under design
2. Derive the structed task-models from the basic model structure above: a single structed task-model is mainly used to parse the backbone/head cfg, in order to apply the correct backbone or head components, some models might adjust the forward method from the basic model
3. Add the initialization parameters, input and output parameters to head class and backbone class, in order to reduce the understanding cost.
4. Remove the original nncrf class and chang it to backbone-head form with the lstm backbone and crf head.
5. Support  `model = Model.from_pretrained('bert-based-fill-mask', task='text-classification')`, this method could correctly load the backbone even when the task is different from the original one in configuration.
6. Support loading the model through the transformer's automodel, in the case of quickly integrating the backbone model without coding
7. Unifiy the original task classes in each nlp model and the structed task-model classes, the structed task-model are largely reduce the redundant codes in the original task classed. Still under refactor
8. Support load model configuration from hf transformers config.json, if the model related configuration is missing. Only suppport NLP models
2023-02-10 06:46:47 +00:00
yuze.zyz
4dca4773db Support csanmt exporting and refactor some code
1. Support csanmt exporting to savedmodel format
2. Create a new base class for text-ranking preprocessors, and move some parameters of mgeo_ranking_preprocessor to init method
3. Avoid Model & Preprocessor classes coupled with pytorch
4. Regression test supports comparing only model output
5. Support zero-shot exporting to onnx and torchscript

Link: https://code.alibaba-inc.com/Ali-MaaS/MaaS-lib/codereview/11522461
2023-02-10 05:15:04 +00:00
yuze.zyz
e6320f29d3 Small features:
1. Exporting: Support text-classification of bert and tensorflow2.0 models, test cases have been added.
2. Downloading of preprocessor.from_pretrained will ignores some large files which not needed by extension file name.
3. Move sentence-piece-preprocessor to the subclass of text-generation-preprocessor and keep the original name for compatibility.
4. Remove some useless codes in nlp-trainer and trainer.
        Link: https://code.alibaba-inc.com/Ali-MaaS/MaaS-lib/codereview/11206922
2023-01-09 21:22:07 +08:00
yuze.zyz
4b7e8e89aa [to #42322933] Fix some bugs when downgrade the version of some dependencies
1. Fix bug in model exporting
2. Skip some long trainings in test level 2
3. Refine some comments
4. Fix a bug that mode is not correct when saving checkpoints
        Link: https://code.alibaba-inc.com/Ali-MaaS/MaaS-lib/codereview/10564716
2022-10-28 21:44:33 +08:00
yuze.zyz
605cd7f44a [to #42322933] NLP 1030 Refactor
Features:
1. Refactor the directory structure of nlp models. All model files are placed into either the model folder or the task_model folder
2. Refactor all the comments to google style
3. Add detail comments to important tasks and nlp models, to list the description of the model, and its preprocessor&trainer
4. Model Exporting now supports a direct all to TorchModelExporter(no need to derive from it)
5. Refactor model save_pretrained method to support direct running(independent from trainer)
6. Remove the judgement of Model in the pipeline base class, to support outer register models running in our pipelines
7. Nlp trainer now has a NLPTrainingArguments class , user can pass arguments into the dataclass, and use it as a normal cfg_modify_fn, to simplify the operation of modify cfg.
8. Merge the BACKBONES and the MODELS, so user can get a backbone with the Model.from_pretrained call
9. Model.from_pretrained now support a task argument, so user can use a backbone and load it with a specific task class.
10. Support Preprocessor.from_pretrained method
11. Add standard return classes to important nlp tasks, so some of the pipelines and the models are independent now, the return values of the models will always be tensors, and the pipelines will take care of the conversion to numpy and the following stuffs.
12. Split the file of the nlp preprocessors, to make the dir structure more clear.

Bugs Fixing:
1. Fix a bug that lr_scheduler can be called earlier than the optimizer's step
2. Fix a bug that the direct call of Pipelines (not from pipeline(xxx)) throws error
3. Fix a bug that the trainer will not call the correct TaskDataset class
4. Fix a bug that the internal loading of dataset will throws error in the trainer class
        Link: https://code.alibaba-inc.com/Ali-MaaS/MaaS-lib/codereview/10490585
2022-10-25 12:26:25 +08:00
yuze.zyz
707cbef013 [to #42322933]Fix bug in daily UT
Link: https://code.alibaba-inc.com/Ali-MaaS/MaaS-lib/codereview/10491891
2022-10-22 23:25:18 +08:00
yuze.zyz
c2b1ff8389 [to #42322933] Add exporter module for onnx,ts and other formats.
1. Add exporter module
2. Move collate_fn out of the base pipeline class for reusing.
3. Add dummy inputs method in nlp tokenization preprocessor base class
4. Support Mapping in tensor numpify and detaching.
        Link: https://code.alibaba-inc.com/Ali-MaaS/MaaS-lib/codereview/10037704
2022-09-21 14:25:06 +08:00