modelscope icon indicating copy to clipboard operation
modelscope copied to clipboard

ValueError: MyCustomPipeline: Module class already registered: TrainFeed

Open Tramac opened this issue 2 years ago • 3 comments

Thanks for your error report and we appreciate it a lot.

Checklist

  • I have searched the tutorial on modelscope doc-site
  • I have searched related issues but cannot get the expected help.
  • The bug has not been fixed in the latest version.

Describe the bug 使用【人脸检测&五官定位模型

出现以下报错:

2023-10-27 14:46:00,547 - modelscope - INFO - PyTorch version 2.0.1+cu118 Found.                                                                                                                            
2023-10-27 14:46:00,553 - modelscope - INFO - TensorFlow version 2.13.0 Found.                                                                                                                              
2023-10-27 14:46:00,553 - modelscope - INFO - Loading ast index from /home/xxx/.cache/modelscope/ast_indexer                                                                                      
2023-10-27 14:46:00,938 - modelscope - INFO - No valid ast index found from /home/xxx/.cache/modelscope/ast_indexer, generating ast index from prebuilt!                                          
2023-10-27 14:46:01,512 - modelscope - INFO - Loading done! Current index file version is 1.9.3, with md5 a93e2c6be4dabf3182e4282cfc96b8cb and a total number of 943 components indexed                     
2023-10-27 14:46:14,581 - modelscope - INFO - Use user-specified model revision: v1.0.2                                                                                                                     
2023-10-27 14:46:16,539 - modelscope - WARNING - ('PIPELINES', 'face_det_lmk', 'my-custom-pipeline') not found in ast index file                                                                            
2023-10-27 14:46:16,539 - modelscope - INFO - initiate model from /home/xxx/.cache/modelscope/hub/damo/cv_face_detection_landmark                                                                 
2023-10-27 14:46:16,539 - modelscope - INFO - initiate model from location /home/xxx/.cache/modelscope/hub/damo/cv_face_detection_landmark.                                                       
2023-10-27 14:46:16,543 - modelscope - WARNING - No preprocessor field found in cfg.                                                                                                                        
2023-10-27 14:46:16,543 - modelscope - WARNING - No val key and type key found in preprocessor domain of configuration.json file.                                                                           
2023-10-27 14:46:16,543 - modelscope - WARNING - Cannot find available config to build preprocessor at mode inference, current config: {'model_dir': '/home/xxx/.cache/modelscope/hub/damo/cv_face
_detection_landmark'}. trying to build by task and model information.                                                                                                                                       
2023-10-27 14:46:16,543 - modelscope - WARNING - Find task: face_qua, model type: None. Insufficient information to build preprocessor, skip building preprocessor                                          
2023-10-27 14:46:17,463 - modelscope - INFO - Use user-specified model revision: v2.0.5                                                                                                                     
Traceback (most recent call last):                                                                                                                                                                          
  File "/python3.10/site-packages/modelscope/utils/registry.py", line 212, in build_from_cfg                                                                                
    return obj_cls(**args)                                                                                                                                                                                  
  File "/home/xxx/.cache/modelscope/modelscope_modules/cv_face_detection_landmark/ms_wrapper.py", line 58, in __init__
    self.det_func = pipeline('face_detection_repo', model='damo/face_detection_model', model_revision='v2.0.5')
  File "/python3.10/site-packages/modelscope/pipelines/builder.py", line 137, in pipeline
    register_modelhub_repo(model, cfg.get('allow_remote', False))
  File "/python3.10/site-packages/modelscope/utils/plugins.py", line 455, in register_modelhub_repo
    import_module_from_model_dir(model_dir)
  File "/python3.10/site-packages/modelscope/utils/plugins.py", line 400, in import_module_from_model_dir
    importlib.import_module(submodule)
  File "/python3.10/importlib/__init__.py", line 126, in import_module 
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 992, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 992, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/home/xxx/.cache/modelscope/modelscope_modules/face_detection_model/data/__init__.py", line 3, in <module>
    from . import data_feed
  File "/home/xxx/.cache/modelscope/modelscope_modules/face_detection_model/data/data_feed.py", line 20, in <module>
    class TrainFeed(data.Dataset):
  File "/home/xxx/.cache/modelscope/modelscope_modules/face_detection_model/core/workspace.py", line 138, in register
    raise ValueError("Module class already registered: {}".format(
ValueError: Module class already registered: TrainFeed

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "test.py", line 6, in <module>
    inference = pipeline('face_det_lmk', model='damo/cv_face_detection_landmark', model_revision='v1.0.2')
  File "/python3.10/site-packages/modelscope/pipelines/builder.py", line 163, in pipeline
    return build_pipeline(cfg, task_name=task)
  File "/python3.10/site-packages/modelscope/pipelines/builder.py", line 67, in build_pipeline
    return build_from_cfg(
  File "/python3.10/site-packages/modelscope/utils/registry.py", line 215, in build_from_cfg
    raise type(e)(f'{obj_cls.__name__}: {e}')
ValueError: MyCustomPipeline: Module class already registered: TrainFeed

To Reproduce

  • What command or script did you run?
from modelscope.models import Model
from modelscope.pipelines import pipeline
input = "https://modelscope.oss-cn-beijing.aliyuncs.com/test/images/mog_face_detection.jpg"
inference = pipeline('face_det_lmk', model='damo/cv_face_detection_landmark', model_revision='v1.0.2')
output = inference(input)
print(output.keys())

Your Environments (required)

  • OS: Ubuntu
  • CPU:
  • Commit id : modelscope == 1.9.3

Pipeline related: @Firmament-cyou @wenmengzhou

Tramac avatar Oct 27 '23 07:10 Tramac

你好,相关问题已经反馈给对应同学,请等待回复

wenmengzhou avatar Oct 30 '23 04:10 wenmengzhou

问题已修复,请重试

wenmengzhou avatar Nov 01 '23 08:11 wenmengzhou

你好,又有了新的问题

modelscope 1.14.0

image

问题已修复,请重试

xiuxiuxius avatar May 24 '24 05:05 xiuxiuxius

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 24 '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 30 '24 01:06 github-actions[bot]