How to delete Hugging face model from cache
Tired of clutter in your Hugging Face cache? Deleting unused machine learning models can be tricky due to symlinks, but fear not! Use the `huggingface-cli` delete command to manage your cache effortlessly. Install the required package, list your models, and say goodbye to the ones you don’t need....

I have a large collection of machine learning models on my device and stored in the Hugging Face cache. Many of them I no longer need or use. However, deleting them can be tricky because the files are just shortcuts (symlinks) that point to larger binary blobs. If you try to manually delete the model directory, this could lead to a mess if not done correctly.

Luckily, Hugging Face has a delete command, and here's how you can use it.
Option 1
1. Install the Required Package
First, install the package required to manage the Hugging Face cache.
pip install -U "huggingface_hub[cli]"
2. Start the Delete Cache Command
This won't delete anything yet. It will show you a list of models to choose from. No worries!
huggingface-cli delete-cache
Depending on your models, it will look something like this.

Now, select the model you want to delete by pressing the space bar, and then press enter.
Option 2
Another way to delete a model from the cache is by running huggingface-cli scan-cache
and deleting the corresponding model folder.
And that's it—the model is deleted!