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

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

Open
songhee-lee opened this issue Jul 9, 2021 · 1 comment

Comments

@songhee-lee
Copy link

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.

@juyaolongpaul
Copy link

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

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