ProGamerGov / neural-style-pt

PyTorch implementation of neural style transfer algorithm
MIT License
838 stars 175 forks source link

How to reduce the batch size? #90

Open Bird-NZ opened 2 years ago

Bird-NZ commented 2 years ago

I'm wanting to reduce the batch size in order to get around the dreaded "CUDA out of memory" error. I'm wanting to do this to be able to generate much larger images as outputs at least ~10meg. I don't see an Argument for this so thought perhaps this is hard coded?

ProGamerGov commented 2 years ago

@Bird-NZ The batch size is always 1 for neural-style-pt, as batch size refers to the number of images being run through the network. You can reduce memory usage by using the Adam optimizer, and by using different models for later steps.

Maybe try the Channel Pruning model for the larger steps: https://github.com/ProGamerGov/neural-style-pt/wiki/Other-Models