you can you can use tqdm_notebook pakage to do that:
for i, (train_inputs, train_labels) in tqdm_notebook(enumerate(dl), total=n):
train_inputs, train_labels = to_var(train_inputs), to_var(train_labels)