由于SimpleTransformers的导入问题,无法使用NERModel



我正在尝试使用SimpleTransformers模块参加这场比赛。

在内核中成功安装了SimpleTransformers包后,我正试图从SimpleTransformers.ner导入NERModel和NERRargs包。但我收到了如下错误消息。

**
!pip install SimpleTransformers
#(The above statement works fine.)
from simpletransformers.ner import NERModel,NERArgs
#(While executing the above statement , getting below error)
ImportError Traceback (most recent call last)
in
1 get_ipython().system('pip install --upgrade fsspec')
----> 2 from simpletransformers.ner import NERModel,NERArgs
/opt/conda/lib/python3.7/site-packages/simpletransformers/ner/init.py in
1 from simpletransformers.config.model_args import NERArgs
----> 2 from simpletransformers.ner.ner_model import NERModel
/opt/conda/lib/python3.7/site-packages/simpletransformers/ner/ner_model.py in
30 )
31 from transformers.optimization import AdamW, Adafactor
---> 32 from transformers import (
33 AlbertConfig,
34 AlbertForTokenClassification,
/opt/conda/lib/python3.7/site-packages/transformers/init.py in getattr(self, name)
2485 if name == "version":
2486 return version
-> 2487 return super().getattr(name)
2488
2489 sys.modules[name] = _LazyModule(name, _import_structure)
/opt/conda/lib/python3.7/site-packages/transformers/file_utils.py in getattr(self, name)
1698 elif name in self._class_to_module.keys():
1699 module = self._get_module(self._class_to_module[name])
-> 1700 value = getattr(module, name)
1701 else:
1702 raise AttributeError(f"module {self.name} has no attribute {name}")
/opt/conda/lib/python3.7/site-packages/transformers/file_utils.py in getattr(self, name)
1697 value = self._get_module(name)
1698 elif name in self._class_to_module.keys():
-> 1699 module = self._get_module(self._class_to_module[name])
1700 value = getattr(module, name)
1701 else:
/opt/conda/lib/python3.7/site-packages/transformers/models/auto/init.py in _get_module(self, module_name)
196
197 def _get_module(self, module_name: str):
--> 198 return importlib.import_module("." + module_name, self.name)
199
200 sys.modules[name] = _LazyModule(name, _import_structure)
/opt/conda/lib/python3.7/importlib/init.py in import_module(name, package)
125 break
126 level += 1
--> 127 return _bootstrap._gcd_import(name[level:], package, level)
128
129
/opt/conda/lib/python3.7/site-packages/transformers/models/auto/modeling_auto.py in
197 from ..pegasus.modeling_pegasus import PegasusForCausalLM, PegasusForConditionalGeneration, PegasusModel
198 from ..prophetnet.modeling_prophetnet import ProphetNetForCausalLM, ProphetNetForConditionalGeneration, ProphetNetModel
--> 199 from ..rag.modeling_rag import ( # noqa: F401 - need to import all RagModels to be in globals() function
200 RagModel,
201 RagSequenceForGeneration,
/opt/conda/lib/python3.7/site-packages/transformers/models/rag/modeling_rag.py in
27 from …utils import logging
28 from .configuration_rag import RagConfig
---> 29 from .retrieval_rag import RagRetriever
30
31
/opt/conda/lib/python3.7/site-packages/transformers/models/rag/retrieval_rag.py in
37
38 if is_datasets_available():
---> 39 from datasets import Dataset, load_dataset, load_from_disk
40
41 if is_faiss_available():
/opt/conda/lib/python3.7/site-packages/datasets/init.py in
31 )
32
---> 33 from .arrow_dataset import Dataset, concatenate_datasets
34 from .arrow_reader import ArrowReader, ReadInstruction
35 from .arrow_writer import ArrowWriter
/opt/conda/lib/python3.7/site-packages/datasets/arrow_dataset.py in
44 from .arrow_writer import ArrowWriter, OptimizedTypedSequence
45 from .features import ClassLabel, Features, Value, cast_to_python_objects
---> 46 from .filesystems import extract_path_from_uri, is_remote_filesystem
47 from .fingerprint import (
48 fingerprint_transform,
/opt/conda/lib/python3.7/site-packages/datasets/filesystems/init.py in
7
8 if _has_s3fs:
----> 9 from .s3filesystem import S3FileSystem # noqa: F401
10
11
/opt/conda/lib/python3.7/site-packages/datasets/filesystems/s3filesystem.py in
----> 1 import s3fs
2
3
4 class S3FileSystem(s3fs.S3FileSystem):
5 """
/opt/conda/lib/python3.7/site-packages/s3fs/init.py in
----> 1 from .core import S3FileSystem, S3File
2 from .mapping import S3Map
3
4 from ._version import get_versions
5
/opt/conda/lib/python3.7/site-packages/s3fs/core.py in
9
10 from fsspec.spec import AbstractBufferedFile
---> 11 from fsspec.utils import infer_storage_options, tokenize, setup_logging
12 from fsspec.asyn import AsyncFileSystem, sync, sync_wrapper
13
ImportError: cannot import name 'setup_logging' from 'fsspec.utils' (/opt/conda/lib/python3.7/site-packages/fsspec/utils.py)

这已经成为我在kaggle中的挡箭牌。同样的代码也适用于Colab。请提供建议。**

谢谢,夏姆。

fsspec==0.9.0具有fsspec.utils.setup_logging功能,但早期版本没有

尝试pip install fsspec==0.9.0

请参阅:https://githubmemory.com/repo/dask/s3fs/activity?page=3

相关内容

  • 没有找到相关文章

最新更新