Skip to content

Fix processors #15280

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

Closed
wants to merge 2 commits into from
Closed

Conversation

NielsRogge
Copy link
Contributor

@NielsRogge NielsRogge commented Jan 21, 2022

What does this PR do?

This PR aims to fix import checks for processors of multi-modal models, like those of LayoutLMv2, TrOCR and ViLT.

The bare minimum for a processor is PIL (assuming one creates a processor by combining a feature extractor and a slow tokenizer). If one combines a feature extractor and a fast tokenizer, both PIL and tokenizers should be available.

Questions:

  • should I also update the general init file?
  • should I add the availability to load both the slow and fast tokenizer to a processor? e.g. ViltProcessor currently only allows the fast one

To do:

@HuggingFaceDocBuilder
Copy link

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint.

Comment on lines +30 to +32
if is_sentencepiece_available():
from transformers.models.xlm_roberta.tokenization_xlm_roberta import XLMRobertaTokenizer
from transformers.models.xlm_roberta.tokenization_xlm_roberta_fast import XLMRobertaTokenizerFast
Copy link
Contributor Author

@NielsRogge NielsRogge Jan 21, 2022

Choose a reason for hiding this comment

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

We need to fix the imports of XLMRobertaTokenizer(Fast) below, as this will return an error in case sentencepiece is not available.

@LysandreJik LysandreJik self-requested a review January 21, 2022 15:16
@NielsRogge
Copy link
Contributor Author

A much better fix was provided in #15549. Therefore, closing.

@NielsRogge NielsRogge closed this Feb 14, 2022
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.

2 participants