Ignite: TypeError: type object got multiple values for keyword argument 'logdir'

Created on 27 May 2019  路  9Comments  路  Source: pytorch/ignite

from ignite.contrib.handlers.tensorboard_logger import TensorboardLogger
tb = TensorboardLogger(log_dir=None)

gives the following error:

self.file_writer = FileWriter(logdir=log_dir, **kwargs)

TypeError: type object got multiple values for keyword argument 'logdir'

This also happens when I run

from tensorboardX import SummaryWriter
sw = SummaryWriter(log_dir=None)

self.file_writer = FileWriter(logdir=log_dir, **kwargs)

TypeError: type object got multiple values for keyword argument 'logdir'

However, when I do don't put in logdir=log_dir, and simply pass in log_dir, it works fine.

I was looking to see if there's any conflicting reference with self or anything like that, but it doesn't seem like that's the problem, since all the self's seem to be in place, so I'm not sure.

Any ideas?

ignite version: 1.1.0
tensorboard version: 1.13.1
tensorboardX version: 1.6

enhancement help wanted

Most helpful comment

I think the problem is in self.writer = SummaryWriter(logdir=log_dir) in tensorboard_logger.py (line 408 in the class TensorboardLogger). logdir should be log_dir(since the class SummaryWriter has parameter log_dir, not logdir).

All 9 comments

Could you please detail ignite and tensorboard versions you have?

Please check out my updated question. I've included the versions.

@UltraSpecialException unfortunately, ignite latest pypi/conda version is still 0.2.0. So I suppose you mean pytorch 1.1.0. My question is whether you installed ignite from master or the latest release?

@vfdev-5 My bad, I was looking at another ignite, my pytorch-ignite is indeed 0.2.0. I installed through master.

@UltraSpecialException I can not reproduce your problem:

(test) # conda list
# packages in environment at /opt/conda/envs/test:
#
# Name                    Version                   Build  Channel
absl-py                   0.7.1                    pypi_0    pypi
blas                      1.0                         mkl
ca-certificates           2019.1.23                     0
certifi                   2019.3.9                 py36_0
cffi                      1.12.3           py36h2e261b9_0
cudatoolkit               10.0.130                      0
grpcio                    1.21.1                   pypi_0    pypi
ignite                    0.2.0                    py36_0    pytorch
intel-openmp              2019.3                      199
libedit                   3.1.20181209         hc058e9b_0
libffi                    3.2.1                hd88cf55_4
libgcc-ng                 8.2.0                hdf63c60_1
libgfortran-ng            7.3.0                hdf63c60_0
libstdcxx-ng              8.2.0                hdf63c60_1
markdown                  3.1.1                    pypi_0    pypi
mkl                       2019.3                      199
mkl_fft                   1.0.12           py36ha843d7b_0
mkl_random                1.0.2            py36hd81dba3_0
ncurses                   6.1                  he6710b0_1
ninja                     1.9.0            py36hfd86e86_0
numpy                     1.16.3           py36h7e9f1db_0
numpy-base                1.16.3           py36hde5b4d6_0
openssl                   1.1.1b               h7b6447c_1
pip                       19.1.1                   py36_0
protobuf                  3.7.1                    pypi_0    pypi
pycparser                 2.19                     py36_0
python                    3.6.8                h0371630_0
pytorch                   1.1.0           py3.6_cuda10.0.130_cudnn7.5.1_0    pytorch
readline                  7.0                  h7b6447c_5
setuptools                41.0.1                   py36_0
six                       1.12.0                   pypi_0    pypi
sqlite                    3.28.0               h7b6447c_0
tensorboard               1.13.1                   pypi_0    pypi
tensorboardx              1.6                      pypi_0    pypi
tk                        8.6.8                hbc83047_0
werkzeug                  0.15.4                   pypi_0    pypi
wheel                     0.33.4                   py36_0
xz                        5.2.4                h14c3975_4
zlib                      1.2.11               h7b6447c_3

and

python -c "from ignite.contrib.handlers.tensorboard_logger import TensorboardLogger; tb = TensorboardLogger(log_dir=None)"

Please, check your dependencies or tell me if I'm missing something.

EDIT: I see you installed pytorch-ignite from master. Thanks for reporting!

I think the problem is in self.writer = SummaryWriter(logdir=log_dir) in tensorboard_logger.py (line 408 in the class TensorboardLogger). logdir should be log_dir(since the class SummaryWriter has parameter log_dir, not logdir).

@UltraSpecialException it depends on the version of installed tensorboardX. In 1.6 it is log_dir and since 1.7 it is logdir.

I think we need handle both version for instance until 0.3.0. So we need to intercept the exception

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/opt/conda/envs/test/lib/python3.6/site-packages/ignite/contrib/handlers/tensorboard_logger.py", line 408, in __init__
    self.writer = SummaryWriter(logdir=log_dir)
  File "/opt/conda/envs/test/lib/python3.6/site-packages/tensorboardX/writer.py", line 279, in __init__
    self.file_writer = FileWriter(logdir=log_dir, **kwargs)
TypeError: type object got multiple values for keyword argument 'logdir'

and raise a warning saying to update to tensorboardX==1.7 and setup self.writer with another argument.

cc @anmolsjoshi

I had the same problem. This fixed the issue for me:.

pip uninstall pytorch-ignite
pip uninstall tensorboardX
pip install pytorch-ignite==0.2.0
pip install tensorboardX==1.6
Was this page helpful?
0 / 5 - 0 ratings