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

ModuleNotFoundError: No module named 'transformers.models.mmbt' #1539

Closed
DeepakGaurAerospace opened this issue Jul 20, 2023 · 12 comments
Closed
Assignees

Comments

@DeepakGaurAerospace
Copy link

For BERT model training in Colab, I have installed following libraries:

  1. !pip install simpletransformers
  2. !pip install transformers -U (4.31.0)
  3. !pip install --upgrade tqdm (4.65.0)
  4. !pip install --upgrade simpletransformers

To Reproduce
Steps to reproduce the behavior:

import simpletransformers
from simpletransformers.classification import ClassificationModel


ModuleNotFoundError Traceback (most recent call last)
in <cell line: 1>()
----> 1 from simpletransformers.classification import ClassificationModel

1 frames
/usr/local/lib/python3.10/dist-packages/simpletransformers/classification/multi_modal_classification_model.py in
45 BertTokenizer,
46 )
---> 47 from transformers.models.mmbt.configuration_mmbt import MMBTConfig
48
49 from simpletransformers.classification.classification_utils import (

ModuleNotFoundError: No module named 'transformers.models.mmbt'


NOTE: If your import is failing due to a missing package, you can
manually install dependencies using either !pip or !apt.

To view examples of installing some common dependencies, click the
"Open Examples" button below.

Expected behavior
Previously, when I tried calling this function, it worked flawlessly, which was barely 3 days earlier.

Screenshots
image

@ctestagrose
Copy link

ctestagrose commented Jul 20, 2023

I am also having this same problem with similar steps to reproduce.

!pip install simpletransformers
from simpletransformers.classification import ClassificationModel, ClassificationArgs, MultiLabelClassificationModel, MultiLabelClassificationArgs

This results in:

ModuleNotFoundError: No module named 'transformers.models.mmbt'

I am also using Colab and had no issues two days ago.

@PeeratPookpanich
Copy link

image

I had the same issue.

@owendw1
Copy link

owendw1 commented Jul 20, 2023

Until this is fixed, the following workaround can be used (see issue #1538):

!pip install simpletransformers "transformers==4.30.2"

@PeeratPookpanich
Copy link

Until this is fixed, the following workaround can be used (see issue #1538):

!pip install simpletransformers "transformers==4.30.2"

This is work for me. Thanks !

@tugrulz
Copy link

tugrulz commented Jul 20, 2023

Same here.

@willkattrup
Copy link

This workaround worked for me. However, when trying to infer/predict using a pre-trained model, i get this error. Anybody knows what's going on here? I dire need. Thanks!

Screenshot 2023-07-21 at 3 10 29 PM

@owendw1
Copy link

owendw1 commented Jul 21, 2023

This workaround worked for me. However, when trying to infer/predict using a pre-trained model, i get this error. Anybody knows what's going on here? I dire need. Thanks!
Screenshot 2023-07-21 at 3 10 29 PM

The predict method works in the examples I've just tried. Could you share your code with us? Maybe we can work out what's happening.

@willkattrup
Copy link

Thank you

This workaround worked for me. However, when trying to infer/predict using a pre-trained model, i get this error. Anybody knows what's going on here? I dire need. Thanks!
Screenshot 2023-07-21 at 3 10 29 PM

The predict method works in the examples I've just tried. Could you share your code with us? Maybe we can work out what's happening.

Thank you so much. This is the whole code. Pretty simple, I'm loading a pre-trained model to predict. It pretty much runs through but fails at the very end. Any help would be much appreciated!
Screenshot 2023-07-21 at 7 56 11 PM

@owendw1
Copy link

owendw1 commented Jul 22, 2023

This is the whole code. Pretty simple, I'm loading a pre-trained model to predict. It pretty much runs through but fails at the very end. Any help would be much appreciated!

I can't seem to recreate the error, despite saving and loading a number of roberta based models. It's possible that there's something about the particular model being loaded that simple transformers or scipy isn't getting on with.

I notice that in the latest version of scipy (1.11.1) the default behaviour of the mode method has changed. Assuming the latest version of scipy was installed as a dependency when simple transformers was installed, maybe instead using a previous version of scipy could help. Perhaps try the following:

pip install simpletransformers "transformers==4.30.2" "scipy==1.10.1"

This is only a slight possibility though unfortunately. I think it's difficult to say for sure what the problem is without taking a look at your conda environment and saved model in detail.

@willkattrup
Copy link

This is the whole code. Pretty simple, I'm loading a pre-trained model to predict. It pretty much runs through but fails at the very end. Any help would be much appreciated!

I can't seem to recreate the error, despite saving and loading a number of roberta based models. It's possible that there's something about the particular model being loaded that simple transformers or scipy isn't getting on with.

I notice that in the latest version of scipy (1.11.1) the default behaviour of the mode method has changed. Assuming the latest version of scipy was installed as a dependency when simple transformers was installed, maybe instead using a previous version of scipy could help. Perhaps try the following:

pip install simpletransformers "transformers==4.30.2" "scipy==1.10.1"

This is only a slight possibility though unfortunately. I think it's difficult to say for sure what the problem is without taking a look at your conda environment and saved model in detail.

Installing simpletransformers with scipy1.10.1 indeed worked! Seemed like incompatibility with new scipy mode function was the issue. Thank you so much!

@ThilinaRajapakse ThilinaRajapakse self-assigned this Jul 23, 2023
@ThilinaRajapakse
Copy link
Owner

Looks like the latest version of transformers is incompatible with the current Simple Transformers version. I will look into this next week. Until then, please use the workaround suggested by @owendw1 (thanks!).

@ThilinaRajapakse
Copy link
Owner

This should be fixed now. The latest version of Simple Transformers should be compatible with the latest Transformers (as well as Python and PyTorch) versions.

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

No branches or pull requests

7 participants