bark icon indicating copy to clipboard operation
bark copied to clipboard

How can I change the default download location for models?

Open tomiezhang opened this issue 2 years ago • 4 comments

How can I change the default download location for models? Currently, it is set to ~/.cache/huggingface, but I want to change it to a different location. THX!!!!

tomiezhang avatar Jun 05 '23 19:06 tomiezhang

There is no setup for this. In generation.py, change

CACHE_DIR = os.path.join(os.getenv("XDG_CACHE_HOME", default_cache_dir), "suno", "bark_v0")

and add your location in your environment for XDG_CACHE_HOME @see https://github.com/suno-ai/bark#-faq for more info duplicate of https://github.com/suno-ai/bark/issues/197

stmolivier avatar Jun 09 '23 15:06 stmolivier

Set system PATH variable and reboot PC. Next dowload or prompt to HF model will check new path

keetruda69 avatar Jun 19 '23 15:06 keetruda69

Set system PATH variable and reboot PC. Next dowload or prompt to HF model will check new path

You don't need to. You can do it this way:

# DO NOT IMPORT BARK YET, FIRST THEESE LINES:
import os
os.environ["XDG_CACHE_HOME"] = os.path.join(os.getcwd(), "bark_cache") #replace this by whatever you want the cache path to be
# NOW YOU CAN IMPORT BARK HERE

at the top of your file.

Paillat-dev avatar Jun 25 '23 18:06 Paillat-dev

You can do it this way

This is awesome, thank you.

For anyone that had to download the files manually or needs to manually procure and place the files, the directory structure is

./your_script.py
./bark_cache/suno/bark_v0/*.pt
./bark_cache/suno/bark_v0/torch/hub/checkpoints/encodec_*.th

dstults avatar Aug 05 '25 15:08 dstults