simpleT5 icon indicating copy to clipboard operation
simpleT5 copied to clipboard

ValueError: transformers.__spec__ is None

Open seregadgl20-oss opened this issue 3 years ago • 9 comments

Hi knocking out an error ValueError: transformers.spec is None

Screenshot (16)

seregadgl20-oss avatar Sep 02 '21 19:09 seregadgl20-oss

I got the same problem in colab (version simplet5-0.1.2).

Housemountain avatar Sep 03 '21 06:09 Housemountain

fixed in #13

# pip install simplet5
from simplet5 import SimpleT5
model = SimpleT5()

Thanks for pointing out

Shivanandroy avatar Sep 04 '21 05:09 Shivanandroy

I am getting the same error for version simplet5==0.1.3.

Below is the error log

ValueError Traceback (most recent call last) in () ----> 1 from simplet5 import SimpleT5 2 model = SimpleT5() 3 4 model.from_pretrained(model_type="t5", model_name="t5-base") 5 model.train(train_df=train_df[:5000],

12 frames /usr/lib/python3.7/importlib/util.py in find_spec(name, package) 112 else: 113 if spec is None: --> 114 raise ValueError('{}.spec is None'.format(name)) 115 return spec 116

ValueError: transformers.models.auto.spec is None

gangooteli avatar Jan 18 '22 05:01 gangooteli

same here even with simplet5==0.1.3 similar error comes.

ValueError Traceback (most recent call last) in () ----> 1 import simplet5

12 frames /usr/local/lib/python3.7/dist-packages/simplet5/init.py in () ----> 1 from .simplet5 import SimpleT5

/usr/local/lib/python3.7/dist-packages/simplet5/simplet5.py in () 15 from torch.utils.data import Dataset, DataLoader 16 from transformers import AutoModelWithLMHead, AutoTokenizer ---> 17 import pytorch_lightning as pl 18 from pytorch_lightning.loggers import TensorBoardLogger 19 from pytorch_lightning.callbacks import ModelCheckpoint

/usr/local/lib/python3.7/dist-packages/pytorch_lightning/init.py in () 18 _PROJECT_ROOT = os.path.dirname(_PACKAGE_ROOT) 19 ---> 20 from pytorch_lightning import metrics # noqa: E402 21 from pytorch_lightning.callbacks import Callback # noqa: E402 22 from pytorch_lightning.core import LightningDataModule, LightningModule # noqa: E402

/usr/local/lib/python3.7/dist-packages/pytorch_lightning/metrics/init.py in () 13 # limitations under the License. 14 ---> 15 from pytorch_lightning.metrics.classification import ( # noqa: F401 16 Accuracy, 17 AUC,

/usr/local/lib/python3.7/dist-packages/pytorch_lightning/metrics/classification/init.py in () 12 # See the License for the specific language governing permissions and 13 # limitations under the License. ---> 14 from pytorch_lightning.metrics.classification.accuracy import Accuracy # noqa: F401 15 from pytorch_lightning.metrics.classification.auc import AUC # noqa: F401 16 from pytorch_lightning.metrics.classification.auroc import AUROC # noqa: F401

/usr/local/lib/python3.7/dist-packages/pytorch_lightning/metrics/classification/accuracy.py in () 14 from typing import Any, Callable, Optional 15 ---> 16 from torchmetrics import Accuracy as _Accuracy 17 18 from pytorch_lightning.metrics.utils import deprecated_metrics

/usr/local/lib/python3.7/dist-packages/torchmetrics/init.py in () 12 _PROJECT_ROOT = os.path.dirname(_PACKAGE_ROOT) 13 ---> 14 from torchmetrics import functional # noqa: E402 15 from torchmetrics.aggregation import CatMetric, MaxMetric, MeanMetric, MinMetric, SumMetric # noqa: E402 16 from torchmetrics.audio import ( # noqa: E402

/usr/local/lib/python3.7/dist-packages/torchmetrics/functional/init.py in () 12 # See the License for the specific language governing permissions and 13 # limitations under the License. ---> 14 from torchmetrics.functional.audio.pit import permutation_invariant_training, pit, pit_permutate 15 from torchmetrics.functional.audio.sdr import scale_invariant_signal_distortion_ratio, sdr, signal_distortion_ratio 16 from torchmetrics.functional.audio.si_sdr import si_sdr

/usr/local/lib/python3.7/dist-packages/torchmetrics/functional/audio/init.py in () 12 # See the License for the specific language governing permissions and 13 # limitations under the License. ---> 14 from torchmetrics.functional.audio.pit import permutation_invariant_training, pit, pit_permutate # noqa: F401 15 from torchmetrics.functional.audio.sdr import ( # noqa: F401 16 scale_invariant_signal_distortion_ratio,

/usr/local/lib/python3.7/dist-packages/torchmetrics/functional/audio/pit.py in () 22 from torchmetrics.utilities import _future_warning 23 from torchmetrics.utilities.checks import _check_same_shape ---> 24 from torchmetrics.utilities.imports import _SCIPY_AVAILABLE 25 26 # _ps_dict: cache of permutations

/usr/local/lib/python3.7/dist-packages/torchmetrics/utilities/imports.py in () 89 _TORCHVISION_GREATER_EQUAL_0_8: Optional[bool] = _compare_version("torchvision", operator.ge, "0.8.0") 90 _TQDM_AVAILABLE: bool = _module_available("tqdm") ---> 91 _TRANSFORMERS_AVAILABLE: bool = _module_available("transformers") 92 _TRANSFORMERS_AUTO_AVAILABLE = _module_available("transformers.models.auto") 93 _PESQ_AVAILABLE: bool = _module_available("pesq")

/usr/local/lib/python3.7/dist-packages/torchmetrics/utilities/imports.py in _module_available(module_path) 34 """ 35 try: ---> 36 return find_spec(module_path) is not None 37 except AttributeError: 38 # Python 3.6

/usr/lib/python3.7/importlib/util.py in find_spec(name, package) 112 else: 113 if spec is None: --> 114 raise ValueError('{}.spec is None'.format(name)) 115 return spec 116

ValueError: transformers.spec is None

ultimus11 avatar Jan 18 '22 10:01 ultimus11

Same error!

DivyanshuSheth avatar Jan 19 '22 18:01 DivyanshuSheth

Same issue here. any eta on a fix?

tbetth01 avatar Jan 26 '22 15:01 tbetth01

@Shivanandroy I am struggling with the same issue here. Unable to run this library both in Colab and on local machine.

peregilk avatar Feb 02 '22 10:02 peregilk

This seem to work in colab but you have to run it after the installing simplet5. You might also have to restart the runtime.

!pip install transformers --upgrade

peregilk avatar Feb 02 '22 16:02 peregilk

This seem to work in colab but you have to run it after the installing simplet5. You might also have to restart the runtime.

!pip install transformers --upgrade

I have tried the solution proposed here and does not seem to help.

tbetth01 avatar Feb 08 '22 13:02 tbetth01