Nodes/ComfyUI_VoxCPM_SM/VoxCPM_SM_LoraTrainerInit
ComfyUI Node

VoxCPM_SM_LoraTrainerInit

Point It at Your Audio

By smthemex·Created 10 months ago·Updated 2 months ago· 31
VoxCPM_SM_LoraTrainerInit
    • info
    • config_path
    ◄dit▾►
    ◄vae▾►
    ◄version▾►
    ◄train_manifesttrain_data_example.jsonl►
    ◄sample_rate▾►
    ◄batch_size1►
    ◄grad_accum_steps1►
    ◄log_interval10►
    ◄valid_interval1000►
    ◄learning_rate0.0001►
    ◄weight_decay0.010►
    ◄warmup_steps100►
    ◄max_steps2000►
    ◄max_batch_tokens0►
    ◄lora_rank32►
    ◄lora_alpha16►
    ◄lora_dropout0►
    ◄enable_lmtrue►
    ◄enable_dittrue►
    ◄enable_projfalse►

    ComfyUI isn't a trainer. It's a graph renderer, and every training node inside it is a hack that makes the graph renderer train anyway. This node is the first half of that hack for VoxCPM: it doesn't train anything. It reads your dataset manifest, picks the base model, collects your hyperparameters, and writes a config file that the VoxCPM_SM_LoraTrainerLoop node then executes. Think of it as the "new training run" dialog that got split out so the actual gradient work could live in a loop.

    Why bother training at all? VoxCPM's zero-shot cloning is already good, but a LoRA makes a specific voice stick - the community reports faithful reproduction with a custom-trained LoRA. The official recipe from the README: 5–10 minutes of clean audio and roughly 2000 steps. That's a small dataset by image-LoRA standards, which makes this corner of the pack genuinely approachable.

    The one input you must get right

    train_manifest is a path to a JSONL file, and it's the difference between a working run and a confusing error. The repo ships an example at VoxCPM/examples/train_data_example.jsonl. Each line is a JSON object:

    {"audio": "examples/example.wav", "text": "This is an example audio transcript for training."}
    

    Four formats are supported - relative paths, absolute paths, and optional duration or dataset_id fields for filtering and multi-dataset runs. Two pieces of advice from the author: use absolute paths, and if you copy the path out of a text editor, strip the surrounding quotes. The node hard-errors with "Invalid train_manifest path" when the file doesn't exist, so that's the first check to clear. Windows backslashes are handled automatically, so don't sweat those.

    The rest of the form

    • dit, vae, version - the same model selection as the VoxCPM_SM_Model loader. Pick the checkpoint you want to fine-tune from.
    • sample_rate - 16000 or 44100. This is where the version difference bites: 1.5's VAE is 44.1 kHz, v2's is 16 kHz only. Match the model or training will be confused about what it's hearing.
    • learning_rate (1e-4 default), weight_decay (0.01), warmup_steps (100), max_steps (2000) - the standard optimizer block, and the defaults are sane for VoxCPM. Change the LR before you touch anything else.
    • batch_size and grad_accum_steps - batch size stays small on modest VRAM; raise grad_accum_steps to grow the effective batch without growing memory.
    • lora_rank (16–64, default 32), lora_alpha (8–64, default 16), lora_dropout - the LoRA shape. Note the cap: rank tops out at 64 in the widget, while some community experiments live at 128. If you want to go big, you'll be editing the config or settling for 64.
    • enable_lm / enable_dit / enable_proj - which sub-networks carry the LoRA. The defaults (LM and DiT on, proj off) match the official recipe; enable_proj adds the audio-projector layers, which is usually unnecessary.
    • max_batch_tokens - a token-count filter for samples; 0 disables it, which is the fine default.

    What comes out

    Two string outputs: info (a status message) and config_path - the path to a generated training_config.json that Init wrote into ComfyUI/models/loras/finetune_lora_<timestamp>/. Wire config_path straight into the Loop node's config_path input. That's the entire contract between the pair: Init writes the plan, Loop executes it. The timestamped folder means repeated Init runs won't clobber earlier training.

    Install

    Same as the rest of the pack - clone https://github.com/smthemex/ComfyUI_VoxCPM_SM into ComfyUI/custom_nodes, pip install -r requirements.txt, restart. You need a VoxCPM checkpoint and VAE in place first (the Model node page has the file layout and the rename step). The dependency stack - torch>=2.5, torchaudio, transformers, funasr, modelscope, a datasets>=3,<4 pin - is heavy, and audio-in-ComfyUI is the corner where dependency conflicts are the default failure mode, so a clean venv is the honest answer if another pack starts throwing version errors.

    One honest note the author makes himself: this training path is single-threaded and not performance-optimized - it exists so you don't have to open a separate webui. For a small voice LoRA it's perfectly fine; you'd outgrow it on serious dataset work.

    CategoryVoxCPM_SM

    Inputs (20)

    NameTypeDefaultDescription
    ditCOMBO1 options: none
    vaeCOMBO1 options: none
    versionCOMBO2 options: v2, v15
    train_manifestSTRINGtrain_data_example.jsonl—
    sample_rateCOMBO2 options: 16000, 44100
    batch_sizeINT11–1024—
    grad_accum_stepsINT11–1024—
    log_intervalINT101–1000000—
    valid_intervalINT100010–2147483647—
    learning_rateFLOAT0.00010–1—
    weight_decayFLOAT0.0100–1—
    warmup_stepsINT1001–1000000—
    max_stepsINT20001–1000000—
    max_batch_tokensINT00–2147483647—
    lora_rankINT3216–64—
    lora_alphaINT168–64—
    lora_dropoutFLOAT00–1—
    enable_lmBOOLEANtrue—
    enable_ditBOOLEANtrue—
    enable_projBOOLEANfalse—

    Outputs (2)

    NameTypeDescription
    infoSTRING—
    config_pathSTRING—