Information-Extraction-Chinese icon indicating copy to clipboard operation
Information-Extraction-Chinese copied to clipboard

关于test_GRU.py运行的问题

Open XWTTT opened this issue 7 years ago • 9 comments

你好!我在训练后运行test_GRU.py进行测试,但是却报出如下错误: PS D:\Information-Extraction-Chinese-master\Information-Extraction-Chinese-master\RE_BGRU_2ATT> python .\test_GRU.py 2018-02-12 11:31:16.730063: I C:\tf_jenkins\home\workspace\rel-win\M\windows\PY\36\tensorflow\core\platform\cpu_feature_guard.cc:137] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX AVX2 2018-02-12T11:48:17.277201 Evaluating all test data and save data for PR curve saving all test result... Traceback (most recent call last): File ".\test_GRU.py", line 339, in tf.app.run() File "C:\Users\a8524\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\platform\app.py", line 48, in run _sys.exit(main(_sys.argv[:1] + flags_passthrough)) File ".\test_GRU.py", line 122, in main average_precision = average_precision_score(allans, allprob) File "C:\Users\a8524\AppData\Local\Programs\Python\Python36\lib\site-packages\sklearn\metrics\ranking.py", line 188, in average_precision_score sample_weight=sample_weight) File "C:\Users\a8524\AppData\Local\Programs\Python\Python36\lib\site-packages\sklearn\metrics\base.py", line 75, in _average_binary_score return binary_metric(y_true, y_score, sample_weight=sample_weight) File "C:\Users\a8524\AppData\Local\Programs\Python\Python36\lib\site-packages\sklearn\metrics\ranking.py", line 180, in _binary_uninterpolated_average_precision y_true, y_score, sample_weight=sample_weight) File "C:\Users\a8524\AppData\Local\Programs\Python\Python36\lib\site-packages\sklearn\metrics\ranking.py", line 417, in precision_recall_curve sample_weight=sample_weight) File "C:\Users\a8524\AppData\Local\Programs\Python\Python36\lib\site-packages\sklearn\metrics\ranking.py", line 302, in _binary_clf_curve check_consistent_length(y_true, y_score) File "C:\Users\a8524\AppData\Local\Programs\Python\Python36\lib\site-packages\sklearn\utils\validation.py", line 173, in check_consistent_length " samples: %r" % [int(l) for l in lengths]) ValueError: Found input variables with inconsistent numbers of samples: [1100, 0] 还望解答!

XWTTT avatar Feb 12 '18 12:02 XWTTT

我也遇到这个问题了

jufengada avatar Jun 15 '18 10:06 jufengada

请问解决了吗?

jufengada avatar Jun 15 '18 10:06 jufengada

通过输出len(test_word),发现len(test_word)与test_settings.big_num并没有整除,所以将test_settings.big_num设置为可以将len(test_word)整除的数

主要是因为allans, allprob的shape不一致,allans在是之前预处理的不会有变化,判断只有allprob在程序中shape的改变,进而发现问题可能出现在for i in range(int(len(test_word) / float(test_settings.big_num)))这个循环中。

特别感谢你的回复!我按着你的方法试改一下~~~

