Repository: pytorch/ignite

Issue:
progress bar output seems to be off
Soi I am using the Progressbar from the contrib module for indicating progress in the training loop. Currently the batch size is 1 for an exemplary dataset of 16 samples. 

But for some reason the progressbar seems to skip the first step and I am not sure if this is due to an issue related to my dataloading or simply a displaying problem. 

iter counter 0
Epoch [1/500]: [0/8]   0%|                                                                                                                                                                                                                                                                                                                                                           iter counter 1
Epoch [1/500]: [2/8]  25%|                                                                                                                                                                                                                                                           iter counter  2
Epoch [1/500]: [3/8]  38%|                                                                                                                                                                                                       iter counter 3
Epoch [1/500]: [4/8]  50%|                                                                                                                                                                iter counter 4
Epoch [1/500]: [5/8]  62%|                                                                                                                   iter counter 5
Epoch [1/500]: [6/8]  75%|                                                              
iter counter 6
Epoch [1/500]: [7/8]  88%|                                         
iter counter 7
Epoch [1/500]: [8/8] 100%|

is this a known problem or am I missing sth here?  the iter counter is taken from the engine _run_once_on_dataset method


Discussion:
@CDitzel I would say this is a visualization issue with our progressbar. I was able to reproduce the output:
```python
import ignite
import time
from ignite.engine import Engine, Events
from ignite.contrib.handlers import ProgressBar

print(ignite.__version__)
engine = Engine(lambda e, b: time.sleep(0.1))
@engine.on(Events.ITERATION_STARTED)
def print_iter(_):
    print("iteration: ", engine.state.iteration)

ProgressBar(persist=True).attach(engine)
engine.run(list(range(16)), max_epochs=1)
```
```
0.4.0
iteration:  1
Epoch: [0/16]   0%|                                                                                                 [00:00<?]
iteration:  2
Epoch: [2/16]  12%|███████████▌                                                                                 [00:00<00:00]
iteration:  3
Epoch: [3/16]  19%|█████████████████▎                                                                           [00:00<00:00]
iteration:  4
Epoch: [4/16]  25%|███████████████████████                                                                      [00:00<00:00]
```

Value of `engine.state.iteration` starts from 1. Progressbar should be sync with iteration on update, but obviously not in the begining. That's why we see: `0, 2, 3, 4, ...`
We can fix this, I think. Thanks for the catch!


**EDIT:**  We just need to set `initial=1` here: https://github.com/pytorch/ignite/blob/ea4bee88a75c57757b4f5f64266f13658d1b28ef/ignite/contrib/handlers/tqdm_logger.py#L118-L122
thank you for attending to this matter so quickly. Will you do the change and merge request then?
@CDitzel if you would like to send a PR with this quick change, we are very welcome :) We have https://github.com/pytorch/ignite/blob/master/CONTRIBUTING.md guide to help out.

Otherwise @ykumards can fix it
I will take a look at the weekend
Hey @CDitzel will you have time to send a PR with a fix for this issue ?

Resolving patch:
diff --git a/ignite/contrib/handlers/tqdm_logger.py b/ignite/contrib/handlers/tqdm_logger.py
--- a/ignite/contrib/handlers/tqdm_logger.py
+++ b/ignite/contrib/handlers/tqdm_logger.py
@@ -119,6 +119,7 @@ def _reset(self, pbar_total):
             total=pbar_total,
             leave=self.persist,
             bar_format=self.bar_format,
+            initial=1,
             **self.tqdm_kwargs
         )
 


Test patch:
diff --git a/tests/ignite/contrib/handlers/test_tqdm_logger.py b/tests/ignite/contrib/handlers/test_tqdm_logger.py
--- a/tests/ignite/contrib/handlers/test_tqdm_logger.py
+++ b/tests/ignite/contrib/handlers/test_tqdm_logger.py
@@ -1,4 +1,5 @@
 # -*- coding: utf-8 -*-
+import time
 import numpy as np
 import pytest
 import torch
@@ -56,6 +57,24 @@ def test_attach_fail_with_string():
         pbar.attach(engine, 'a')
 
 
+def test_pbar_batch_indeces(capsys):
+    engine = Engine(lambda e, b: time.sleep(0.1))
+    @engine.on(Events.ITERATION_STARTED)
+    def print_iter(_):
+        print("iteration: ", engine.state.iteration)
+
+    ProgressBar(persist=True).attach(engine)
+    engine.run(list(range(4)), max_epochs=1)
+
+    captured = capsys.readouterr()
+    err = captured.err.split('\r')
+    err = list(map(lambda x: x.strip(), err))
+    err = list(filter(None, err))
+    printed_batch_indeces = set(map(lambda x: int(x.split('/')[0][-1]), err))
+    expected_batch_indeces = list(range(1, 5))
+    assert sorted(list(printed_batch_indeces)) == expected_batch_indeces
+
+
 def test_pbar_with_metric(capsys):
 
     n_iters = 2