ERROR:ModuleNotFoundError: No module named 'transformers_modules.rednote-hilab.dots'

#1
by Chienwang - opened

It caused by modeling_dots_ocr.py -> from .modeling_dots_vision import DotsVisionTransformer

The name 'dots.ocr' is conflict in loading of transformers_modules

Chienwang changed discussion status to closed

what is the solution ?

what is the solution ?

Download -> rename -> load from local

I am facing a similar issue

Traceback (most recent call last):
  File "/personal/p/dots_ocr_test/test_dots_ocr.py", line 7, in <module>
    model = AutoModelForCausalLM.from_pretrained(
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/environments/p_paddleocr/lib64/python3.11/site-packages/transformers/models/auto/auto_factory.py", line 558, in from_pretrained
    model_class = get_class_from_dynamic_module(
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/environments/p_paddleocr/lib64/python3.11/site-packages/transformers/dynamic_module_utils.py", line 570, in get_class_from_dynamic_module
    return get_class_in_module(class_name, final_module, force_reload=force_download)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/environments/p_paddleocr/lib64/python3.11/site-packages/transformers/dynamic_module_utils.py", line 267, in get_class_in_module
    module_spec.loader.exec_module(module)
  File "<frozen importlib._bootstrap_external>", line 940, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/.cache/huggingface/modules/transformers_modules/dots.ocr/modeling_dots_ocr.py", line 8, in <module>
    from .modeling_dots_vision import DotsVisionTransformer
ModuleNotFoundError: No module named 'transformers_modules.dots'

Edit: Problem solved: https://github.com/rednote-hilab/dots.ocr/issues/58

"dots.ocr" is a bad name. The char '.' is considered a module by Transformer code. Thus, we need download the repo and rename the repo to "dots_ocr". Then load this repo from local.

Sign up or log in to comment