------------------ 原始邮件 ------------------ 发件人: "tangtangqubeifangbupaleng"[email protected]; 发送时间: 2018年6月20日(星期三) 晚上9:23 收件人: "crownpku/Information-Extraction-Chinese"[email protected]; 抄送: "滕蔚"[email protected]; "Comment"[email protected]; 主题: Re: [crownpku/Information-Extraction-Chinese] 关于test_GRU.py运行的问题 (#27)

主要是因为allans, allprob的shape不一致,allans在是之前预处理的不会有变化,判断只有allprob在程序中shape的改变,进而发现问题可能出现在for i in range(int(len(test_word) / float(test_settings.big_num)))这个循环中。

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

jufengada avatar Jun 20 '18 13:06 jufengada

恩恩,程序顺利通过记得跟我分享啊。对了,你有做中文关系抽取这方面的语料吗

------------------ 原始邮件 ------------------ 发件人: "jufengada9"[email protected]; 发送时间: 2018年6月20日(星期三) 晚上9:25 收件人: "crownpku/Information-Extraction-Chinese"[email protected]; 抄送: "米修米修"[email protected]; "Comment"[email protected]; 主题: Re: [crownpku/Information-Extraction-Chinese] 关于test_GRU.py运行的问题 (#27)

特别感谢你的回复!我按着你的方法试改一下~~~

------------------ 原始邮件 ------------------ 发件人: "tangtangqubeifangbupaleng"[email protected]; 发送时间: 2018年6月20日(星期三) 晚上9:23 收件人: "crownpku/Information-Extraction-Chinese"[email protected]; 抄送: "滕蔚"[email protected]; "Comment"[email protected];
主题: Re: [crownpku/Information-Extraction-Chinese] 关于test_GRU.py运行的问题 (#27)

主要是因为allans, allprob的shape不一致,allans在是之前预处理的不会有变化,判断只有allprob在程序中shape的改变,进而发现问题可能出现在for i in range(int(len(test_word) / float(test_settings.big_num)))这个循环中。

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread. — You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

执行test_GRU出现这样的问题,很尴尬,哪位大神帮忙分析下,怎么解决 Testing started at 11:47 ... D:\pyEnvs\h1\Scripts\python.exe "C:\Program Files\JetBrains\PyCharm Community Edition 2018.2.4\helpers\pycharm_jb_pytest_runner.py" --path "D:/Python Indext/PDF data acquisition/Information-Extraction-Chinese-master/RE_BGRU_2ATT/test_GRU.py" Launching pytest with arguments D:/Python Indext/PDF data acquisition/Information-Extraction-Chinese-master/RE_BGRU_2ATT/test_GRU.py in D:\Python Indext\PDF data acquisition\Information-Extraction-Chinese-master\RE_BGRU_2ATT

============================= test session starts ============================= platform win32 -- Python 3.6.5, pytest-3.10.0, py-1.7.0, pluggy-0.8.0 rootdir: D:\Python Indext\PDF data acquisition\Information-Extraction-Chinese-master\RE_BGRU_2ATT, inifile:collected 0 items

============================== warnings summary =============================== D:\pyEnvs\h1\lib\site-packages\tensorflow\python\framework\ops.py:923 D:\pyEnvs\h1\lib\site-packages\tensorflow\python\framework\ops.py:923: DeprecationWarning: builtin type EagerTensor has no module attribute EagerTensor = c_api.TFE_Py_InitEagerTensor(_EagerTensorBase)

D:\pyEnvs\h1\lib\site-packages\tensorflow\python\util\tf_inspect.py:75 D:\pyEnvs\h1\lib\site-packages\tensorflow\python\util\tf_inspect.py:75: DeprecationWarning: inspect.getargspec() is deprecated, use inspect.signature() or inspect.getfullargspec() return _inspect.getargspec(target) D:\pyEnvs\h1\lib\site-packages\tensorflow\python\util\tf_inspect.py:75: DeprecationWarning: inspect.getargspec() is deprecated, use inspect.signature() or inspect.getfullargspec() return _inspect.getargspec(target) D:\pyEnvs\h1\lib\site-packages\tensorflow\python\util\tf_inspect.py:75: DeprecationWarning: inspect.getargspec() is deprecated, use inspect.signature() or inspect.getfullargspec() return _inspect.getargspec(target) D:\pyEnvs\h1\lib\site-packages\tensorflow\python\util\tf_inspect.py:75: DeprecationWarning: inspect.getargspec() is deprecated, use inspect.signature() or inspect.getfullargspec() return _inspect.getargspec(target) D:\pyEnvs\h1\lib\site-packages\tensorflow\python\util\tf_inspect.py:75: DeprecationWarning: inspect.getargspec() is deprecated, use inspect.signature() or inspect.getfullargspec() return _inspect.getargspec(target) D:\pyEnvs\h1\lib\site-packages\tensorflow\python\util\tf_inspect.py:75: DeprecationWarning: inspect.getargspec() is deprecated, use inspect.signature() or inspect.getfullargspec() return _inspect.getargspec(target) D:\pyEnvs\h1\lib\site-packages\tensorflow\python\util\tf_inspect.py:75: DeprecationWarning: inspect.getargspec() is deprecated, use inspect.signature() or inspect.getfullargspec() return _inspect.getargspec(target) D:\pyEnvs\h1\lib\site-packages\tensorflow\python\util\tf_inspect.py:75: DeprecationWarning: inspect.getargspec() is deprecated, use inspect.signature() or inspect.getfullargspec() return _inspect.getargspec(target) D:\pyEnvs\h1\lib\site-packages\tensorflow\python\util\tf_inspect.py:75: DeprecationWarning: inspect.getargspec() is deprecated, use inspect.signature() or inspect.getfullargspec() return _inspect.getargspec(target) D:\pyEnvs\h1\lib\site-packages\tensorflow\python\util\tf_inspect.py:75: DeprecationWarning: inspect.getargspec() is deprecated, use inspect.signature() or inspect.getfullargspec() return _inspect.getargspec(target) D:\pyEnvs\h1\lib\site-packages\tensorflow\python\util\tf_inspect.py:75: DeprecationWarning: inspect.getargspec() is deprecated, use inspect.signature() or inspect.getfullargspec() return _inspect.getargspec(target) D:\pyEnvs\h1\lib\site-packages\tensorflow\python\util\tf_inspect.py:75: DeprecationWarning: inspect.getargspec() is deprecated, use inspect.signature() or inspect.getfullargspec() return _inspect.getargspec(target) D:\pyEnvs\h1\lib\site-packages\tensorflow\python\util\tf_inspect.py:75: DeprecationWarning: inspect.getargspec() is deprecated, use inspect.signature() or inspect.getfullargspec() return _inspect.getargspec(target) D:\pyEnvs\h1\lib\site-packages\tensorflow\python\util\tf_inspect.py:75: DeprecationWarning: inspect.getargspec() is deprecated, use inspect.signature() or inspect.getfullargspec() return _inspect.getargspec(target) D:\pyEnvs\h1\lib\site-packages\tensorflow\python\util\tf_inspect.py:75: DeprecationWarning: inspect.getargspec() is deprecated, use inspect.signature() or inspect.getfullargspec() return _inspect.getargspec(target) D:\pyEnvs\h1\lib\site-packages\tensorflow\python\util\tf_inspect.py:75: DeprecationWarning: inspect.getargspec() is deprecated, use inspect.signature() or inspect.getfullargspec() return _inspect.getargspec(target) D:\pyEnvs\h1\lib\site-packages\tensorflow\python\util\tf_inspect.py:75: DeprecationWarning: inspect.getargspec() is deprecated, use inspect.signature() or inspect.getfullargspec() return _inspect.getargspec(target) D:\pyEnvs\h1\lib\site-packages\tensorflow\python\util\tf_inspect.py:75: DeprecationWarning: inspect.getargspec() is deprecated, use inspect.signature() or inspect.getfullargspec() return _inspect.getargspec(target) D:\pyEnvs\h1\lib\site-packages\tensorflow\python\util\tf_inspect.py:75: DeprecationWarning: inspect.getargspec() is deprecated, use inspect.signature() or inspect.getfullargspec() return _inspect.getargspec(target) D:\pyEnvs\h1\lib\site-packages\tensorflow\python\util\tf_inspect.py:75: DeprecationWarning: inspect.getargspec() is deprecated, use inspect.signature() or inspect.getfullargspec() return _inspect.getargspec(target) D:\pyEnvs\h1\lib\site-packages\tensorflow\python\util\tf_inspect.py:75: DeprecationWarning: inspect.getargspec() is deprecated, use inspect.signature() or inspect.getfullargspec() return _inspect.getargspec(target) D:\pyEnvs\h1\lib\site-packages\tensorflow\python\util\tf_inspect.py:75: DeprecationWarning: inspect.getargspec() is deprecated, use inspect.signature() or inspect.getfullargspec() return _inspect.getargspec(target) D:\pyEnvs\h1\lib\site-packages\tensorflow\python\util\tf_inspect.py:75: DeprecationWarning: inspect.getargspec() is deprecated, use inspect.signature() or inspect.getfullargspec() return _inspect.getargspec(target) D:\pyEnvs\h1\lib\site-packages\tensorflow\python\util\tf_inspect.py:75: DeprecationWarning: inspect.getargspec() is deprecated, use inspect.signature() or inspect.getfullargspec() return _inspect.getargspec(target) D:\pyEnvs\h1\lib\site-packages\tensorflow\python\util\tf_inspect.py:75: DeprecationWarning: inspect.getargspec() is deprecated, use inspect.signature() or inspect.getfullargspec() return _inspect.getargspec(target) D:\pyEnvs\h1\lib\site-packages\tensorflow\python\util\tf_inspect.py:75: DeprecationWarning: inspect.getargspec() is deprecated, use inspect.signature() or inspect.getfullargspec() return _inspect.getargspec(target) D:\pyEnvs\h1\lib\site-packages\tensorflow\python\util\tf_inspect.py:75: DeprecationWarning: inspect.getargspec() is deprecated, use inspect.signature() or inspect.getfullargspec() return _inspect.getargspec(target) D:\pyEnvs\h1\lib\site-packages\tensorflow\python\util\tf_inspect.py:75: DeprecationWarning: inspect.getargspec() is deprecated, use inspect.signature() or inspect.getfullargspec() return _inspect.getargspec(target)

-- Docs: https://docs.pytest.org/en/latest/warnings.html ========================= 29 warnings in 3.02 seconds =========================

Process finished with exit code 0 Empty test suite.

yangbin0405 avatar Nov 12 '18 04:11 yangbin0405

运行test_GRU出现以下提示就没有结果了 Launching pytest with arguments D:/Information-Extraction-Chinese-master/Information-Extraction-Chinese-master/RE_BGRU_2ATT/test_GRU.py in D:\Information-Extraction-Chinese-master\Information-Extraction-Chinese-master\RE_BGRU_2ATT

============================= test session starts ============================= platform win32 -- Python 3.6.2, pytest-4.0.1, py-1.7.0, pluggy-0.8.0 rootdir: D:\Information-Extraction-Chinese-master\Information-Extraction-Chinese-master\RE_BGRU_2ATT, inifile:collected 0 items

======================== no tests ran in 1.47 seconds =========================

18487182486 avatar Dec 11 '18 06:12 18487182486

@yangbin0405 empty test suit 这个问题好像是pycharm的问题,pycharm会检查以test开头的模块什么的,你在命令行里直接用python test_GRU.py试试

ByuWang avatar Jan 17 '20 07:01 ByuWang