I have 4 gb vram but it says cuda out of memory and uses only 3.29 gb vram
With 4GB VRAM you'll need to run a lower image resolution like 384x384
512x384 will run with 4GB