ModelScope问题之下载模型文件报错如何解决

本文涉及的产品
模型在线服务 PAI-EAS,A10/V100等 500元 1个月
模型训练 PAI-DLC,5000CU*H 3个月
交互式建模 PAI-DSW,5000CU*H 3个月
简介: ModelScope模型报错是指在使用ModelScope平台进行模型训练或部署时遇到的错误和问题;本合集将收集ModelScope模型报错的常见情况和排查方法,帮助用户快速定位问题并采取有效措施。

问题一:下载模型文件报错:TypeError: __init__() got an unexpected k


modelscope 下载模型文件报错:TypeError: init() got an unexpected keyword argument 'allowed_methods' /usr/local/lib/python3.8/dist-packages/modelscope/hub/file_download.py in http_get_file(url, local_dir, file_name, cookies, headers) 208 logger.info('downloading %s to %s', url, temp_file.name) 209 # retry sleep 0.5s, 1s, 2s, 4s --> 210 retry = Retry( 211 total=API_FILE_DOWNLOAD_RETRY_TIMES, 212 backoff_factor=1,

TypeError: init() got an unexpected keyword argument 'allowed_methods'


参考回答:

您好,应该是您这边urllib3和requests两个库版本低导致的,可以尝试更新下这两个库

pip install urllib3 --upgrade pip install requests --upgrade


关于本问题的更多回答可点击原文查看:https://developer.aliyun.com/ask/486522?spm=a2c6h.14164896.0.0.66ae508eu7VAlR


问题二:Paraformer长音频版-识别过程中报错killed


使用的Modelscope的模型是 Paraformer语音识别-中文-通用-16k-离线-large-长音频版

正常比较短的音频,可以正常识别。

使用一个较长的音频,时长10小时,大小1.3GB,结果在执行过程中报错,显示killed,不知道有解决的办法吗? 音频格式,采样率等,都是符合要求的。

日志输出如下:

2023-02-15 15:33:34,371 - modelscope - INFO - Decoding with wav files ... 2023-02-15 15:33:34,371 (asr_inference_pipeline:387) INFO: Decoding with wav files ... Killed


参考回答:

初看到你提出的问题时,1.3GB的音频文件,个人觉得应该是音频文件太大,modelscope解析超时进程自动结束了,然后去modelscope你说的这个训练模型:https://modelscope.cn/models/damo/speech_paraformer-large-vad-punc_asr_nat-zh-cn-16k-common-vocab8404-pytorch/summary 看到训练模型的整个说明文档并没有限制音频大小或者是时长,如果你的音频解析失败的话,可以现在模型的在线体验地方上传一下试试,不行的话再问一下在线技术支持当前模型支持的最大音频文件大小。

 

关于本问题的更多回答可点击原文查看:https://developer.aliyun.com/ask/485151?spm=a2c6h.14164896.0.0.66ae508eu7VAlR


问题三: ocr识别的label_dict.txt编码为utf8,windows下默认以gbk读取,导致报错


在运行时,使用ocr识别的模型damo/cv_convnextTiny_ocr-recognition-general_damo,其读取的字典文件label_dict.txt的编码为utf-8,但是在windows下默认以gbk读取,导致报错,无法进行后续推理。请问官方能否将modelscope库中以下代码 with open(label_path, 'r') as f:

修改为例如: with open(label_path, 'r', encoding='utf8') as f: 的方式,明确指定以utf-8方式读取,以便解决默认发布的模型库问题?


参考回答:

通常情况下,OCR识别的label_dict.txt文件应该使用UTF-8编码,而不是GBK编码。如果您的Windows系统默认使用GBK编码来读取该文件,可能会导致读取错误。

解决这个问题的方法是,将Windows系统的默认编码设置为UTF-8,以便正确读取label_dict.txt文件。您可以按照以下步骤进行操作:

打开“控制面板”,并选择“时间、语言和区域”。 选择“区域和语言”,然后在弹出的窗口中,选择“更改时区”按钮。 在“区域和语言设置”窗口中,选择“中文(中华人民共和国)”下的“详细信息”按钮。 在“语言区域”下,选择“英语(美国)”并单击“确定”。 现在将文件关闭,然后将标签_dict.txt复制到一个文本编辑器中,并将其保存为UTF-8编码。 再次打开Windows资源管理器,您应该能够正确读取该文件了。 如果以上方法无法解决问题,您可以尝试使用文本编辑器(如记事本)打开label_dict.txt文件,并将其另存为UTF-8编码。


关于本问题的更多回答可点击原文查看:https://developer.aliyun.com/ask/468991?spm=a2c6h.14164896.0.0.66ae508eu7VAlR


问题四:卡证检测矫正模型的示例代码报错问题四:


