MPS backend out of memory in MAC

please provide me solution anyone.

MPS backend out of memory (MPS allocated: 5.65 GB, other allocations: 492.00 KB, max allowed: 5.10 GB). Tried to allocate 500.00 MB on private pool. Use PYTORCH_MPS_HIGH_WATERMARK_RATIO=0.0 to disable upper limit for memory allocations (may cause system f

firstly run this command in notebook cell

torch.mps.set_per_process_memory_fraction(0.0)