Upload voice.py with huggingface_hub
Browse files
voice.py
CHANGED
|
@@ -3,9 +3,10 @@
|
|
| 3 |
voice — Lift a model's "voice" (its output-projection tensor) and cast it onto
|
| 4 |
another model, in either direction between safetensors and GGUF.
|
| 5 |
|
| 6 |
-
Commands:
|
| 7 |
voice get <model> [tensors...] Get a voice: one tensor (or head) to the registry,
|
| 8 |
several/--multi to voicepack files
|
|
|
|
|
|
|
| 9 |
voice cast <target> <voice> [tensors...] Cast a voice (or chosen tensors) onto a file
|
| 10 |
voice delta [voice] Make a reusable style (voice − base)
|
| 11 |
voice add <safetensors> <json> Add a voice from local voice.safetensors + voice.json
|
|
@@ -53,6 +54,7 @@ from vlib.cache import _base_rev, _cache_validate, _cache_topup_write, _ensure_b
|
|
| 53 |
from vlib.delta import _choose_voice, _resolve_base, _delta_gate, _check_delta_gate, _compute_delta
|
| 54 |
from vlib.reports import _hash_file, _sanitize_note, _sanitize_reporter, _prompt_share, _push_reports_batch, _push_report, _last_operation, cmd_report
|
| 55 |
from vlib.cmds_voices import cmd_get, cmd_cast, cmd_delta, cmd_add
|
|
|
|
| 56 |
from vlib.cmds_misc import cmd_list, _list_bases, _voice_tensors, _verify_voice_file, cmd_info, cmd_remove, cmd_cleanup, cmd_auth, cmd_path, cmd_doctor, _print_version, _print_completion, _entry_script, _ensure_venv
|
| 57 |
|
| 58 |
def main():
|
|
@@ -88,7 +90,31 @@ def main():
|
|
| 88 |
p_delta.add_argument("--base", help="Base HF repo (org/model) or local path to base safetensors")
|
| 89 |
p_delta.add_argument("--yes", action="store_true", help="Assume yes to prompts (overwrite without asking)")
|
| 90 |
p_delta.add_argument("-q", "--quiet", action="store_true", help="Quieter: progress and success notes off (warnings and errors still print)")
|
| 91 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 92 |
p_add = sub.add_parser("add", help="Add a voice from local voice.safetensors + voice.json")
|
| 93 |
p_add.add_argument("safetensors", help="Path to voice.safetensors (required)")
|
| 94 |
p_add.add_argument("json", help="Path to voice.json (required)")
|
|
@@ -156,6 +182,7 @@ def main():
|
|
| 156 |
"get": cmd_get, "cast": cmd_cast, "delta": cmd_delta, "add": cmd_add, "list": cmd_list,
|
| 157 |
"info": cmd_info, "remove": cmd_remove, "cleanup": cmd_cleanup, "auth": cmd_auth,
|
| 158 |
"report": cmd_report, "path": cmd_path, "doctor": cmd_doctor,
|
|
|
|
| 159 |
}
|
| 160 |
dispatch[args.command](args)
|
| 161 |
|
|
|
|
| 3 |
voice — Lift a model's "voice" (its output-projection tensor) and cast it onto
|
| 4 |
another model, in either direction between safetensors and GGUF.
|
| 5 |
|
|
|
|
| 6 |
voice get <model> [tensors...] Get a voice: one tensor (or head) to the registry,
|
| 7 |
several/--multi to voicepack files
|
| 8 |
+
voice graft <pulse> [donor] Graft one voice onto another (DELLA single graft)
|
| 9 |
+
voice chorus [pulse] [donors...] Blend voices: pulse + support + lead (DELLA chorus)
|
| 10 |
voice cast <target> <voice> [tensors...] Cast a voice (or chosen tensors) onto a file
|
| 11 |
voice delta [voice] Make a reusable style (voice − base)
|
| 12 |
voice add <safetensors> <json> Add a voice from local voice.safetensors + voice.json
|
|
|
|
| 54 |
from vlib.delta import _choose_voice, _resolve_base, _delta_gate, _check_delta_gate, _compute_delta
|
| 55 |
from vlib.reports import _hash_file, _sanitize_note, _sanitize_reporter, _prompt_share, _push_reports_batch, _push_report, _last_operation, cmd_report
|
| 56 |
from vlib.cmds_voices import cmd_get, cmd_cast, cmd_delta, cmd_add
|
| 57 |
+
from vlib.cmds_chorus import cmd_chorus, cmd_graft
|
| 58 |
from vlib.cmds_misc import cmd_list, _list_bases, _voice_tensors, _verify_voice_file, cmd_info, cmd_remove, cmd_cleanup, cmd_auth, cmd_path, cmd_doctor, _print_version, _print_completion, _entry_script, _ensure_venv
|
| 59 |
|
| 60 |
def main():
|
|
|
|
| 90 |
p_delta.add_argument("--base", help="Base HF repo (org/model) or local path to base safetensors")
|
| 91 |
p_delta.add_argument("--yes", action="store_true", help="Assume yes to prompts (overwrite without asking)")
|
| 92 |
p_delta.add_argument("-q", "--quiet", action="store_true", help="Quieter: progress and success notes off (warnings and errors still print)")
|
| 93 |
+
p_graft = sub.add_parser("graft", help="Graft one voice onto another (DELLA single graft)")
|
| 94 |
+
p_graft.add_argument("pulse", nargs="?", help="Pulse voice name (default: pick from registry)")
|
| 95 |
+
p_graft.add_argument("donor", nargs="?", help="Donor voice name (default: pick from registry)")
|
| 96 |
+
p_graft.add_argument("--density", type=float, default=0.8, help="Keep-fraction for magnitude pruning (default: 0.8)")
|
| 97 |
+
p_graft.add_argument("--epsilon", type=float, default=0.1, help="Rank-ramp half-width (default: 0.1)")
|
| 98 |
+
p_graft.add_argument("--lambda_", dest="lambda_", type=float, default=1.0, help="Global rescale after combine (default: 1.0)")
|
| 99 |
+
p_graft.add_argument("--rescale", default="l1", choices=["l1", "inv_p"], help="Prune rescale: l1 (stable) or inv_p (paper-faithful)")
|
| 100 |
+
p_graft.add_argument("--seed", type=int, default=42, help="Bernoulli seed for reproducible grafts (default: 42)")
|
| 101 |
+
p_graft.add_argument("--out", help="Output voice name (default: chorus-<pulse>-<donor>)")
|
| 102 |
+
p_graft.add_argument("--yes", action="store_true", help="Assume yes to prompts (overwrite without asking)")
|
| 103 |
+
p_graft.add_argument("-q", "--quiet", action="store_true", help="Quieter: progress and success notes off (warnings and errors still print)")
|
| 104 |
+
p_chorus = sub.add_parser("chorus", help="Blend voices: pulse + support + lead (DELLA chorus)")
|
| 105 |
+
p_chorus.add_argument("pulse", nargs="?", help="Pulse voice name (default: pick interactively)")
|
| 106 |
+
p_chorus.add_argument("donors", nargs="*", help="Support + lead voice names (0-2; 1 = duet at lead density)")
|
| 107 |
+
p_chorus.add_argument("--config", action="store_true", help="Stage knob screens per graft (Enter accepts each default; screens prefill from flags)")
|
| 108 |
+
p_chorus.add_argument("--density", type=float, default=0.8, help="First-graft density (default: 0.8)")
|
| 109 |
+
p_chorus.add_argument("--lead-density", type=float, default=0.9, help="Lead-graft density (default: 0.9)")
|
| 110 |
+
p_chorus.add_argument("--epsilon", type=float, default=0.1, help="Rank-ramp half-width (default: 0.1)")
|
| 111 |
+
p_chorus.add_argument("--lead-epsilon", type=float, default=0.05, help="Lead-graft epsilon (default: 0.05; keeps 0.9±eps valid)")
|
| 112 |
+
p_chorus.add_argument("--lambda_", dest="lambda_", type=float, default=1.0, help="Global rescale after combine (default: 1.0)")
|
| 113 |
+
p_chorus.add_argument("--rescale", default="l1", choices=["l1", "inv_p"], help="Prune rescale: l1 (stable) or inv_p (paper-faithful)")
|
| 114 |
+
p_chorus.add_argument("--seed", type=int, default=42, help="Bernoulli seed for reproducible choruses (default: 42)")
|
| 115 |
+
p_chorus.add_argument("--out", help="Final output voice name (default: chorus-<pulse>-<lead>)")
|
| 116 |
+
p_chorus.add_argument("--yes", action="store_true", help="Assume yes to prompts (overwrite without asking)")
|
| 117 |
+
p_chorus.add_argument("-q", "--quiet", action="store_true", help="Quieter: progress and success notes off (warnings and errors still print)")
|
| 118 |
p_add = sub.add_parser("add", help="Add a voice from local voice.safetensors + voice.json")
|
| 119 |
p_add.add_argument("safetensors", help="Path to voice.safetensors (required)")
|
| 120 |
p_add.add_argument("json", help="Path to voice.json (required)")
|
|
|
|
| 182 |
"get": cmd_get, "cast": cmd_cast, "delta": cmd_delta, "add": cmd_add, "list": cmd_list,
|
| 183 |
"info": cmd_info, "remove": cmd_remove, "cleanup": cmd_cleanup, "auth": cmd_auth,
|
| 184 |
"report": cmd_report, "path": cmd_path, "doctor": cmd_doctor,
|
| 185 |
+
"graft": cmd_graft, "chorus": cmd_chorus,
|
| 186 |
}
|
| 187 |
dispatch[args.command](args)
|
| 188 |
|