代码是这个链接的示例代码 https://modelscope.cn/models/damo/cv_resnet_carddetection_scrfd34gkps/quickstart 环境配置好后,运行报错如下:


参考回答:

你好,前段时间maaslib升级导致报错,目前已修复,抱歉!


关于本问题的更多回答可点击原文查看:https://developer.aliyun.com/ask/479229?spm=a2c6h.14164896.0.0.66ae508eu7VAlR


问题五: 【SPACE-T表格问答预训练模型-中文-通用领域-base】训练时使用gpu报错


将模型configuration.json里面的device设置为"cuda",运行官网提供的训练脚本,报张量不在同一设备的问题。 版本:

python                        3.8.16
modelscope                    1.3.0
torch                         1.10.0
torchaudio                    0.10.0
torchvision                   0.11.0

configuration.json:

"device": "cuda", # 只修改了这一项

log:

2023-03-17 10:33:42,503 - modelscope - INFO - PyTorch version 1.10.0 Found.
2023-03-17 10:33:42,504 - modelscope - INFO - Loading ast index from /home/xuc/.cache/modelscope/ast_indexer
2023-03-17 10:33:42,529 - modelscope - INFO - Loading done! Current index file version is 1.3.0, with md5 6087da66a93f94dc2d05987df0e603c5 and a total number of 746 components indexed
2023-03-17 10:33:44,606 - modelscope - INFO - No subset_name specified, defaulting to the default
Using custom data configuration modelscope-6e91f528cf9cd8e0
Downloading and preparing dataset ChineseText2SQL/modelscope to /home/xuc/.cache/modelscope/hub/datasets/modelscope/ChineseText2SQL/master/meta/modelscope___dataset_builder/modelscope-6e91f528cf9cd8e0/master/train_test...
Downloading data: 100%|██████████████████████████████████████████████████████████████████████| 6.79k/6.79k [00:00<00:00, 10.7MB/s]
Downloading data: 100%|██████████████████████████████████████████████████████████████████████| 1.19k/1.19k [00:00<00:00, 3.01MB/s]
Downloading data files: 100%|███████████████████████████████████████████████████████████████████████| 2/2 [00:00<00:00,  2.97it/s]
Extracting data files: 100%|███████████████████████████████████████████████████████████████████████| 2/2 [00:00<00:00, 782.30it/s]
Downloading data files: 100%|███████████████████████████████████████████████████████████████████████| 2/2 [00:01<00:00,  1.79it/s]
Extracting data files: 100%|████████████████████████████████████████████████████████████████████████| 2/2 [00:00<00:00, 17.19it/s]
Dataset chinese_text2_sql downloaded and prepared to /home/xuc/.cache/modelscope/hub/datasets/modelscope/ChineseText2SQL/master/meta/modelscope___dataset_builder/modelscope-6e91f528cf9cd8e0/master/train_test. Subsequent calls will reuse this data.
100%|██████████████████████████████████████████████████████████████████████████████████████████████| 2/2 [00:00<00:00, 772.57it/s]
size of training set 500
size of evaluation set 100
2023-03-17 10:33:47,756 - modelscope - INFO - Model revision not specified, use the latest revision: v1.0.3
2023-03-17 10:33:47,939 - modelscope - INFO - File configuration.json already in cache, skip downloading!
2023-03-17 10:33:47,939 - modelscope - INFO - File pytorch_model.bin already in cache, skip downloading!
2023-03-17 10:33:47,939 - modelscope - INFO - File README.md already in cache, skip downloading!
2023-03-17 10:33:47,939 - modelscope - INFO - File star.jpg already in cache, skip downloading!
2023-03-17 10:33:47,939 - modelscope - INFO - File star.png already in cache, skip downloading!
2023-03-17 10:33:47,940 - modelscope - INFO - File synonym.txt already in cache, skip downloading!
2023-03-17 10:33:47,940 - modelscope - INFO - File table.json already in cache, skip downloading!
2023-03-17 10:33:47,940 - modelscope - INFO - File table1.json already in cache, skip downloading!
2023-03-17 10:33:47,940 - modelscope - INFO - File table2.json already in cache, skip downloading!
2023-03-17 10:33:47,940 - modelscope - INFO - File table3.json already in cache, skip downloading!
2023-03-17 10:33:47,940 - modelscope - INFO - File table4.json already in cache, skip downloading!
2023-03-17 10:33:47,940 - modelscope - INFO - File table5.json already in cache, skip downloading!
2023-03-17 10:33:47,940 - modelscope - INFO - File vocab.txt already in cache, skip downloading!
2023-03-17 10:33:47,940 - modelscope - INFO - initialize model from /home/xuc/.cache/modelscope/hub/damo/nlp_convai_text2sql_pretrain_cn
Traceback (most recent call last):
  File "train.py", line 39, in <module>
    trainer.train(
  File "/home/xuc/.conda/envs/ms_env/lib/python3.8/site-packages/modelscope/trainers/nlp/table_question_answering_trainer.py", line 501, in train
    self.model.get_bert_output(
  File "/home/xuc/.conda/envs/ms_env/lib/python3.8/site-packages/modelscope/models/nlp/space_T_cn/table_question_answering.py", line 613, in get_bert_output
    all_encoder_layer, pooled_output = model_bert(
  File "/home/xuc/.conda/envs/ms_env/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1102, in _call_impl
    return forward_call(*input, **kwargs)
  File "/home/xuc/.conda/envs/ms_env/lib/python3.8/site-packages/modelscope/models/nlp/space_T_cn/backbone.py", line 842, in forward
    embedding_output = self.embeddings(
  File "/home/xuc/.conda/envs/ms_env/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1102, in _call_impl
    return forward_call(*input, **kwargs)
  File "/home/xuc/.conda/envs/ms_env/lib/python3.8/site-packages/modelscope/models/nlp/space_T_cn/backbone.py", line 115, in forward
    words_embeddings = self.word_embeddings(input_ids)
  File "/home/xuc/.conda/envs/ms_env/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1102, in _call_impl
    return forward_call(*input, **kwargs)
  File "/home/xuc/.conda/envs/ms_env/lib/python3.8/site-packages/torch/nn/modules/sparse.py", line 158, in forward
    return F.embedding(
  File "/home/xuc/.conda/envs/ms_env/lib/python3.8/site-packages/torch/nn/functional.py", line 2044, in embedding
    return torch.embedding(weight, input, padding_idx, scale_grad_by_freq, sparse)
RuntimeError: Expected all tensors to be on the same device, but found at least two devices, cpu and cuda:0! (when checking argument for argument index in method wrapper__index_select)


关于本问题的更多回答可点击原文查看:https://developer.aliyun.com/ask/491734?spm=a2c6h.14164896.0.0.66ae508eu7VAlR

相关文章
|
2月前
|
人工智能 开发框架 物联网
赢万元奖金 | 第七届CCF开源创新大赛ModelScope开源模型应用挑战赛开启报名!
第七届CCF开源创新大赛(后简称“大赛”) 由中国计算机学会(CCF)主办,长沙理工大学、CCF开源发展委员会联合承办。
|
4月前
|
人工智能 开发工具 Swift
ModelScope联手OpenDataLab:直接调用7000+开源数据集,赋能AI模型加速研发
魔搭社区和OpenDatalab浦数合作,共同开启一场模型与数据的深度融合,旨在为中国开发者打造更加高效、开放的AI体验。
|
5月前
|
机器学习/深度学习 人工智能 Swift
PAI x ModelScope: 在PAI使用ModelScope模型
在当前的人工智能领域,特别是大语言模型、文生图等领域,基于预训练模型完成机器学习模型的开发部署已成为重要的应用范式,开发者们依赖于这些先进的开源预训练模型,以简化机器学习应用的开发并加速创新。
|
5月前
|
自然语言处理
在ModelScope中,你可以通过设置模型的参数来控制输出的阈值
在ModelScope中,你可以通过设置模型的参数来控制输出的阈值
116 1
|
5月前
|
API 语音技术
ModelScope-FunASR**有支持热词又支持时间戳的模型**。
【2月更文挑战第30天】ModelScope-FunASR**有支持热词又支持时间戳的模型**。
186 2
|
5月前
|
人工智能 API 决策智能
Modelscope结合α-UMi:基于Modelscope的多模型协作Agent
基于单个开源小模型的工具调用Agent,由于模型容量和预训练能力获取的限制,无法在推理和规划、工具调用、回复生成等任务上同时获得比肩大模型等性能。
|
5月前
|
数据采集 自然语言处理 搜索推荐
ModelScope问题之模型encoder配置报错如何解决
ModelScope模型报错是指在使用ModelScope平台进行模型训练或部署时遇到的错误和问题;本合集将收集ModelScope模型报错的常见情况和排查方法,帮助用户快速定位问题并采取有效措施。
201 0
|
5月前
|
人工智能 达摩院 自然语言处理
超好用的开源模型平台,ModelScope阿里达摩院
超好用的开源模型平台,ModelScope阿里达摩院
351 1
|
5月前
|
API
使用ModelScope平台进行模型验证时
【2月更文挑战第9天】使用ModelScope平台进行模型验证时
136 4
|
5月前
|
人工智能 自然语言处理 搜索推荐
魔搭ModelScope社区作为一个AI模型开源平台,提供了丰富的模型资源和便捷的服务
【2月更文挑战第9天】魔搭ModelScope社区作为一个AI模型开源平台,提供了丰富的模型资源和便捷的服务
404 3
下一篇
无影云桌面