modelscope icon indicating copy to clipboard operation
modelscope copied to clipboard

ValueError: unknown url type: 'adaseg-0.6.6-py3-none-any.whl.metadata’

Open BGDSW opened this issue 2 years ago • 7 comments

当我希望使用modelscope加载模型进行推理的时候,产生了错误

我使用的命令如下:

from modelscope.pipelines import pipeline from modelscope.utils.constant import Tasks

p = pipeline(Tasks.named_entity_recognition, '/data3/huyan/liheng/tmp/AdaSeq/AdaSeq/experiments/eBay/231125005305.028950/output_best') result = p('Nike Reax TR Mesh Herren Sneaker low Turnschuhe Sportschuhe Freizeitschuhe')

print(result)

其中模型来自于使用AdaSeq训练的一个NER模型 (也是阿里开发的一个集成式模型训练包,可以在modelscope找到)

具体报错如下

2023-11-25 13:38:28,967 - modelscope - INFO - PyTorch version 2.1.1+cu118 Found. 2023-11-25 13:38:28,967 - modelscope - INFO - Loading ast index from /home/huyan/liheng/.cache/modelscope/ast_indexer 2023-11-25 13:38:29,079 - modelscope - INFO - Loading done! Current index file version is 1.9.5, with md5 c652a785900e4613e32639cfe65e325f and a total number of 945 components indexed Traceback (most recent call last): File "/data3/huyan/liheng/tmp/AdaSeq/AdaSeq/test.py", line 4, in p = pipeline(Tasks.named_entity_recognition, '/data3/huyan/liheng/tmp/AdaSeq/AdaSeq/experiments/eBay/231125005305.028950/output_best') File "/data3/huyan/liheng/conda/envs/pytorch_d/lib/python3.9/site-packages/modelscope/pipelines/builder.py", line 135, in pipeline register_plugins_repo(cfg.safe_get('plugins')) File "/data3/huyan/liheng/conda/envs/pytorch_d/lib/python3.9/site-packages/modelscope/utils/plugins.py", line 446, in register_plugins_repo module_name, module_version, _ = get_modules_from_package(plugin) File "/data3/huyan/liheng/conda/envs/pytorch_d/lib/python3.9/site-packages/modelscope/utils/plugins.py", line 736, in get_modules_from_package data = get(package, tmpdir=tmpdir) File "/data3/huyan/liheng/conda/envs/pytorch_d/lib/python3.9/site-packages/modelscope/utils/plugins.py", line 688, in get target, _headers = _download_dist(url, scratch_file, index_url, File "/data3/huyan/liheng/conda/envs/pytorch_d/lib/python3.9/site-packages/modelscope/utils/plugins.py", line 549, in _download_dist target, _headers = urlretrieve(url, scratch_file, auth=auth) File "/data3/huyan/liheng/conda/envs/pytorch_d/lib/python3.9/site-packages/modelscope/utils/plugins.py", line 504, in urlretrieve res = opener.open(url, data=data) File "/data3/huyan/liheng/conda/envs/pytorch_d/lib/python3.9/urllib/request.py", line 501, in open req = Request(fullurl, data) File "/data3/huyan/liheng/conda/envs/pytorch_d/lib/python3.9/urllib/request.py", line 320, in init self.full_url = url File "/data3/huyan/liheng/conda/envs/pytorch_d/lib/python3.9/urllib/request.py", line 346, in full_url self._parse() File "/data3/huyan/liheng/conda/envs/pytorch_d/lib/python3.9/urllib/request.py", line 375, in _parse raise ValueError("unknown url type: %r" % self.full_url) ValueError: unknown url type: 'adaseq-0.6.6-py3-none-any.whl.metadata'

环境配置 OS:Linux ubuntu 20.04 CPU:Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz

检查发现 adaseq == 0.6.6 已经成功安装

@wenmengzhou @tastelikefeet @Firmament-cyou

BGDSW avatar Nov 25 '23 05:11 BGDSW

damo/nlp_raner_named-entity-recognition_chinese-base-generic模型卡片上的微调及微调后推理没报错,modelscope1.9.5,adaseq0.6.6,transformers4.34.1,你用的模型是?

slin000111 avatar Nov 27 '23 11:11 slin000111

我使用的是U-raner,最后生成了一个output_best文件夹,具体文件如下 image 当时训练时使用的配置文件为 experiment: exp_dir: experiments/ exp_name: eBay seed: 42

task: named-entity-recognition

dataset: data_file: train: '/data3/huyan/liheng/tmp/AdaSeq/AdaSeq/dataset/eBay_4/train.txt' valid: '/data3/huyan/liheng/tmp/AdaSeq/AdaSeq/dataset/eBay_4/valid.txt' test: '/data3/huyan/liheng/tmp/AdaSeq/AdaSeq/dataset/eBay_4/test.txt' data_type: conll

preprocessor: type: sequence-labeling-preprocessor max_length: 1024 chunk_size: 256 chunk_num: 4

data_collator: SequenceLabelingDataCollatorWithPadding

model: type: sequence-labeling-model embedder: model_name_or_path: damo/nlp_raner_named-entity-recognition_multilingual-large-generic dropout: 0.1 use_crf: true chunk: true

train: max_epochs: 10 dataloader: batch_size_per_gpu: 8 optimizer: type: AdamW lr: 1.0e-5 param_groups: - regex: crf lr: 5.0e-2 options: cumulative_iters: 4 lr_scheduler: type: LinearLR start_factor: 1.0 end_factor: 0.0 total_iters: 30 hooks: - type: BestCkptSaverHook save_file_name: best_model.pth metric_key: macro-f1 save_optimizer: false restore_best: true

evaluation: dataloader: batch_size_per_gpu: 1 metrics: - type: ner-metric return_macro_f1: true - type: ner-dumper model_type: sequence_labeling dump_format: conll 当时参考的配置样例为 https://github.com/modelscope/AdaSeq/tree/master/examples/U-RaNER

BGDSW avatar Nov 28 '23 14:11 BGDSW

发现是adaseq的问题,训练结束后生成的配置文件不匹配

BGDSW avatar Nov 28 '23 18:11 BGDSW

本地测试,modelscope1.9.5,adaseq0.6.6,按damo/nlp_raner_named-entity-recognition_multilingual-large-generic模型卡片上代码微调,用微调之后的模型推理没有报错。

slin000111 avatar Dec 04 '23 09:12 slin000111

我也遇到了同样的问题,生成的配置文件不匹配,把旧的配置文件复制过去,但是输出很混乱,这个怎么解决的

wanshichenguang avatar Jan 12 '24 09:01 wanshichenguang

请问这个问题解决了嘛?

DengNingyuan avatar Mar 12 '24 13:03 DengNingyuan

damo/nlp_raner_named-entity-recognition_chinese-base-generic模型卡片上的微调及微调后推理没报错,modelscope1.9.5,adaseq0.6.6,transformers4.34.1,你用的模型是?

你好,我包的版本和你一致~

DengNingyuan avatar Mar 20 '24 08:03 DengNingyuan

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

github-actions[bot] avatar Jun 17 '24 01:06 github-actions[bot]

This issue was closed because it has been stalled for 5 days with no activity.

github-actions[bot] avatar Jun 23 '24 01:06 github-actions[bot]