[Python]Storage location for models downloaded via from_pretrained (etc.)

This article can be read in about 2 minutes.
PR

The purpose 

When executing model test code or similar, models may be automatically downloaded from Hugging Face and then run. However, in most cases, these downloaded models are not saved in the vicinity of the executed code. (Since they are not downloaded again on subsequent runs, it’s clear they are stored locally.)

As these are models, their file sizes are large, so it’s advisable to organize them as needed.

This article will introduce the save location for these downloaded files in a Windows 11 environment.

PR

Save location

Models are saved at the following location:

C:\Users\UserName\.cache\huggingface

* UserName is user name for windows OS.

PR

Appendix

How to set the model location with from_pretrained

Set cache_dir="path" in the from_pretrained arguments. A relative path is perfectly fine for the path.

How to set the model location with hf_hub_download

Set cache_dir="path" in the hf_hub_download  arguments. A relative path is perfectly fine for the path.

comment

Copied title and URL