So, I was able to achieve deterministic training using below
seed = 1
torch.manual_seed(seed)
torch.backends.cudnn.deterministic = True
torch.backends.cudnn.benchmark = False
torch.cuda.manual_seed_all(seed) if torch.cuda.is_available() else ''
np.random.seed(seed)
os.environ['PYTHONHASHSEED'] = str(seed)
However for inference, each time I run below, I get different result
classes = ['benign', 'malignant']
data = ImageDataBunch.single_from_classes('weights', classes, ds_tfms=None, size=224).normalize(imagenet_stats)
arch_model = torchvision.models.resnet34
learn = cnn_learner(data, arch_model)
defaults.device = torch.device('cpu')
pred_class, pred_idx, outputs = learn.predict(img)
Any ideas?