asahi417 / lm-question-generation

Multilingual/multidomain question generation datasets, models, and python library for question generation.
https://www.autoqg.net
MIT License
324 stars 31 forks source link

Bug #15

Closed zhangsone closed 10 months ago

zhangsone commented 1 year ago

运行环境:Windows

运行代码 from lmqg import TransformersQG

model = TransformersQG( model="lmqg/t5-base-squad-qg", model_ae="lmqg/t5-base-squad-qg-ae" )

x = """William Turner was an English painter who specialised in watercolour landscapes. One of his best known pictures is a view of the city of Oxford from Hinksey Hill."""

model.generate_qa(x)

报错信息 Traceback (most recent call last): File "E:/Pythonworksplace/knowledge/lmqg_tools/generate.py", line 4, in model = TransformersQG( File "E:\Anaconda3\envs\knowledge\lib\site-packages\lmqg\language_model.py", line 341, in init self.spacy_module = SpacyPipeline(language) File "E:\Anaconda3\envs\knowledge\lib\site-packages\lmqg\spacy_module.py", line 35, in init self.nlp = spacy.load(model) File "E:\Anaconda3\envs\knowledge\lib\site-packages\spacy__init.py", line 50, in load return util.load_model( File "E:\Anaconda3\envs\knowledge\lib\site-packages\spacy\util.py", line 324, in load_model return load_model_from_package(name, kwargs) File "E:\Anaconda3\envs\knowledge\lib\site-packages\spacy\util.py", line 357, in load_model_from_package return cls.load(vocab=vocab, disable=disable, exclude=exclude, config=config) File "E:\Anaconda3\envs\knowledge\lib\site-packages\en_core_web_sm__init.py", line 10, in load return load_model_from_init_py(file__, overrides) File "E:\Anaconda3\envs\knowledge\lib\site-packages\spacy\util.py", line 517, in load_model_from_init_py return load_model_from_path( File "E:\Anaconda3\envs\knowledge\lib\site-packages\spacy\util.py", line 392, in load_model_from_path nlp = load_model_from_config(config, vocab=vocab, disable=disable, exclude=exclude) File "E:\Anaconda3\envs\knowledge\lib\site-packages\spacy\util.py", line 429, in load_model_from_config nlp = lang_cls.from_config( File "E:\Anaconda3\envs\knowledge\lib\site-packages\spacy\language.py", line 1672, in from_config nlp.add_pipe( File "E:\Anaconda3\envs\knowledge\lib\site-packages\spacy\language.py", line 774, in add_pipe pipe_component = self.create_pipe( File "E:\Anaconda3\envs\knowledge\lib\site-packages\spacy\language.py", line 660, in createpipe resolved = registry.resolve(cfg, validate=validate) File "E:\Anaconda3\envs\knowledge\lib\site-packages\thinc\config.py", line 746, in resolve resolved, = cls._make( File "E:\Anaconda3\envs\knowledge\lib\site-packages\thinc\config.py", line 795, in make filled, , resolved = cls._fill( File "E:\Anaconda3\envs\knowledge\lib\site-packages\thinc\config.py", line 850, in _fill filled[key], validation[v_key], final[key] = cls._fill( File "E:\Anaconda3\envs\knowledge\lib\site-packages\thinc\config.py", line 849, in _fill promise_schema = cls.make_promise_schema(value, resolve=resolve) File "E:\Anaconda3\envs\knowledge\lib\site-packages\thinc\config.py", line 1057, in make_promise_schema return create_model("ArgModel", **sig_args) File "pydantic\main.py", line 990, in pydantic.main.create_model File "pydantic\main.py", line 299, in pydantic.main.ModelMetaclass.new File "pydantic\fields.py", line 411, in pydantic.fields.ModelField.infer File "pydantic\fields.py", line 342, in pydantic.fields.ModelField.init File "pydantic\fields.py", line 451, in pydantic.fields.ModelField.prepare File "pydantic\fields.py", line 550, in pydantic.fields.ModelField._type_analysis File "E:\Anaconda3\envs\knowledge\lib\typing.py", line 774, in subclasscheck return issubclass(cls, self.origin__) TypeError: issubclass() arg 1 must be a class

I also got the same error when running trainer code; At first, I thought it was a system problem, but running it on the server couldn't solve it. Hope to get the author's answer.

asahi417 commented 1 year ago

It looks like an issue with the spacy library.

Please have a look the following link. https://stackoverflow.com/questions/77037891/typeerror-issubclass-arg-1-must-be-a-class