Skip to content

RAM Optimize #1931

Description

@toohandsomelong

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions