Skip to content

Change to FlavaProcessor in PROCESSOR_MAPPING_NAMES#18213

Merged
ydshieh merged 1 commit intohuggingface:mainfrom
ydshieh:fix_processor_mapping_for_flava
Jul 20, 2022
Merged

Change to FlavaProcessor in PROCESSOR_MAPPING_NAMES#18213
ydshieh merged 1 commit intohuggingface:mainfrom
ydshieh:fix_processor_mapping_for_flava

Conversation

@ydshieh
Copy link
Copy Markdown
Collaborator

@ydshieh ydshieh commented Jul 20, 2022

What does this PR do?

FLAVAProcessor in PROCESSOR_MAPPING_NAMES should be FlavaProcessor.

Not getting problem when using AutoProcessor.from_pretrained, but PROCESSOR_MAPPING[FlavaConfig] will fail

Errors

from transformers import PROCESSOR_MAPPING, FlavaConfig, CLIPConfig, LayoutLMv2Config

processor_types = PROCESSOR_MAPPING[CLIPConfig]
print(processor_types)

processor_types = PROCESSOR_MAPPING[LayoutLMv2Config]
print(processor_types)

# This fails
processor_types = PROCESSOR_MAPPING[FlavaConfig]
print(processor_types)

with errors

Traceback (most recent call last):
  File "C:\Users\33611\Desktop\Project\transformers\temp.py", line 9, in <module>
    processor_types = PROCESSOR_MAPPING[FlavaConfig]
  File "C:\Users\33611\Desktop\Project\transformers\src\transformers\models\auto\auto_factory.py", line 565, in __getitem__
    return self._load_attr_from_module(model_type, model_name)
  File "C:\Users\33611\Desktop\Project\transformers\src\transformers\models\auto\auto_factory.py", line 579, in _load_attr_from_module
    return getattribute_from_module(self._modules[module_name], attr)
  File "C:\Users\33611\Desktop\Project\transformers\src\transformers\models\auto\auto_factory.py", line 539, in getattribute_from_module
    return getattribute_from_module(transformers_module, attr)
  File "C:\Users\33611\Desktop\Project\transformers\src\transformers\models\auto\auto_factory.py", line 539, in getattribute_from_module
    return getattribute_from_module(transformers_module, attr)
  File "C:\Users\33611\Desktop\Project\transformers\src\transformers\models\auto\auto_factory.py", line 539, in getattribute_from_module
    return getattribute_from_module(transformers_module, attr)
  [Previous line repeated 986 more times]
  File "C:\Users\33611\Desktop\Project\transformers\src\transformers\models\auto\auto_factory.py", line 538, in getattribute_from_module
    transformers_module = importlib.import_module("transformers")
  File "C:\Users\33611\miniconda3\envs\py39\lib\importlib\__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1004, in _find_and_load
  File "<frozen importlib._bootstrap>", line 157, in __enter__
  File "<frozen importlib._bootstrap>", line 183, in _get_module_lock
  File "<frozen importlib._bootstrap>", line 59, in __init__
RecursionError: maximum recursion depth exceeded while calling a Python object

Process finished with exit code 1

@ydshieh ydshieh requested a review from sgugger July 20, 2022 10:05
Copy link
Copy Markdown
Collaborator

@sgugger sgugger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for fixing!

@HuggingFaceDocBuilderDev
Copy link
Copy Markdown

HuggingFaceDocBuilderDev commented Jul 20, 2022

The documentation is not available anymore as the PR was closed or merged.

@ydshieh
Copy link
Copy Markdown
Collaborator Author

ydshieh commented Jul 20, 2022

Test error is unrelated - merge now

error: failed to fetch some objects from 'https://user:hf_94wBhPGp6KrrTH3KDchhKpRxZwd6dmHWLL@hub-ci.huggingface.co/__DUMMY_TRANSFORMERS_USER__/test-trainer-step.git/info/lfs

@ydshieh ydshieh merged commit bc6fe6f into huggingface:main Jul 20, 2022
@ydshieh ydshieh deleted the fix_processor_mapping_for_flava branch July 20, 2022 10:30
viclzhu pushed a commit to viclzhu/transformers that referenced this pull request Jul 20, 2022
Co-authored-by: ydshieh <ydshieh@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants