Lightning-AI/pytorch-lightning

Checkpoint do not save under multinode training mode when using Webdataset

Open

#16,893 创建于 2023年2月28日

在 GitHub 查看
 (1 评论) (0 反应) (0 负责人)Python (3,233 fork)batch import
bughelp wantedquestionrepro needed

仓库指标

Star
 (26,687 star)
PR 合并指标
 (平均合并 9天 15小时) (30 天内合并 3 个 PR)

描述

Bug description

I use webdataset with pytorch lightning. In the fact, I get a webdataset dataloader which is a IterableDataset type, and fit it into pytorch lightning trainer. It works fine under single node multi-gpu mode, but when I switch to multi-node mode. The checkpoint do not save. Anyone can help me? Thanks very much!!!!

My modelckpt config is like bellow:

    default_modelckpt_cfg = {
        'metrics_over_trainsteps_checkpoint':{
        "target": "pytorch_lightning.callbacks.ModelCheckpoint",
        "params": {
            "dirpath": ckptdir,
            "filename": "{step:09}",
            "every_n_train_steps": 50000,
            "save_top_k": -1,
        }
        },
    }

And I test in 2 nodes, per node 2 gpus, like this:

    trainer_kwargs["max_epochs"] = 2
    
    trainer_kwargs["accelerator"] = 'gpu'
    trainer_kwargs["devices"] = 2
    trainer_kwargs["strategy"] = "ddp"

Then I fit the webdataset dataloader into trainer:

trainer.fit(model, train_dataloaders=data.data['train'].dataloader)

I am so confuse why just not work when I change to multi node mode, how pytorch lightning decide to save ckpt?

贡献者指南