#1931·CosyVoice

RAM Optimize

Author: toohandsomelongCreated Aug 9, 2026Updated Sep 12, 2026
Labelsstale

Is your feature request related to a problem? Please describe. after run

with open(hyper_yaml_path, 'r') as f:
            configs = load_hyperpyyaml(f, overrides={'qwen_pretrain_path': os.path.join(model_dir, 'CosyVoice-BlankEN')})

method init() in class CosyVoice3 in /cosyvoice/cli/cosyvoice.py RAM increased from 1.423 GB to 5.084 GB (5.879 GB peak) and it remain 5.084 GB which is wasteful

Describe the solution you'd like Clear RAM after load all model

Describe alternatives you've considered i tried in linux

import ctypes

ctypes.CDLL('libc.so.6').malloc_trim(0)

and it reduced to ~ 2GB RAM

Additional context

  • tested in .ipynb Colab/Kaggle
  • unsure behavior different from running from .py because my hardware is not enough
  • after clear ram it still able to load from configs and i have no idea how
  • please help me understand