hello, i am predicting on my image dataset across multiple gpus. with my dataset, the order in which the images are predicted matters. on a single GPU, the order is preserved. across multiple gpus, the order is not preserved. how may i fix this?
# load file path to saved models
files = [
Path(file.parent, file.stem)
for file
in (path/'models').iterdir()
if file.name.endswith('.pth')
]
# make predictions
predictions = []
for file in files:
print(file)
learn = learn.load(file, with_opt=False)
with learn.distrib_ctx():
prediction, _ = learn.get_preds(dl=dataset.train)
prediction = pd.Series(prediction)
prediction = prediction.map(lambda x: float(x[0]))
predictions.append(prediction)
predictions = pd.concat(predictions, axis=1, ignore_index=False)
predictions['probability'] = predictions.mean(axis=1)