Solved by vfdev-5 in post #8 
              
              
                So, complete example with ignite will be 
import torch
from torch import nn, optim
import torch.nn.functional as F
from torchtext.data import Field, BucketIterator
from torchtext.datasets import IMDB

from ignite.engine import Events, Engine, create_supervised_evaluator
from ignite.metrics import Ca…