Prepare pinned Humaneness voice conversion runtime and API integration

This commit is contained in:
Mikei386 committed 2026-10-19 13:56:49 +02:00
1 parent 0659967f36
commit 7cf12d4fd1
22 files changed
+693 -18

No files matched your search

+77
View File
@@ -0,0 +1,77 @@
# Humaneness Voice Converter runtime
Upstream model: `laion/Humaneness-Voice-Converter`, revision
`952ef56c945763be50432738e31a32c30b359619`. This is actual audio-to-audio
conversion, not STT/TTS. Upstream inference code and weights are unmodified.
The fixed CLI accepts 1–30 second mono source and target WAV; a clean5–10s
reference is recommended. Input timing/content and style are used directly.
Exact pitch, every pause, word, identity and emotion are not guaranteed.
No independent Qwen/ElevenLabs quality equivalence is claimed.
## Provisioning (native or Deck container)
Requires Python3.12, venv/pip, FFmpeg, CUDA-compatible NVIDIA driver and a CUDA
PyTorch2.9.1 runtime for inference. The tested preparation uses Deck's
Python3.12.3; native Debian must explicitly provide compatible Python3.12 and
`python3.12-venv`, FFmpeg and the NVIDIA driver. These must not be assumed to
come from another model/service. No new system service is required: Deck owns
the short-lived per-job model process.
1. Set `STATE` to the native Deck state root, or the configured container's
persistent state root **inside** that container. Set `DECK_USER` to its real
service user. Create `$STATE/humaneness-runtime` owned by that user, mode0700.
2. Copy `bootstrap.py`, `assets.json`, `upstream-requirements.txt` and
`requirements.lock` there from this exact Git revision. As that user run:
`CUDA_VISIBLE_DEVICES='' python3.12 "$STATE/humaneness-runtime/bootstrap.py"`.
3. This creates an isolated venv, downloads only the pinned public assets,
checks their SHA256/Git blob hashes and runs a complete CPU import. GPU is
hidden throughout preparation. Check `prepare-status.json` for `complete`;
`ready` is written only after success. Keep `verified-assets.json` and lock
with deployment evidence. The first resolved dependency set is recorded in
the committed lock; Chatterbox is installed with `--no-deps` as upstream
requires because its old dependency metadata conflicts with the tested stack.
4. Deck startup registers a model-library link and creates the initial profile
`Humaneness Voice Conversion` (`humaneness-vc`) once. Publication remains a
normal GUI action under the API endpoint; there is no implicit token or
access grant. Start Stimmatelier and choose that profile.
Current preparation used a disposable CPU-only container based on the existing
Deck image, with only this runtime directory mounted, no GPU,2CPU/6GiB RAM.
Remove that preparation container after acceptance. It is not an operational
service or a runtime dependency. Native provisioning follows the same script.
Venv interpreter paths must match the executing Python installation; rebuild
the venv from the recipe when OS/Python changes. Do not copy it between hosts.
## Execution and API
The existing Deck FIFO scheduler waits for or rejects busy GPU work; it never
kills an active LLM request. Conversion then evicts idle models, uses RTX3060
with at least8.5GiB free VRAM and6GiB Deck RAM, and releases its process/GPU at
completion. CPU Qwen's warm worker is separate. Settings: one candidate, BF16,
10 upstream flow steps, upstream seed. These controls are fixed in this initial
integration; the generic voice-profile TTS parameters do not control conversion.
There is no hidden live mode, automatic model download, external speech API,
Docker socket or new credential. Inference is offline after preparation.
GUI: `/api/v1/conversion/start`, status `/api/v1/conversion`, audio
`/api/v1/conversion/audio?id=<id>`, cancellation `/api/v1/conversion/cancel`.
Normal Deck session/CSRF rules apply. Multipart fields: `profile_id`, `source`,
`reference`. Both files: PCM16 mono WAV16/24/48kHz,1–30s, ≤16MiB each.
Published service API (existing Bearer token):
`GET /v1/audio/voice-conversions/models` and
`POST /v1/audio/voice-conversions`, fields `model=humaneness-vc`, `source`,
`reference`. Returns `audio/wav`. These are **Deck extensions**, not standard
OpenAI TTS routes. The model is intentionally absent from text-to-speech model
lists; a client must explicitly support audio-to-audio conversion.
Original source/reference files are deleted after success, failure or cancel.
The output WAV, technical stderr and non-text job metadata remain in
`$STATE/humaneness-jobs`. This folder is included in the encrypted userdata
backup. Model/runtime files are reconstructible from Git and the fixed public
manifest and excluded from pre-update private-state snapshots. Preserve profiles,
API configuration and private output jobs using Deck's normal backups. This
recipe has not been accepted as a full fresh-Debian-host restore.
CC BY4.0 applies to LAION additions/weights; upstream Chatterbox MIT notices are
retained in the downloaded model's NOTICE. Dependencies keep their own licences.
+90
View File
@@ -0,0 +1,90 @@
{
"repo": "laion/Humaneness-Voice-Converter",
"revision": "952ef56c945763be50432738e31a32c30b359619",
"files": [
{
"file": "NOTICE.md",
"size": 1209,
"sha256": null,
"git_sha1": "375e93fed23db8c248d5fef98ca6b01d12447ec6"
},
{
"file": "README.md",
"size": 10860,
"sha256": null,
"git_sha1": "6348db9b6386451dc11e854fb2b2a2c2e9f1a82e"
},
{
"file": "SPEED.md",
"size": 5599,
"sha256": null,
"git_sha1": "56d133e4fdf868ae8fc18d285d978f7f2628858c"
},
{
"file": "conditioning/ears-medium/classes.json",
"size": 8046,
"sha256": null,
"git_sha1": "cdeee81c5608f62313b5a1bfd878d3922760726e"
},
{
"file": "conditioning/ears-medium/medium/config.json",
"size": 1981,
"sha256": null,
"git_sha1": "a34ea32d1fbea0adc94b8026cb686d544e96d358"
},
{
"file": "conditioning/ears-medium/medium/model.safetensors",
"size": 388447068,
"sha256": "00f30de0f7d656d2a1e86bdc629673ff8b576532e1263b02bcebdfc2763e54f1",
"git_sha1": "71edf230d621d0b156bcf8a5c9b66d3829982969"
},
{
"file": "conditioning/ears-medium/medium/preprocessor_config.json",
"size": 184990,
"sha256": null,
"git_sha1": "c2048dfa9fd94a052e62e908d2c4dfb18534b4d2"
},
{
"file": "conditioning/ears-medium/model.py",
"size": 10203,
"sha256": null,
"git_sha1": "9080bdb80574da8aa1a071f7dba4b7c3268c06db"
},
{
"file": "conditioning/ears-medium/training_normalization.json",
"size": 14945,
"sha256": null,
"git_sha1": "48c2374aedc17ad1ce670ea8fe31a56de8b6c886"
},
{
"file": "conditioning/reward_calibration.json",
"size": 500,
"sha256": null,
"git_sha1": "4bceba02f94b7a11649c7d26c5ee0c7876b3b461"
},
{
"file": "conditioning/score_order.json",
"size": 2416,
"sha256": null,
"git_sha1": "96c12dfc475a1205c5bb9dc2be3c697ef8b4a76e"
},
{
"file": "infer.py",
"size": 15291,
"sha256": null,
"git_sha1": "84c830f94a93f6e0c60262fcad0e579c3312dda1"
},
{
"file": "model.safetensors",
"size": 1056773004,
"sha256": "45bbf058ea2a82f1840dc6161f01be929217d28843003f5354336c81b11ea3dd",
"git_sha1": "f4190a1792074fa5184fa72d0c83c2a35f79578e"
},
{
"file": "requirements.txt",
"size": 540,
"sha256": null,
"git_sha1": "e90f0b9421a08cef8b6499f9fc2111e7e42fa77f"
}
]
}
+33
View File
@@ -0,0 +1,33 @@
import hashlib,json,os,subprocess,sys,time,urllib.request
from pathlib import Path
root=Path(__file__).resolve().parent
os.environ.update(CUDA_VISIBLE_DEVICES='',OMP_NUM_THREADS='2',HF_HOME=str(root/'hf-cache'),HF_HUB_DISABLE_TELEMETRY='1',PIP_DISABLE_PIP_VERSION_CHECK='1')
def status(state,phase):
p=root/'prepare-status.tmp';p.write_text(json.dumps(dict(state=state,phase=phase,time=time.time())));p.replace(root/'prepare-status.json')
def run(args):
with (root/'prepare.log').open('ab') as f:subprocess.run([str(x) for x in args],stdout=f,stderr=f,check=True)
try:
status('running','Isolierte Python-Laufzeit erstellen')
run([sys.executable,'-m','venv',root/'python']);python=root/'python/bin/python'
status('running','Offizielle CUDA-Torch-Wheels installieren; GPU unsichtbar')
run([python,'-m','pip','install','--no-cache-dir','torch==2.9.1','torchaudio==2.9.1','--index-url','https://download.pytorch.org/whl/cu128'])
status('running','Hersteller-Abhängigkeiten installieren')
req=(root/'requirements.lock').read_text() if (root/'requirements.lock').exists() else (root/'upstream-requirements.txt').read_text();(root/'requirements.txt').write_text('\n'.join(l for l in req.splitlines() if not l.startswith(('torch==','torchaudio==','chatterbox-tts=='))))
run([python,'-m','pip','install','--no-cache-dir','-r',root/'requirements.txt'])
run([python,'-m','pip','install','--no-cache-dir','--no-deps','chatterbox-tts==0.1.7'])
status('running','Öffentliche Modellgewichte mit Prüfsummen laden')
manifest=json.loads((root/'assets.json').read_text());model=root/'model'
for a in manifest['files']:
target=model/a['file'];target.parent.mkdir(parents=True,exist_ok=True)
h=hashlib.sha256();g=hashlib.sha1(('blob '+str(a['size'])+'\0').encode())
with urllib.request.urlopen('https://huggingface.co/'+manifest['repo']+'/resolve/'+manifest['revision']+'/'+a['file'],timeout=120) as r,target.open('wb') as f:
while chunk:=r.read(4*1024**2):f.write(chunk);h.update(chunk);g.update(chunk)
if target.stat().st_size!=a['size'] or (h.hexdigest()!=a['sha256'] if a['sha256'] else g.hexdigest()!=a['git_sha1']):raise ValueError('Gewichtsprüfung fehlgeschlagen: '+a['file'])
a['verified_sha256']=h.hexdigest()
(root/'verified-assets.json').write_text(json.dumps(manifest,indent=2))
os.environ.update(HF_HUB_OFFLINE='1',TRANSFORMERS_OFFLINE='1')
status('running','CPU-Import und vollständige Modelle prüfen; keine GPU-Nutzung')
run([python,'-c',"import sys,torch;from pathlib import Path;sys.path.insert(0,str(Path(sys.argv[1])/'model'));import infer;assert not torch.cuda.is_available();m=infer.load_converter(Path(sys.argv[1])/'model',torch.device('cpu'));e=infer.load_ears(Path(sys.argv[1])/'model/conditioning/ears-medium',torch.device('cpu'));print('CPU_IMPORT_OK')",root])
with (root/'requirements.lock').open('wb') as f:subprocess.run([str(python),'-m','pip','freeze'],stdout=f,check=True)
(root/'ready').write_text(manifest['revision']);status('complete','Gewichte geprüft und Laufzeit CPU-seitig bereit; noch kein Profil aktiviert')
except Exception as e:status('failed',type(e).__name__+': '+str(e)[:350]);raise
+1
View File
@@ -0,0 +1 @@
[]
+93
View File
@@ -0,0 +1,93 @@
annotated-doc==0.0.5
antlr4-python3-runtime==4.9.3
anyio==4.15.1
certifi==2026.10.18
cffi==2.1.1
cfgv==3.5.0
charset-normalizer==3.5.2
chatterbox-tts==0.1.7
click==8.5.0
cloudpickle==3.1.2
conformer==0.3.2
decorator==5.3.1
diffusers==0.40.0
distlib==0.4.4
einops==0.8.2
filelock==3.32.3
fsspec==2026.7.0
h11==0.16.0
hf-xet==1.7.0
httpcore==1.0.9
httpx==0.28.1
huggingface_hub==1.29.0
identify==2.6.20
idna==3.20
importlib_metadata==9.0.1
Jinja2==3.1.6
joblib==1.6.0
lazy-loader==0.6
librosa==1.0.0
llvmlite==0.50.0
markdown-it-py==4.2.0
MarkupSafe==3.0.3
mdurl==0.1.2
ml_dtypes==0.6.0
mpmath==1.3.0
msgpack==1.2.3
narwhals==2.27.1
networkx==3.6.1
nodeenv==1.11.0
numba==0.68.0
numpy==2.3.2
nvidia-cublas-cu12==12.8.4.1
nvidia-cuda-cupti-cu12==12.8.90
nvidia-cuda-nvrtc-cu12==12.8.93
nvidia-cuda-runtime-cu12==12.8.90
nvidia-cudnn-cu12==9.10.2.21
nvidia-cufft-cu12==11.3.3.83
nvidia-cufile-cu12==1.13.1.3
nvidia-curand-cu12==10.3.9.90
nvidia-cusolver-cu12==11.7.3.90
nvidia-cusparse-cu12==12.5.8.93
nvidia-cusparselt-cu12==0.7.1
nvidia-nccl-cu12==2.27.5
nvidia-nvjitlink-cu12==12.8.93
nvidia-nvshmem-cu12==3.3.20
nvidia-nvtx-cu12==12.8.90
omegaconf==2.3.1
onnx==1.23.2
packaging==26.3
pillow==13.0.0
platformdirs==4.13.5
pooch==1.9.0
pre_commit==4.7.0
protobuf==7.36.2
pycparser==3.11
Pygments==2.21.0
python-discovery==1.6.4
PyYAML==6.0.3
regex==2026.9.29
requests==2.34.2
resemble-perth==1.0.1
rich==15.0.0
s3tokenizer==0.3.0
safetensors==0.8.0
scikit-learn==1.9.1
scipy==1.18.1
setuptools==78.1.0
shellingham==1.5.4
soundfile==0.14.0
soxr==1.1.0
sympy==1.14.0
threadpoolctl==3.7.0
tokenizers==0.22.2
torch==2.9.1+cu128
torchaudio==2.9.1+cu128
tqdm==4.70.1
transformers==5.14.1
triton==3.5.1
typer==0.27.3
typing_extensions==4.16.0
urllib3==2.8.0
virtualenv==21.14.11
zipp==4.1.1
@@ -0,0 +1,18 @@
# Research environment snapshot, not a resolver-tested one-line installer.
# Chatterbox 0.1.7 metadata pins older Torch/Transformers on Python 3.13;
# install it with --no-deps after installing these tested runtime packages.
# Install a CUDA-compatible PyTorch wheel for your platform first.
torch==2.9.1
torchaudio==2.9.1
transformers==5.14.1
numpy==2.3.2
safetensors==0.8.0
scipy==1.18.1
soundfile==0.14.0
librosa==1.0.0
huggingface-hub==1.29.0
s3tokenizer==0.3.0
diffusers==0.40.0
conformer==0.3.2
omegaconf==2.3.1
resemble-perth==1.0.1