I am trying to implemen fast neural style. The training function is here
for epoch in range(args.epochs):
    for iteration, batch in enumerate(data_loader):
        x = Variable(batch[0])
        x = batch_rgb_to_bgr(x)
        if args.cuda:
            x = x.cuda()
        y_hat = model(x)
        xc = Variable(x.clone())
        optimizer.zero_grad()
        loss = loss_function(args.content_weight, args.style_weight, xc, xs, y_hat)
        loss.backward()
        optimizer.step()
        print("===> Epoch[{}]({}/{}): Loss: {:.4f}".format(epoch, iteration, len(data_loader), loss.data[0]))
    torch.save(model.state_dict(), 'model_{}.pth'.format(epoch))
torch.save(model.state_dict(), 'model.pth')

and the dataloader code
train_set = datasets.ImageFolder(args.dataset_path, transform)
data_loader = DataLoader(dataset=train_set, num_workers=args.threads, batch_size=args.batchSize, shuffle=True)