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

[Bug]: AttributeError: module 'torch' has no attribute '_running_with_deploy' #3328

Open
GhivvagoDamas opened this issue Oct 9, 2023 · 4 comments
Labels
bug Something isn't working

Comments

@GhivvagoDamas
Copy link

Describe the bug

Trying to import and run some experiments in Colab with Flair, when this error raises:


AttributeError Traceback (most recent call last)
/usr/local/lib/python3.10/dist-packages/transformers/utils/import_utils.py in _get_module(self, module_name)
1281 try:
-> 1282 return importlib.import_module("." + module_name, self.name)
1283 except Exception as e:

44 frames
AttributeError: module 'torch' has no attribute '_running_with_deploy'

The above exception was the direct cause of the following exception:

RuntimeError Traceback (most recent call last)
RuntimeError: Failed to import transformers.integrations.peft because of the following error (look up to see its traceback):
module 'torch' has no attribute '_running_with_deploy'

The above exception was the direct cause of the following exception:

RuntimeError Traceback (most recent call last)
/usr/local/lib/python3.10/dist-packages/transformers/utils/import_utils.py in _get_module(self, module_name)
1282 return importlib.import_module("." + module_name, self.name)
1283 except Exception as e:
-> 1284 raise RuntimeError(
1285 f"Failed to import {self.name}.{module_name} because of the following error (look up to see its"
1286 f" traceback):\n{e}"

RuntimeError: Failed to import transformers.models.albert.modeling_albert because of the following error (look up to see its traceback):
Failed to import transformers.integrations.peft because of the following error (look up to see its traceback):
module 'torch' has no attribute '_running_with_deploy'

To Reproduce

from flair.data import Corpus
from flair.datasets import CSVClassificationCorpus
from flair.embeddings import WordEmbeddings, FlairEmbeddings, DocumentLSTMEmbeddings, TransformerWordEmbeddings,DocumentRNNEmbeddings
from flair.models import TextClassifier
from flair.trainers import ModelTrainer
from pathlib import Path

Expected behavior

Expect to load Flair in full with no problems.

Logs and Stack traces

No response

Screenshots

image

Additional Context

No response

Environment

image

@GhivvagoDamas GhivvagoDamas added the bug Something isn't working label Oct 9, 2023
@helpmefindaname
Copy link
Collaborator

Hi @GhivvagoDamas,
this looks like a bug with torch & transformers. Can you verify this by trying to run import transformers.models.albert.modeling_albert?
If that fails without any flair related code, I suggest you forward this issue to the transformers repo

@helpmefindaname helpmefindaname added the Awaiting Response Waiting for new input from the author label Oct 9, 2023
@GhivvagoDamas
Copy link
Author

GhivvagoDamas commented Oct 9, 2023 via email

@github-actions github-actions bot removed the Awaiting Response Waiting for new input from the author label Oct 9, 2023
@lllllyh01
Copy link

Hi, have you solved this problem? I met the same error.

@GhivvagoDamas
Copy link
Author

Unluckily no!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants