MRFN
MRFN copied to clipboard
您好,我在尝试运行代码时出现了下面的报错,一直无法解决,不知是什么原因。
报错如下:
InvalidArgumentError Traceback (most recent call last) ~/anaconda3/lib/python3.6/site-packages/tensorflow/python/client/session.py in _do_call(self, fn, *args) 1333 try: -> 1334 return fn(*args) 1335 except errors.OpError as e:
~/anaconda3/lib/python3.6/site-packages/tensorflow/python/client/session.py in _run_fn(feed_dict, fetch_list, target_list, options, run_metadata) 1318 return self._call_tf_sessionrun( -> 1319 options, feed_dict, fetch_list, target_list, run_metadata) 1320
~/anaconda3/lib/python3.6/site-packages/tensorflow/python/client/session.py in _call_tf_sessionrun(self, options, feed_dict, fetch_list, target_list, run_metadata) 1406 self._session, options, feed_dict, fetch_list, target_list, -> 1407 run_metadata) 1408
InvalidArgumentError: Attempted create an iterator on device "/job:localhost/replica:0/task:0/device:GPU:0" from handle defined on device "/job:localhost/replica:0/task:0/device:CPU:0" [[{{node IteratorFromStringHandleV2}}]] [[{{node add_10}}]]
During handling of the above exception, another exception occurred:
InvalidArgumentError Traceback (most recent call last)
~/anaconda3/lib/python3.6/site-packages/tensorflow/python/client/session.py in run(self, fetches, feed_dict, options, run_metadata) 927 try: 928 result = self._run(None, fetches, feed_dict, options_ptr, --> 929 run_metadata_ptr) 930 if run_metadata: 931 proto_data = tf_session.TF_GetBuffer(run_metadata_ptr)
~/anaconda3/lib/python3.6/site-packages/tensorflow/python/client/session.py in _run(self, handle, fetches, feed_dict, options, run_metadata) 1150 if final_fetches or final_targets or (handle and feed_dict_tensor): 1151 results = self._do_run(handle, final_targets, final_fetches, -> 1152 feed_dict_tensor, options, run_metadata) 1153 else: 1154 results = []
~/anaconda3/lib/python3.6/site-packages/tensorflow/python/client/session.py in _do_run(self, handle, target_list, fetch_list, feed_dict, options, run_metadata) 1326 if handle is None: 1327 return self._do_call(_run_fn, feeds, fetches, targets, options, -> 1328 run_metadata) 1329 else: 1330 return self._do_call(_prun_fn, handle, feeds, fetches)
~/anaconda3/lib/python3.6/site-packages/tensorflow/python/client/session.py in _do_call(self, fn, *args) 1346 pass 1347 message = error_interpolation.interpolate(message, self._graph) -> 1348 raise type(e)(node_def, op, message) 1349 1350 def _extend_graph(self):
InvalidArgumentError: Attempted create an iterator on device "/job:localhost/replica:0/task:0/device:GPU:0" from handle defined on device "/job:localhost/replica:0/task:0/device:CPU:0"
[[node IteratorFromStringHandleV2 (defined at
Caused by op 'IteratorFromStringHandleV2', defined at:
File "/home/gong/anaconda3/lib/python3.6/runpy.py", line 193, in _run_module_as_main
"main", mod_spec)
File "/home/gong/anaconda3/lib/python3.6/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/home/gong/anaconda3/lib/python3.6/site-packages/ipykernel_launcher.py", line 16, in
InvalidArgumentError (see above for traceback): Attempted create an iterator on device "/job:localhost/replica:0/task:0/device:GPU:0" from handle defined on device "/job:localhost/replica:0/task:0/device:CPU:0"
[[node IteratorFromStringHandleV2 (defined at
您是在CPU上运行的吗?这个代码我们只在GPU上测试过哈
@chongyangtao 你好 我想知道大概需要多大的显存。
在你设置的batch_size=100下
恩 我感觉到了 100 差不多要12g的显存。 不过 内存大概最大很占用到多少? 好奇 当时的机器配置
我用机器是 1080Ti 哈,显存基本占满
我用机器是 1080Ti 哈,显存基本占满
大神 内存当时的占用大概是多少呢? 或者当时的机器配置 内存大概多大。 记得吗。 我这边跑程序需要先申请机器来分配。 我发现128g,好像你的程序会 内存OOM 掉?
内存我没太注意呢,不过应该不会超过128g呢,程序的数据读取使用的tfrecords,不会全部加载进去的
恩 跑出来结果 和大神差不多。 给大神点个👍。 Processing 1000 samples Processing 2000 samples Processing 3000 samples Processing 4000 samples Processing 5000 samples
('pred_scores: ', 500000) recall_2_1: 0.944 recall_at_1: 0.786 recall_at_2: 0.888 recall_at_5: 0.973
@chongyangtao 大神,我无论用网上找的词和字向量和训练出来的结果 还是 系统自己初始化的向量跑出来的中文结果结果 都差好多。 求大神告知下用的字向量和词向量的下载地址。
recall_2_1: 0.653 recall_at_1: 0.151 recall_at_2: 0.274 recall_at_5: 0.598
恩 跑出来结果 和大神差不多。 给大神点个👍。 Processing 1000 samples Processing 2000 samples Processing 3000 samples Processing 4000 samples Processing 5000 samples
('pred_scores: ', 500000) recall_2_1: 0.944 recall_at_1: 0.786 recall_at_2: 0.888 recall_at_5: 0.973
你好 ,我也出现了这个问题, Attempted create an iterator on device "/job:localhost/replica:0/task:0/device:GPU:0" from handle defined on device "/job:localhost/replica:0/task:0/device:CPU:0"。想问一下你是怎么解决的
@chongyangtao hi,直接跑训练脚本也出现了Attempted create an iterator on device "/job:localhost/replica:0/task:0/device:GPU:0" from handle defined on device "/job:localhost/replica:0/task:0/device:CPU:0",tf版本1.14,请问是如何解决的呢,谢谢