Ignite TypeError: 'Events' object is not callable

I get this error when I try to execute the example https://github.com/pytorch/ignite/blob/master/examples/mnist/mnist_with_tensorboardx.py

Traceback (most recent call last):
  File "/content/mnist_with_tensorboardx.py", line 130, in <module>
    args.log_interval, args.log_dir)
  File "/content/mnist_with_tensorboardx.py", line 76, in run
    @trainer.on(Events.ITERATION_COMPLETED(every=log_interval))
TypeError: 'Events' object is not callable

I’m working on google colab so I had to install some packages and I also used TensorBoard notebook extension:

!pip install --pre pytorch-ignite
!pip install 'grpcio==1.24.3'
!pip install -q tf-nightly-2.0-preview
%load_ext tensorboard 
!python /content/mnist_with_tensorboardx.py --log_dir=/tmp/tensorboard_logs
%tensorboard --logdir {/tmp/tensorboard_logs}

According to this issue https://github.com/pytorch/ignite/issues/687, the problem is solved when the latest nightly version is used however for me it’s not the case.

@Upgrade_Yourself I replied on this issue here too : https://github.com/pytorch/ignite/issues/687
Please, tell me if it works now for you.

1 Like

I haven’t yet looked at the code so I don’t know what you changed exactly but yes it works. That was a quick answer :slight_smile:

Actually, there is nothing changed in the code, except a typo introduced while previously refactored some stuff… You can see the change here too : https://github.com/pytorch/ignite/commit/8f9ca9059e3e5341527f4f6d05923508b20812f0

Glad, that it works for you now.

1 Like