MorvanZhou / NLP-Tutorials

Simple implementations of NLP models. Tutorials are written in Chinese on my website https://mofanpy.com
https://mofanpy.com
MIT License
904 stars 312 forks source link

seq2seq_attention.py报错 #37

Closed puboop closed 2 months ago

puboop commented 2 months ago

(nlp_study_3_7) D:\DATA\pycharm\NLP-Tutorials>python -V Python 3.7.16

(nlp_study_3_7) D:\DATA\pycharm\NLP-Tutorials>pip list Package Version


absl-py 2.1.0 astor 0.8.1 astunparse 1.6.3 cachetools 4.2.4 certifi 2022.12.7 chardet 3.0.4 cycler 0.11.0 gast 0.3.3 google-auth 1.35.0 google-auth-oauthlib 0.4.6 google-pasta 0.2.0 grpcio 1.62.2 h5py 2.10.0 idna 2.10 importlib-metadata 6.7.0 joblib 1.3.2 Keras-Applications 1.0.8 Keras-Preprocessing 1.1.2 kiwisolver 1.4.5 Markdown 3.4.4 MarkupSafe 2.1.5 matplotlib 3.2.1 mock 5.1.0 numpy 1.18.5 oauthlib 3.2.2 opt-einsum 3.3.0 pandas 1.0.4 tensorflow-addons 0.10.0 tensorflow-estimator 2.2.0 termcolor 2.3.0 threadpoolctl 3.1.0 typeguard 4.1.2 typing_extensions 4.7.1 urllib3 1.25.11 Werkzeug 2.2.3 wheel 0.38.4 wincertstore 0.2 wrapt 1.16.0 zipp 3.15.0

在运行seq2seq_attention.py出现报错 Traceback (most recent call last): File "D:\DATA\pycharm\NLP-Tutorials\seq2seq_attention.py", line 217, in train() File "D:\DATA\pycharm\NLP-Tutorials\seq2seq_attention.py", line 190, in train max_pred_len=11, start_token=data.start_token, end_token=data.end_token) File "D:\DATA\pycharm\NLP-Tutorials\seq2seq_attention.py", line 40, in init self.attention = tfa.seq2seq.LuongAttention(units, memory=None, memory_sequence_length=None) File "D:\INSTALL\miniconda3\envs\nlp_study_3_7\lib\site-packages\tensorflow_addons\seq2seq\attention_wrapper.py", line 573, in init probability_fn = self._process_probability_fn(self.probability_fn_name) File "D:\INSTALL\miniconda3\envs\nlp_study_3_7\lib\site-packages\typeguard_functions.py", line 253, in check_variable_assignment check_type_internal(value, annotation, memo) File "D:\INSTALL\miniconda3\envs\nlp_study_3_7\lib\site-packages\typeguard_checkers.py", line 779, in check_type_internal raise TypeCheckError(f"is not an instance of {qualified_name(origin_type)}") typeguard.TypeCheckError: value assigned to probability_fn (function) is not an instance of str

puboop commented 2 months ago

指定python版本为3.6.13