tensorboadでOSError: [Errno 22] Invalid argumentの対応

tensorboadでOSError: [Errno 22] Invalid argumentでエラーになった場合の対応をご紹介します。

条件

  • Windows 10 64bit
  • Python 3.7.0
  • tensorboad 1.13.1

tensorboard実行でエラー

エラー内容

tensorboardを実行したら以下のようなエラーになることがあります。
「パスの指定が間違っている」みたいな感じの内容ですが、正しいlogdirを指定しています。

>tensorboard --logdir logs
TensorBoard 1.13.1 at http://DESKTOP-2R7EC85:6006 (Press CTRL+C to quit)
Traceback (most recent call last):
  File "c:\users\user\appdata\local\programs\python\python37\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "c:\users\user\appdata\local\programs\python\python37\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Users\user\AppData\Local\Programs\Python\Python37\Scripts\tensorboard.exe\__main__.py", line 9, in <module>
  File "c:\users\user\appdata\local\programs\python\python37\lib\site-packages\tensorboard\main.py", line 57, in run_main
    app.run(tensorboard.main, flags_parser=tensorboard.configure)
  File "c:\users\user\appdata\local\programs\python\python37\lib\site-packages\absl\app.py", line 300, in run
    _run_main(main, args)
  File "c:\users\user\appdata\local\programs\python\python37\lib\site-packages\absl\app.py", line 251, in _run_main
    sys.exit(main(argv))
  File "c:\users\user\appdata\local\programs\python\python37\lib\site-packages\tensorboard\program.py", line 228, in main
    self._register_info(server)
  File "c:\users\user\appdata\local\programs\python\python37\lib\site-packages\tensorboard\program.py", line 274, in _register_info
    manager.write_info_file(info)
  File "c:\users\user\appdata\local\programs\python\python37\lib\site-packages\tensorboard\manager.py", line 269, in write_info_file
    payload = "%s\n" % _info_to_string(tensorboard_info)
  File "c:\users\user\appdata\local\programs\python\python37\lib\site-packages\tensorboard\manager.py", line 129, in _info_to_string
    for k in _TENSORBOARD_INFO_FIELDS
  File "c:\users\user\appdata\local\programs\python\python37\lib\site-packages\tensorboard\manager.py", line 129, in <dictcomp>
    for k in _TENSORBOARD_INFO_FIELDS
  File "c:\users\user\appdata\local\programs\python\python37\lib\site-packages\tensorboard\manager.py", line 51, in <lambda>
    (dt - datetime.datetime.fromtimestamp(0)).total_seconds()),
OSError: [Errno 22] Invalid argument

原因

どうやら、tensorboad 1.13.1で発生するバグのようです。

対応方法

tensorboadを「1.14.0」にアップデートします。

再実行

>tensorboard --logdir logs
TensorBoard 1.14.0 at http://DESKTOP-2R7EC85:6006/ (Press CTRL+C to quit)
I0624 11:22:34.099212 16668 _internal.py:122] ::1 - - [24/Jun/2019 11:22:34] "?[37mGET /data/runs HTTP/1.1?[0m" 200 -
I0624 11:22:34.099212  3344 _internal.py:122] ::1 - - [24/Jun/2019 11:22:34] "?[37mGET /data/environment HTTP/1.1?[0m" 200 -
I0624 11:22:34.103202 19688 _internal.py:122] ::1 - - [24/Jun/2019 11:22:34] "?[37mGET /data/experiments HTTP/1.1?[0m" 200 -
I0624 11:22:34.103202  2476 _internal.py:122] ::1 - - [24/Jun/2019 11:22:34] "?[37mGET /data/plugins_listing HTTP/1.1?[0m" 200 -
I0624 11:22:34.133121  2476 _internal.py:122] ::1 - - [24/Jun/2019 11:22:34] "?[37mGET /data/plugin/scalars/tags HTTP/1.1?[0m" 200 -
I0624 11:22:34.140129  2476 _internal.py:122] ::1 - - [24/Jun/2019 11:22:34] "?[37mGET /data/plugin/scalars/scalars?tag=acc&run=.&experiment= HTTP/1.1?[0m" 200 -
I0624 11:22:34.141100 19688 _internal.py:122] ::1 - - [24/Jun/2019 11:22:34] "?[37mGET /data/plugin/scalars/scalars?tag=loss&run=.&experiment= HTTP/1.1?[0m" 200 -

実行結果

以下のURLにアクセスして、グラフ等が表示されればOKです。

http://localhost:6006/

参考

Tensorboard: OSError: [Errno 22] Invalid argument when trying to run tensorflow from command prompt

https://stackoverflow.com/questions/55115110/tensorboard-oserror-errno-22-invalid-argument-when-trying-to-run-tensorflow

ProgrammerSought:Error when running Tensorboad 1.13.1:[Errno 22] Invalid argument

http://www.programmersought.com/article/2977784478/

コメントを残す

メールアドレスが公開されることはありません。 * が付いている欄は必須項目です