Skip to content

Instantly share code, notes, and snippets.

import os
import subprocess
def create_file_list(file_paths, list_file_path):
with open(list_file_path, 'w') as f:
for path in file_paths:
f.write(f"{path}\n")
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@yuvfried
yuvfried / DDP_torch.py
Last active April 15, 2025 13:29
Run a PyTorch nn.Module on multiple GPUs using DistributedDataParallel
### credits
# [PyTorch Tutorial: Getting Started with Distributed Data Parallel](https://pytorch.org/tutorials/intermediate/ddp_tutorial.html)
# [A Comprehensive Tutorial to Pytorch DistributedDataParallel](https://medium.com/codex/a-comprehensive-tutorial-to-pytorch-distributeddataparallel-1f4b42bb1b51)
# [PyTorch Forum](https://discuss.pytorch.org/t/ddp-evaluation-gather-output-loss-and-stuff-how-to/130593/2)
import os
import time
from collections import OrderedDict
import re