flair
flair copied to clipboard
[Bug]: AttributeError: module 'torch' has no attribute '_running_with_deploy'
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
Additional Context
No response
Environment
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
Ok, I have trained similar way, and downgrading torch! Thanks for the fast reply!
Ghivvago Damas Saraiva Jr Data Scientist at IBM NLP Researcher & Graduate Student at PPGCC-UFPI MBA in Data Analysis for BI and Big Data U.S Department of State Alumni - CCIP
On Mon, 9 Oct 2023 at 08:15 Benedikt Fuchs @.***> wrote:
Hi @GhivvagoDamas https://github.com/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
— Reply to this email directly, view it on GitHub https://github.com/flairNLP/flair/issues/3328#issuecomment-1752812281, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALOBPLSEURT4GOMMGQ5V5RTX6PMFFAVCNFSM6AAAAAA5YTHJ2SVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTONJSHAYTEMRYGE . You are receiving this because you were mentioned.Message ID: @.***>
Hi, have you solved this problem? I met the same error.
Unluckily no!