No space left on device

when I tried to load the weights of model on my device,
it is shown “no space left on device”. And when I restart the machine, this message might go.
How can I clean the cache without restarting my machine?

If you’re using torch, you can try torch.cuda.empty_cache(), and if that’s not enough, send your model to the CPU first, then empty the cache. But, if we’re being honest, I can’t ever quite get it to work the way I expect, and usually I end up restarting my kernel, as it’s the only way I know to reliably clear up GPU memory.

thanks! same with me.
I tried empty_cache() but it does not really work.

is usually the message you get from your OS when you’re out of disk space. Can you run df -h to find out?

If you’re out of disk space you can delete some cached models from ~/.cache/huggingface