Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MacOS下搭建模型的问题 #8

Closed
Fidelxyz opened this issue Apr 11, 2020 · 6 comments
Closed

MacOS下搭建模型的问题 #8

Fidelxyz opened this issue Apr 11, 2020 · 6 comments

Comments

@Fidelxyz
Copy link

Fidelxyz commented Apr 11, 2020

Python版本:3.8.2
MacOS下clone项目代码编译运行。

Sat Apr 11 15:32:39 2020 读取训练数据...
Building prefix dict from the default dictionary ...
Loading model from cache /var/folders/rf/smxg24sn2pd7945k1wjwrzf00000gn/T/jieba.cache
Loading model cost 1.216 seconds.
Prefix dict has been built successfully.
Traceback (most recent call last):
  File "/Users/xxx/Documents/GitHub/Ossas_ChatBot/main.py", line 108, in <module>
    rnn.pre_precess()
  File "/Users/xxx/Documents/GitHub/Ossas_ChatBot/Seq2Seq.py", line 288, in pre_precess
    with open(dict_path, 'w') as f:
FileNotFoundError: [Errno 2] No such file or directory: '/Users/xxx/Documents/GitHub/Ossas_ChatBot/workspace/train_data/words_dictionary.txt'

在搭建模型时,报错为无法找到words_dictionary.txt

@Dimsmary
Copy link
Owner

Dimsmary commented Apr 11, 2020

需要手动创建 .../workspace/train_data 目录

@Fidelxyz
Copy link
Author

手动创建目录后问题已解决,但构建训练模型时出现问题,报错信息如下:

Sun Apr 12 15:29:59 2020 构建训练模型...
Traceback (most recent call last):
  File "/Users/xxx/Documents/GitHub/Ossas_ChatBot/main.py", line 109, in <module>
    rnn.setup_model()
  File "/Users/xxx/Documents/GitHub/Ossas_ChatBot/Seq2Seq.py", line 134, in setup_model
    attention = Flatten()(attention)
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/tensorflow/python/keras/engine/base_layer.py", line 781, in __call__
    self._set_mask_metadata(inputs, outputs, previous_mask)
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/tensorflow/python/keras/engine/base_layer.py", line 842, in _set_mask_metadata
    output_mask = self.compute_mask(inputs, previous_mask)
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/tensorflow/python/keras/engine/base_layer.py", line 1036, in compute_mask
    raise TypeError('Layer ' + self.name + ' does not support masking, '
TypeError: Layer flatten does not support masking, but was passed an input_mask: Tensor("encoder_Embedding/NotEqual:0", shape=(?, ?), dtype=bool)

@Dimsmary
Copy link
Owner

代码当前使用的tensorflow版本为2.1.0, 在python版本为3.7下运行正常。
能否尝试更换tensorflow版本?

@Fidelxyz
Copy link
Author

更换版本后问题已解决。
Thanks!

@Fidelxyz
Copy link
Author

另外报告一个小问题:xlsxwriter也应被写进requirements.txt里。

@Dimsmary
Copy link
Owner

requirements已更新。感谢

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants