suno-ai / bark

🔊 Text-Prompted Generative Audio Model
MIT License
35.24k stars 4.13k forks source link

How can I change the default download location for models? #341

Open tomiezhang opened 1 year ago

tomiezhang commented 1 year ago

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!!!!

stmolivier commented 1 year ago

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

keetruda69 commented 1 year ago

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

Paillat-dev commented 1 year ago

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.