Instead defining the volatile flag in the Variable you are now wrapping code blocks into a with torch.no_grad() block.
Your code snippet would thus change to:
with torch.no_grad():
    # evaluate network
    for (images, labels) in data_loader:
        labels = labels.squeeze_()

        preds = classifier(encoder(images))
        loss += criterion(preds, labels).item()

        pred_cls = preds.max(1)[1]
        acc += pred_cls.eq(labels).cpu().sum()

Also, don’t use the .data attribute anymore, as it might have unwanted side effects.