emo4 scale-up wrapper: DailyTalk 500 + emo4 prep (clean-filtered), warm-start from EMO3 via peft loader (_ilu2/_sys2 fixed), 1600 steps, push emo4/
c53292c verified Download emo4_train_wrapper.sh from ACloudCenter/fast-vibevoice-notes: direct link, hf CLI and curl.
- Browser
- Download file 7.04 kB
-
https://huggingface.co/datasets/ACloudCenter/fast-vibevoice-notes/resolve/main/emo4_train_wrapper.sh
- Command line
-
hf download hf://datasets/ACloudCenter/fast-vibevoice-notes/emo4_train_wrapper.sh
-
curl -L -o emo4_train_wrapper.sh https://huggingface.co/datasets/ACloudCenter/fast-vibevoice-notes/resolve/main/emo4_train_wrapper.sh
7.04 kB
| set -e | |
| export PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True | |
| echo '== SETUP ==' | |
| apt-get update -qq && apt-get install -y -qq git build-essential ffmpeg >/dev/null 2>&1 | |
| git clone -q https://github.com/vibevoice-community/VibeVoice /VibeVoice-classic | |
| git -C /VibeVoice-classic checkout -q d5895e7 | |
| git clone -q https://github.com/vibevoice-community/VibeVoice /vv-main | |
| git clone -q https://github.com/voicepowered-ai/VibeVoice-finetuning /vvft | |
| cd /vvft && pip install -q -e . 2>&1 | tail -1 | |
| pip uninstall -y -q transformers 2>&1 | tail -1 | |
| pip install -q 'setuptools<81' 'torch==2.6.0' 'transformers==4.51.3' 'peft==0.15.2' 'diffusers==0.29.0' 'safetensors==0.5.3' 'datasets==3.6.0' 'resampy==0.4.3' 'librosa==0.11.0' 'numpy<2' 'resemble-perth==1.0.1' 'omegaconf==2.3.0' 'conformer==0.3.2' 's3tokenizer' 'soundfile' 'jiwer' 'resemblyzer' 2>&1 | tail -1 | |
| echo '== PREFLIGHT ==' | |
| for b in git gcc ffmpeg; do command -v $b >/dev/null || { echo "PREFLIGHT FAIL: missing binary $b"; exit 2; }; done | |
| python - <<'PF' | |
| import importlib | |
| from huggingface_hub import HfApi | |
| for m, v in [("torch", "2.6.0"), ("transformers", "4.51.3"), ("peft", "0.15.2"), ("diffusers", "0.29.0"), ("resemblyzer", None), ("webrtcvad", None)]: | |
| mod = importlib.import_module(m) | |
| if v: assert mod.__version__.split('+')[0] == v, f"{m} {mod.__version__} != {v}" | |
| api = HfApi() | |
| files = api.list_repo_files("ACloudCenter/vibevoice-lora-joint", repo_type="model") | |
| for need in ("emo3/lora/adapter_config.json", "emo3/lora/adapter_model.safetensors", "emo3/lora/diffusion_head_full.bin"): | |
| assert need in files, f"{need} missing (emo3 warm-start source)" | |
| assert api.repo_exists("ACloudCenter/fast-vibevoice-notes", repo_type="dataset"), "notes missing" | |
| print("PREFLIGHT OK", flush=True) | |
| PF | |
| echo '== DAILYTALK PREP (500 convs) ==' | |
| python -c "import urllib.request; urllib.request.urlretrieve('https://huggingface.co/datasets/ACloudCenter/fast-vibevoice-notes/resolve/main/prep_dailytalk.py', '/prep_dailytalk.py'); s=open('/prep_dailytalk.py').read(); assert 'PREP DONE' in s; print('PREP FETCH OK')" | |
| python /prep_dailytalk.py /data 500 | |
| echo '== EMO4 DATA PREP (clean-filtered) ==' | |
| python -c "import urllib.request; urllib.request.urlretrieve('https://huggingface.co/datasets/ACloudCenter/fast-vibevoice-notes/resolve/main/emo4_data_prep.py', '/emo4_data_prep.py'); s=open('/emo4_data_prep.py').read(); assert 'EMO4 PREP DONE' in s and 'FLOOR_MAX' in s; print('EMO4 FETCH OK')" | |
| python /emo4_data_prep.py | |
| echo '== FETCH EMO3 (warm-start init) ==' | |
| python - <<'CK' | |
| import os | |
| from huggingface_hub import HfApi, hf_hub_download | |
| api = HfApi() | |
| sub = "emo3/lora" | |
| for f in [f for f in api.list_repo_files("ACloudCenter/vibevoice-lora-joint", repo_type="model") if f.startswith(sub + "/")]: | |
| local = hf_hub_download("ACloudCenter/vibevoice-lora-joint", f, repo_type="model") | |
| with open(local, "rb") as fh: | |
| data = fh.read() | |
| op = os.path.join("/emo3-init", f[len(sub) + 1:]) | |
| os.makedirs(os.path.dirname(op), exist_ok=True) | |
| with open(op, "wb") as fh: | |
| fh.write(data) | |
| assert os.path.isfile(op) and os.path.getsize(op) == len(data) | |
| print("EMO3 FETCH OK:", sorted(os.listdir("/emo3-init")), flush=True) | |
| CK | |
| echo '== WARMSTART PATCH (from emo3) ==' | |
| python - <<'WS' | |
| p = "/vvft/src/finetune_vibevoice_lora.py" | |
| s = open(p).read() | |
| a1 = " model.model.language_model = get_peft_model(model.model.language_model, lora_cfg)" | |
| assert a1 in s, "lm anchor missing" | |
| s = s.replace(a1, a1 + """ | |
| if os.path.isfile("/emo3-init/adapter_config.json"): | |
| import importlib.util as _ilu2 | |
| import sys as _sys2 | |
| from pathlib import Path as _P | |
| _spec2 = _ilu2.spec_from_file_location("lora_loading_ws", "/vv-main/vibevoice/modular/lora_loading.py") | |
| _mod2 = _ilu2.module_from_spec(_spec2) | |
| _sys2.modules[_spec2.name] = _mod2 | |
| _spec2.loader.exec_module(_mod2) | |
| _rep = _mod2._LoadReport() | |
| _dev = next(model.parameters()).device | |
| _mod2._load_language_model(model, _P("/emo3-init"), _dev, _rep) | |
| print(f"WARMSTART LM via peft loader: lm={_rep.language_model}", flush=True)""") | |
| a2 = """ if getattr(model_args, "train_diffusion_head", False) and hasattr(model.model, "prediction_head"): | |
| for p in model.model.prediction_head.parameters(): | |
| p.requires_grad = True""" | |
| assert a2 in s, "head anchor missing" | |
| s = s.replace(a2, a2 + """ | |
| if os.path.isfile("/emo3-init/diffusion_head_full.bin"): | |
| _hsd = torch.load("/emo3-init/diffusion_head_full.bin", map_location="cpu") | |
| _hm, _hu = model.model.prediction_head.load_state_dict(_hsd, strict=False) | |
| print(f"WARMSTART HEAD: missing={len(_hm)} unexpected={len(_hu)}", flush=True) | |
| for _cname in ("acoustic_connector", "semantic_connector"): | |
| _cp = f"/emo3-init/{_cname}/pytorch_model.bin" | |
| if os.path.isfile(_cp): | |
| getattr(model.model, _cname).load_state_dict(torch.load(_cp, map_location="cpu"), strict=False) | |
| print(f"WARMSTART {_cname} OK", flush=True)""") | |
| open(p, "w").write(s) | |
| print("WARMSTART PATCH OK (from emo3)", flush=True) | |
| WS | |
| echo '== TRAIN (emo4: 1600 steps, clean data) ==' | |
| python -m src.finetune_vibevoice_lora \ | |
| --model_name_or_path microsoft/VibeVoice-1.5B \ | |
| --processor_name_or_path src/vibevoice/processor \ | |
| --train_jsonl /data/emo4_train.jsonl --validation_jsonl /data/emo4_val.jsonl \ | |
| --output_dir out_emo4 --per_device_train_batch_size 1 --gradient_accumulation_steps 16 \ | |
| --max_steps 1600 --learning_rate 1e-5 --logging_steps 10 --save_steps 400 --save_total_limit 2 \ | |
| --eval_strategy steps --eval_steps 400 --do_eval \ | |
| --load_best_model_at_end --metric_for_best_model eval_loss --greater_is_better False \ | |
| --label_names input_ids \ | |
| --remove_unused_columns False --bf16 True --do_train --gradient_clipping \ | |
| --gradient_checkpointing True --gradient_checkpointing_kwargs '{"use_reentrant": false}' \ | |
| --ddpm_batch_mul 2 --diffusion_loss_weight 1.4 --train_diffusion_head True --ce_loss_weight 0.04 \ | |
| --voice_prompt_drop_rate 0.2 \ | |
| --lora_target_modules q_proj,k_proj,v_proj,o_proj,gate_proj,up_proj,down_proj \ | |
| --lr_scheduler_type cosine --warmup_ratio 0.03 --max_grad_norm 0.8 --report_to none \ | |
| 2>&1 | tee /tmp/joblog.txt | |
| echo '== PUSH ==' | |
| python - <<'PUSH' | |
| from huggingface_hub import HfApi | |
| import glob, os | |
| api = HfApi() | |
| n = 0 | |
| for p in glob.glob('out_emo4/**/*', recursive=True): | |
| if os.path.isfile(p): | |
| api.upload_file(path_or_fileobj=p, path_in_repo='emo4/' + os.path.relpath(p, 'out_emo4'), repo_id='ACloudCenter/vibevoice-lora-joint') | |
| n += 1 | |
| print(f'PUSH OK ({n} files)', flush=True) | |
| PUSH | |
| python - <<'LOG' | |
| from huggingface_hub import HfApi | |
| try: | |
| HfApi().upload_file(path_or_fileobj="/tmp/joblog.txt", path_in_repo="emo4-train-log.txt", repo_id="ACloudCenter/fast-vibevoice-notes", repo_type="dataset") | |
| print("LOG OK", flush=True) | |
| except Exception as e: | |
| print("LOG FAIL", e, flush=True) | |
| LOG |