Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove MarkupLMForMaskedLM from MAPPING #19534

Merged
merged 1 commit into from
Oct 12, 2022

Conversation

ydshieh
Copy link
Collaborator

@ydshieh ydshieh commented Oct 12, 2022

What does this PR do?

There is no MarkupLMForMaskedLM.

BTW, could we check if the arguments passed to the recursive call are identical to the inputs: if so, don't call recursively.

def getattribute_from_module(module, attr):
if attr is None:
return None
if isinstance(attr, tuple):
return tuple(getattribute_from_module(module, a) for a in attr)
if hasattr(module, attr):
return getattr(module, attr)
# Some of the mappings have entries model_type -> object of another model type. In that case we try to grab the
# object at the top level.
transformers_module = importlib.import_module("transformers")
return getattribute_from_module(transformers_module, attr)

I can work on that if you are OK, @sgugger .

I freak out when I see

RecursionError: maximum recursion depth exceeded while calling a Python object

@ydshieh ydshieh requested review from NielsRogge and sgugger and removed request for sgugger October 12, 2022 16:01
Copy link
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!
If you have a way to show a better error message than recursion errors, by all means @ydshieh !

@HuggingFaceDocBuilderDev
Copy link

HuggingFaceDocBuilderDev commented Oct 12, 2022

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

@ydshieh ydshieh merged commit a2c90a7 into huggingface:main Oct 12, 2022
@ydshieh ydshieh deleted the remove_MarkupLMForMaskedLM branch October 12, 2022 17:21
amyeroberts pushed a commit to amyeroberts/transformers that referenced this pull request Oct 18, 2022
…uggingface#19534)

Co-authored-by: ydshieh <ydshieh@users.noreply.github.com>
kashif pushed a commit to kashif/transformers that referenced this pull request Oct 21, 2022
…uggingface#19534)

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