You can speed up the process using:

  
      
      GitHub
  
  
    

NVIDIA/DALI 1

A library containing both highly optimized building blocks and an execution engine for data pre-processing in deep learning applications - NVIDIA/DALI


  
  
    
    
  
  


or
create a data_prefetcher (follow the example here)

  
      github.com
  
  
    NVIDIA/apex/blob/master/examples/imagenet/main_amp.py 2
import argparse
import os
import shutil
import time

import torch
import torch.nn as nn
import torch.nn.parallel
import torch.backends.cudnn as cudnn
import torch.distributed as dist
import torch.optim
import torch.utils.data
import torch.utils.data.distributed
import torchvision.transforms as transforms
import torchvision.datasets as datasets
import torchvision.models as models

import numpy as np

try:


  This file has been truncated. show original

  
  
    
    
  
  


cheers.