Summary
SUPERTONIC_CACHE_DIR is documented as the way to override the model cache location, but it is silently ignored on the most common code path — when TTS() is constructed with a model name (which is the default behaviour, since model: str = 'supertonic-3' in the TTS.__init__ signature).
Reproduction (supertonic 1.2.3)
export SUPERTONIC_CACHE_DIR=/tmp/custom-cache
python3 -c "
from supertonic import TTS
tts = TTS(auto_download=True)
print('model_dir:', tts.model_dir)
"
Expected: model_dir: /tmp/custom-cache
Actual: model_dir: /Users/<user>/.cache/supertonic3
The env var is fully honored only if model_name=None is passed explicitly, which contradicts both the docstring of get_cache_dir() and the comment in config.py:24 that suggests the env var is the user-facing override.
Root cause
supertonic/loader.py:58-60:
if model_name is not None:
cache_dir = get_model_cache_dir(model_name) # ← hardcoded ~/.cache/{name}
else:
cache_dir = Path(DEFAULT_CACHE_DIR) # ← env-var aware
get_model_cache_dir() in config.py:77-87 is hardcoded to Path.home() / ".cache" / config["cache_dir"] regardless of SUPERTONIC_CACHE_DIR.
Suggested fix
One-liner — make get_model_cache_dir honor the env var, e.g.:
def get_model_cache_dir(model_name: str) -> Path:
config = get_model_config(model_name)
base = os.environ.get("SUPERTONIC_CACHE_DIR")
if base:
return Path(base)
return Path.home() / ".cache" / config["cache_dir"]
(Or, equivalently, make get_cache_dir() consult DEFAULT_CACHE_DIR first and fall back to get_model_cache_dir() only when the env var is unset.)
Workaround for now
Pass model_dir explicitly:
import os
from supertonic import TTS
tts = TTS(auto_download=True, model_dir=os.environ.get("SUPERTONIC_CACHE_DIR"))
Not a blocker — just a friction point for anyone redirecting caches to a non-default volume (external SSDs, network mounts, container volumes). Thanks for the great library!
Summary
SUPERTONIC_CACHE_DIRis documented as the way to override the model cache location, but it is silently ignored on the most common code path — whenTTS()is constructed with a model name (which is the default behaviour, sincemodel: str = 'supertonic-3'in theTTS.__init__signature).Reproduction (supertonic 1.2.3)
Expected:
model_dir: /tmp/custom-cacheActual:
model_dir: /Users/<user>/.cache/supertonic3The env var is fully honored only if
model_name=Noneis passed explicitly, which contradicts both the docstring ofget_cache_dir()and the comment inconfig.py:24that suggests the env var is the user-facing override.Root cause
supertonic/loader.py:58-60:get_model_cache_dir()inconfig.py:77-87is hardcoded toPath.home() / ".cache" / config["cache_dir"]regardless ofSUPERTONIC_CACHE_DIR.Suggested fix
One-liner — make
get_model_cache_dirhonor the env var, e.g.:(Or, equivalently, make
get_cache_dir()consultDEFAULT_CACHE_DIRfirst and fall back toget_model_cache_dir()only when the env var is unset.)Workaround for now
Pass
model_direxplicitly:Not a blocker — just a friction point for anyone redirecting caches to a non-default volume (external SSDs, network mounts, container volumes). Thanks for the great library!