在使用python train.py的时候 报错
rnatives. (Triggered internally at /Users/runner/work/pytorch/pytorch/pytorch/torch/csrc/tensor/python_tensor.cpp:453.)
_C._set_default_tensor_type(t)
Traceback (most recent call last):
File "/Users/wangwan/Desktop/TransformerTranslation-main/train.py", line 152, in
train_model(config)
File "/Users/wangwan/Desktop/TransformerTranslation-main/train.py", line 51, in train_model
data_loader = LoadEnglishGermanDataset(config.train_corpus_file_paths,
File "/Users/wangwan/Desktop/TransformerTranslation-main/utils/data_helpers.py", line 43, in init
self.tokenizer = tokenizer()
File "/Users/wangwan/Desktop/TransformerTranslation-main/utils/data_helpers.py", line 13, in my_tokenizer
tokenizer['de'] = get_tokenizer('spacy', language='de_core_news_sm') # 德语
File "/Users/wangwan/opt/anaconda3/lib/python3.9/site-packages/torchtext/data/utils.py", line 114, in get_tokenizer
spacy = spacy.load(language)
File "/Users/wangwan/opt/anaconda3/lib/python3.9/site-packages/spacy/init.py", line 50, in load
return util.load_model(
File "/Users/wangwan/opt/anaconda3/lib/python3.9/site-packages/spacy/util.py", line 324, in load_model
return load_model_from_package(name, kwargs)
File "/Users/wangwan/opt/anaconda3/lib/python3.9/site-packages/spacy/util.py", line 357, in load_model_from_package
return cls.load(vocab=vocab, disable=disable, exclude=exclude, config=config)
File "/Users/wangwan/opt/anaconda3/lib/python3.9/site-packages/de_core_news_sm/init.py", line 10, in load
return load_model_from_init_py(file, overrides)
File "/Users/wangwan/opt/anaconda3/lib/python3.9/site-packages/spacy/util.py", line 517, in load_model_from_init_py
return load_model_from_path(
File "/Users/wangwan/opt/anaconda3/lib/python3.9/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 "/Users/wangwan/opt/anaconda3/lib/python3.9/site-packages/spacy/util.py", line 429, in load_model_from_config
nlp = lang_cls.from_config(
File "/Users/wangwan/opt/anaconda3/lib/python3.9/site-packages/spacy/language.py", line 1672, in from_config
nlp.add_pipe(
File "/Users/wangwan/opt/anaconda3/lib/python3.9/site-packages/spacy/language.py", line 774, in add_pipe
pipe_component = self.create_pipe(
File "/Users/wangwan/opt/anaconda3/lib/python3.9/site-packages/spacy/language.py", line 660, in createpipe
resolved = registry.resolve(cfg, validate=validate)
File "/Users/wangwan/opt/anaconda3/lib/python3.9/site-packages/thinc/config.py", line 746, in resolve
resolved, = cls._make(
File "/Users/wangwan/opt/anaconda3/lib/python3.9/site-packages/thinc/config.py", line 795, in make
filled, , resolved = cls._fill(
File "/Users/wangwan/opt/anaconda3/lib/python3.9/site-packages/thinc/config.py", line 850, in _fill
filled[key], validation[v_key], final[key] = cls._fill(
File "/Users/wangwan/opt/anaconda3/lib/python3.9/site-packages/thinc/config.py", line 849, in _fill
promise_schema = cls.make_promise_schema(value, resolve=resolve)
File "/Users/wangwan/opt/anaconda3/lib/python3.9/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 "/Users/wangwan/opt/anaconda3/lib/python3.9/typing.py", line 852, in subclasscheck
return issubclass(cls, self.origin)
TypeError: issubclass() arg 1 must be a class
在使用python train.py的时候 报错 rnatives. (Triggered internally at /Users/runner/work/pytorch/pytorch/pytorch/torch/csrc/tensor/python_tensor.cpp:453.) _C._set_default_tensor_type(t) Traceback (most recent call last): File "/Users/wangwan/Desktop/TransformerTranslation-main/train.py", line 152, in
train_model(config)
File "/Users/wangwan/Desktop/TransformerTranslation-main/train.py", line 51, in train_model
data_loader = LoadEnglishGermanDataset(config.train_corpus_file_paths,
File "/Users/wangwan/Desktop/TransformerTranslation-main/utils/data_helpers.py", line 43, in init
self.tokenizer = tokenizer()
File "/Users/wangwan/Desktop/TransformerTranslation-main/utils/data_helpers.py", line 13, in my_tokenizer
tokenizer['de'] = get_tokenizer('spacy', language='de_core_news_sm') # 德语
File "/Users/wangwan/opt/anaconda3/lib/python3.9/site-packages/torchtext/data/utils.py", line 114, in get_tokenizer
spacy = spacy.load(language)
File "/Users/wangwan/opt/anaconda3/lib/python3.9/site-packages/spacy/init.py", line 50, in load
return util.load_model(
File "/Users/wangwan/opt/anaconda3/lib/python3.9/site-packages/spacy/util.py", line 324, in load_model
return load_model_from_package(name, kwargs)
File "/Users/wangwan/opt/anaconda3/lib/python3.9/site-packages/spacy/util.py", line 357, in load_model_from_package
return cls.load(vocab=vocab, disable=disable, exclude=exclude, config=config)
File "/Users/wangwan/opt/anaconda3/lib/python3.9/site-packages/de_core_news_sm/init.py", line 10, in load
return load_model_from_init_py(file, overrides)
File "/Users/wangwan/opt/anaconda3/lib/python3.9/site-packages/spacy/util.py", line 517, in load_model_from_init_py
return load_model_from_path(
File "/Users/wangwan/opt/anaconda3/lib/python3.9/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 "/Users/wangwan/opt/anaconda3/lib/python3.9/site-packages/spacy/util.py", line 429, in load_model_from_config
nlp = lang_cls.from_config(
File "/Users/wangwan/opt/anaconda3/lib/python3.9/site-packages/spacy/language.py", line 1672, in from_config
nlp.add_pipe(
File "/Users/wangwan/opt/anaconda3/lib/python3.9/site-packages/spacy/language.py", line 774, in add_pipe
pipe_component = self.create_pipe(
File "/Users/wangwan/opt/anaconda3/lib/python3.9/site-packages/spacy/language.py", line 660, in createpipe
resolved = registry.resolve(cfg, validate=validate)
File "/Users/wangwan/opt/anaconda3/lib/python3.9/site-packages/thinc/config.py", line 746, in resolve
resolved, = cls._make(
File "/Users/wangwan/opt/anaconda3/lib/python3.9/site-packages/thinc/config.py", line 795, in make
filled, , resolved = cls._fill(
File "/Users/wangwan/opt/anaconda3/lib/python3.9/site-packages/thinc/config.py", line 850, in _fill
filled[key], validation[v_key], final[key] = cls._fill(
File "/Users/wangwan/opt/anaconda3/lib/python3.9/site-packages/thinc/config.py", line 849, in _fill
promise_schema = cls.make_promise_schema(value, resolve=resolve)
File "/Users/wangwan/opt/anaconda3/lib/python3.9/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 "/Users/wangwan/opt/anaconda3/lib/python3.9/typing.py", line 852, in subclasscheck
return issubclass(cls, self.origin)
TypeError: issubclass() arg 1 must be a class