Skip to content

Saving Multi-GPU #34

@EoinKenny

Description

@EoinKenny

Thanks for this repo!

It seems like the code doesn't save the models correctly when using multiple GPUs right? Like if I train on multiple GPUs but load on a single CPU, it won't work I think.

You have this

    def save(self, path):
        states = {
            'G': self.G.state_dict(),
            'D': self.D.state_dict(),
            'optim_G': self.optim_G.state_dict(),
            'optim_D': self.optim_D.state_dict()
        }
        torch.save(states, path)

But I think you need self.G.module.state_dict() ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions