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

Error importing Bert from transformers #10

Closed
bdzyubak opened this issue Mar 13, 2024 · 2 comments
Closed

Error importing Bert from transformers #10

bdzyubak opened this issue Mar 13, 2024 · 2 comments
Assignees
Labels
bug Something isn't working enhancement New feature or request

Comments

@bdzyubak
Copy link
Owner

The following code that would be used to fine tune the Google Bert model gives an error:
from transformers import DistilBertTokenizer, DistilBertForSequenceClassification

cannot import name 'COMMON_SAFE_ASCII_CHARACTERS' from 'charset_normalizer.constant

@bdzyubak bdzyubak added the bug Something isn't working label Mar 13, 2024
@bdzyubak bdzyubak added this to the April Beta Release milestone Mar 13, 2024
@bdzyubak bdzyubak self-assigned this Mar 13, 2024
@bdzyubak bdzyubak added the enhancement New feature or request label Mar 13, 2024
@bdzyubak
Copy link
Owner Author

bdzyubak commented Mar 13, 2024

This is caused by a transformer dependency chardet not being installed. Also, the version of transformers is old 2.x instead of 4.x. Likely, another dependency of nnunet is causing the version to be reduced. Time to split off the nlp environment from nnunet!

Additionally, going to switch to yml files to control dependencies as I do not need to maintain compatibility with requirements.txt files and procedurally generate the ymls unlike in previous projects.

@bdzyubak
Copy link
Owner Author

Dependency issues resolved. Shared dependencies (like huge Pytorch) are now installed via a requirements.txt to the base environment. Separate conda envs are created with yml files. If those cannot install some of the dependencies, the run_setup_all.py script will fallback to pip.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
Development

When branches are created from issues, their pull requests are automatically linked.

1 participant