目录
accelerate 多卡训练 Windows例子
gloo 多卡训练
accelerate 多卡训练 Windows例子
import torch
from torch.nn.parallel import DistributedDataParallel as DDP
from torch.utils.data import DataLoader, RandomSampler
from accelerate import Accelerator# 模拟数据集
class RandomDataset(torch.utils.data.Dataset):def __init__(self, size=100):self.data = torch.randn(size, 3)def __getitem__(self, index):re