xlnet icon indicating copy to clipboard operation
xlnet copied to clipboard

TypeError: Fetch argument None has invalid type <class 'NoneType'> in train_gpu.py

Open songhee-lee opened this issue 3 years ago • 1 comments

Hi, I am trying to pre-train XLNet. I am running into Type error when running the script train_gpu.py .

...
2021-07-09 14:39:42.530225: W tensorflow/compiler/jit/mark_for_compilation_pass.cc:1412] (One-time warning): Not using XLA:CPU for cluster because envvar TF_XLA_FLAGS=--tf_xla_cpu_global_jit was not set.  If you want XLA:CPU, either set that envvar, or use experimental_jit_scope to enable XLA:CPU.  To confirm that XLA is active, pass --vmodule=xla_compilation_cache=1 (as a proper command-line flag, not via TF_XLA_FLAGS) or set the envvar XLA_FLAGS=--xla_hlo_profile.
Traceback (most recent call last):
  File "train_gpu.py", line 328, in <module>
    tf.app.run()
  File "/home/songhee/anaconda3/envs/masterbot/lib/python3.7/site-packages/tensorflow/python/platform/app.py", line 40, in run
    _run(main=main, argv=argv, flags_parser=_parse_flags_tolerate_undef)
  File "/home/songhee/anaconda3/envs/masterbot/lib/python3.7/site-packages/absl/app.py", line 312, in run
    _run_main(main, args)
  File "/home/songhee/anaconda3/envs/masterbot/lib/python3.7/site-packages/absl/app.py", line 258, in _run_main
    sys.exit(main(argv))
  File "train_gpu.py", line 324, in main
    train("/gpu:0")
  File "train_gpu.py", line 290, in train
    fetched = sess.run(fetches, feed_dict=feed_dict)
  File "/home/songhee/anaconda3/envs/masterbot/lib/python3.7/site-packages/tensorflow/python/client/session.py", line 950, in run
    run_metadata_ptr)
  File "/home/songhee/anaconda3/envs/masterbot/lib/python3.7/site-packages/tensorflow/python/client/session.py", line 1158, in _run
    self._graph, fetches, feed_dict_tensor, feed_handles=feed_handles)
  File "/home/songhee/anaconda3/envs/masterbot/lib/python3.7/site-packages/tensorflow/python/client/session.py", line 474, in __init__
    self._fetch_mapper = _FetchMapper.for_fetch(fetches)
  File "/home/songhee/anaconda3/envs/masterbot/lib/python3.7/site-packages/tensorflow/python/client/session.py", line 264, in for_fetch
    return _ListFetchMapper(fetch)
  File "/home/songhee/anaconda3/envs/masterbot/lib/python3.7/site-packages/tensorflow/python/client/session.py", line 373, in __init__
    self._mappers = [_FetchMapper.for_fetch(fetch) for fetch in fetches]
  File "/home/songhee/anaconda3/envs/masterbot/lib/python3.7/site-packages/tensorflow/python/client/session.py", line 373, in <listcomp>
    self._mappers = [_FetchMapper.for_fetch(fetch) for fetch in fetches]
  File "/home/songhee/anaconda3/envs/masterbot/lib/python3.7/site-packages/tensorflow/python/client/session.py", line 264, in for_fetch
    return _ListFetchMapper(fetch)
  File "/home/songhee/anaconda3/envs/masterbot/lib/python3.7/site-packages/tensorflow/python/client/session.py", line 373, in __init__
    self._mappers = [_FetchMapper.for_fetch(fetch) for fetch in fetches]
  File "/home/songhee/anaconda3/envs/masterbot/lib/python3.7/site-packages/tensorflow/python/client/session.py", line 373, in <listcomp>
    self._mappers = [_FetchMapper.for_fetch(fetch) for fetch in fetches]
  File "/home/songhee/anaconda3/envs/masterbot/lib/python3.7/site-packages/tensorflow/python/client/session.py", line 266, in for_fetch
    return _DictFetchMapper(fetch)
  File "/home/songhee/anaconda3/envs/masterbot/lib/python3.7/site-packages/tensorflow/python/client/session.py", line 406, in __init__
    _FetchMapper.for_fetch(fetch) for fetch in fetches.values()
  File "/home/songhee/anaconda3/envs/masterbot/lib/python3.7/site-packages/tensorflow/python/client/session.py", line 406, in <listcomp>
    _FetchMapper.for_fetch(fetch) for fetch in fetches.values()
  File "/home/songhee/anaconda3/envs/masterbot/lib/python3.7/site-packages/tensorflow/python/client/session.py", line 264, in for_fetch
    return _ListFetchMapper(fetch)
  File "/home/songhee/anaconda3/envs/masterbot/lib/python3.7/site-packages/tensorflow/python/client/session.py", line 373, in __init__
    self._mappers = [_FetchMapper.for_fetch(fetch) for fetch in fetches]
  File "/home/songhee/anaconda3/envs/masterbot/lib/python3.7/site-packages/tensorflow/python/client/session.py", line 373, in <listcomp>
    self._mappers = [_FetchMapper.for_fetch(fetch) for fetch in fetches]
  File "/home/songhee/anaconda3/envs/masterbot/lib/python3.7/site-packages/tensorflow/python/client/session.py", line 261, in for_fetch
    type(fetch)))
TypeError: Fetch argument None has invalid type <class 'NoneType'>

I think it is because that run method return None value. But I have no idea why it return None value and how to fix it.

Thanks for your help in advance.

songhee-lee avatar Jul 09 '21 08:07 songhee-lee

I ran into the same problem... Have you found a solution? @songhee-lee

juyaolongpaul avatar Dec 15 '21 03:12 juyaolongpaul