# b04901014/uuvc architecture

> Architecture diagram of the GitHub repository b04901014/uuvc, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-06). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/b04901014/uuvc
- Repository: https://github.com/b04901014/uuvc

## Overview

UUVC is a research system for one-shot speech prosody and speaker conversion. Users provide source and target speech; inference extracts speech units and speaker information, predicts timing and prosodic features, generates a mel spectrogram, and vocodes it to audio. The repository also supports feature preprocessing, model training, and a separate HiFi-GAN vocoder-training workflow. The README documents these capabilities; connections for unsampled modules are included only where the README or SOURCE INDEX supports them.

Main entry points: [`trainer.py`](https://github.com/b04901014/uuvc/blob/master/trainer.py) (Conversion trainer), [`inference.py`](https://github.com/b04901014/uuvc/blob/master/inference.py) (Conversion inference), [`models/s2rv.py`](https://github.com/b04901014/uuvc/blob/master/models/s2rv.py) (Speech representation), [`models/u2mel.py`](https://github.com/b04901014/uuvc/blob/master/models/u2mel.py) (Unit-to-mel model)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_prep["Feature preparation"]
  node_preprocess["Feature extraction<br/>[s2u.py]"]
  node_dataset_prep["VCTK splits<br/>[make_data_vctk.py]"]
end

subgraph group_conversion["Speech conversion"]
  node_inference["Conversion inference<br/>[inference.py]"]
  node_exact_inference["Exact-pitch inference"]
  node_speech_encoder{{"HuBERT unit encoder"}}
  node_s2rv["Speech representation<br/>[s2rv.py]"]
  node_transformer["Transformer layers<br/>[transformers.py]"]
  node_predictors["Prosody predictors<br/>[vp.py]"]
  node_unit2mel["Unit-to-mel model<br/>[u2mel.py]"]
  node_model_utils["Model utilities<br/>[utils.py]"]
end

subgraph group_training["Model training"]
  node_train_data["Speech dataset<br/>[dataset.py]"]
  node_sampler["Bucket sampler<br/>[sampler.py]"]
  node_train_entry["Training entry<br/>[train.py]"]
  node_trainer["Conversion trainer<br/>[trainer.py]"]
  node_loss["Training losses<br/>[loss.py]"]
end

subgraph group_vocoder["Vocoder"]
  node_vocoder_train["Vocoder training<br/>[train.py]"]
  node_mel_dataset["Vocoder mel data<br/>[meldataset.py]"]
  node_vocoder_models["HiFi-GAN models<br/>[models.py]"]
  node_vocoder_impl["Vocoder runtime<br/>[vocoder.py]"]
end

node_user(("Researcher"))
node_speech["Speech inputs"]
node_features["Prepared features"]
node_mel_audio["Generated mel"]
node_waveform["Converted audio"]

node_user -->|"provides"| node_speech
node_speech -->|"extracts features"| node_preprocess
node_preprocess -->|"writes"| node_features
node_features -->|"splits"| node_dataset_prep
node_features -.->|"loads"| node_train_data
node_user -->|"requests conversion"| node_inference
node_speech -->|"reads pairs"| node_inference
node_inference -->|"encodes units"| node_speech_encoder
node_inference -->|"runs encoder"| node_s2rv
node_inference -->|"predicts prosody"| node_predictors
node_inference -->|"predicts mel"| node_unit2mel
node_inference -->|"produces"| node_mel_audio
node_exact_inference -->|"runs encoder"| node_s2rv
node_exact_inference -->|"predicts mel"| node_unit2mel
node_exact_inference -->|"produces"| node_mel_audio
node_s2rv -->|"uses layers"| node_transformer
node_predictors -->|"uses blocks"| node_model_utils
node_unit2mel -->|"uses blocks"| node_model_utils
node_mel_audio -->|"vocodes"| node_vocoder_impl
node_vocoder_impl -->|"runs generator"| node_vocoder_models
node_vocoder_impl -->|"returns audio"| node_waveform
node_user -->|"starts training"| node_train_entry
node_train_entry -->|"invokes"| node_trainer
node_trainer -->|"loads batches"| node_train_data
node_trainer -->|"samples batches"| node_sampler
node_trainer -->|"trains encoder"| node_s2rv
node_trainer -->|"trains predictors"| node_predictors
node_trainer -->|"trains mel model"| node_unit2mel
node_trainer -->|"computes losses"| node_loss
node_vocoder_train -->|"loads data"| node_mel_dataset
node_vocoder_train -->|"trains models"| node_vocoder_models

click node_preprocess "https://github.com/b04901014/uuvc/blob/master/s2u.py"
click node_dataset_prep "https://github.com/b04901014/uuvc/blob/master/make_data_vctk.py"
click node_train_data "https://github.com/b04901014/uuvc/blob/master/data/dataset.py"
click node_sampler "https://github.com/b04901014/uuvc/blob/master/data/sampler.py"
click node_train_entry "https://github.com/b04901014/uuvc/blob/master/train.py"
click node_trainer "https://github.com/b04901014/uuvc/blob/master/trainer.py"
click node_loss "https://github.com/b04901014/uuvc/blob/master/loss.py"
click node_inference "https://github.com/b04901014/uuvc/blob/master/inference.py"
click node_exact_inference "https://github.com/b04901014/uuvc/blob/master/inference_exact_pitch.py"
click node_s2rv "https://github.com/b04901014/uuvc/blob/master/models/s2rv.py"
click node_transformer "https://github.com/b04901014/uuvc/blob/master/models/transformers.py"
click node_predictors "https://github.com/b04901014/uuvc/blob/master/models/vp.py"
click node_unit2mel "https://github.com/b04901014/uuvc/blob/master/models/u2mel.py"
click node_model_utils "https://github.com/b04901014/uuvc/blob/master/models/utils.py"
click node_vocoder_train "https://github.com/b04901014/uuvc/blob/master/vocoder/train.py"
click node_mel_dataset "https://github.com/b04901014/uuvc/blob/master/vocoder/meldataset.py"
click node_vocoder_models "https://github.com/b04901014/uuvc/blob/master/vocoder/models.py"
click node_vocoder_impl "https://github.com/b04901014/uuvc/blob/master/vocoder/vocoder.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_preprocess,node_dataset_prep toneBlue
class node_inference,node_exact_inference,node_speech_encoder,node_s2rv,node_transformer,node_predictors,node_unit2mel,node_model_utils toneAmber
class node_train_data,node_sampler,node_train_entry,node_trainer,node_loss toneMint
class node_vocoder_train,node_mel_dataset,node_vocoder_models,node_vocoder_impl toneRose
class node_user,node_speech,node_features,node_mel_audio,node_waveform toneIndigo
```

## Components

### Feature preparation

- [Feature extraction](https://github.com/b04901014/uuvc/blob/master/s2u.py): `s2u.py`
- [VCTK splits](https://github.com/b04901014/uuvc/blob/master/make_data_vctk.py): `make_data_vctk.py`

### Speech conversion

- [Conversion inference](https://github.com/b04901014/uuvc/blob/master/inference.py): `inference.py`
- [Exact-pitch inference](https://github.com/b04901014/uuvc/blob/master/inference_exact_pitch.py): `inference_exact_pitch.py`
- **HuBERT unit encoder**
- [Speech representation](https://github.com/b04901014/uuvc/blob/master/models/s2rv.py): `models/s2rv.py`
- [Transformer layers](https://github.com/b04901014/uuvc/blob/master/models/transformers.py): `models/transformers.py`
- [Prosody predictors](https://github.com/b04901014/uuvc/blob/master/models/vp.py): `models/vp.py`
- [Unit-to-mel model](https://github.com/b04901014/uuvc/blob/master/models/u2mel.py): `models/u2mel.py`
- [Model utilities](https://github.com/b04901014/uuvc/blob/master/models/utils.py): `models/utils.py`

### Model training

- [Speech dataset](https://github.com/b04901014/uuvc/blob/master/data/dataset.py): `data/dataset.py`
- [Bucket sampler](https://github.com/b04901014/uuvc/blob/master/data/sampler.py): `data/sampler.py`
- [Training entry](https://github.com/b04901014/uuvc/blob/master/train.py): `train.py`
- [Conversion trainer](https://github.com/b04901014/uuvc/blob/master/trainer.py): `trainer.py`
- [Training losses](https://github.com/b04901014/uuvc/blob/master/loss.py): `loss.py`

### Vocoder

- [Vocoder training](https://github.com/b04901014/uuvc/blob/master/vocoder/train.py): `vocoder/train.py`
- [Vocoder mel data](https://github.com/b04901014/uuvc/blob/master/vocoder/meldataset.py): `vocoder/meldataset.py`
- [HiFi-GAN models](https://github.com/b04901014/uuvc/blob/master/vocoder/models.py): `vocoder/models.py`
- [Vocoder runtime](https://github.com/b04901014/uuvc/blob/master/vocoder/vocoder.py): `vocoder/vocoder.py`

### Other components

- **Researcher**
- **Speech inputs**
- **Prepared features**
- **Generated mel**
- **Converted audio**

## Connections

- Researcher → Speech inputs: provides (evidence: `README.md`)
- Speech inputs → Feature extraction: extracts features (evidence: `README.md`)
- Feature extraction → Prepared features: writes (evidence: `README.md`)
- Prepared features → VCTK splits: splits (evidence: `README.md`)
- Prepared features → Speech dataset: loads
- Researcher → Conversion inference: requests conversion (evidence: `README.md`)
- Speech inputs → Conversion inference: reads pairs (evidence: `README.md`)
- Conversion inference → HuBERT unit encoder: encodes units (evidence: `inference.py`)
- Conversion inference → Speech representation: runs encoder (evidence: `inference.py`)
- Conversion inference → Prosody predictors: predicts prosody (evidence: `inference.py`)
- Conversion inference → Unit-to-mel model: predicts mel (evidence: `inference.py`)
- Conversion inference → Generated mel: produces (evidence: `inference.py`)
- Exact-pitch inference → Speech representation: runs encoder (evidence: `inference_exact_pitch.py`)
- Exact-pitch inference → Unit-to-mel model: predicts mel (evidence: `inference_exact_pitch.py`)
- Exact-pitch inference → Generated mel: produces (evidence: `inference_exact_pitch.py`)
- Speech representation → Transformer layers: uses layers (evidence: `models/s2rv.py`)
- Prosody predictors → Model utilities: uses blocks (evidence: `models/vp.py`)
- Unit-to-mel model → Model utilities: uses blocks (evidence: `models/u2mel.py`)
- Generated mel → Vocoder runtime: vocodes
- Vocoder runtime → HiFi-GAN models: runs generator (evidence: `vocoder/vocoder.py`)
- Vocoder runtime → Converted audio: returns audio (evidence: `vocoder/vocoder.py`)
- Researcher → Training entry: starts training (evidence: `README.md`)
- Training entry → Conversion trainer: invokes (evidence: `train.py`)
- Conversion trainer → Speech dataset: loads batches (evidence: `trainer.py`)
- Conversion trainer → Bucket sampler: samples batches (evidence: `trainer.py`)
- Conversion trainer → Speech representation: trains encoder (evidence: `trainer.py`)
- Conversion trainer → Prosody predictors: trains predictors (evidence: `trainer.py`)
- Conversion trainer → Unit-to-mel model: trains mel model (evidence: `trainer.py`)
- Conversion trainer → Training losses: computes losses (evidence: `trainer.py`)
- Vocoder training → Vocoder mel data: loads data (evidence: `vocoder/train.py`)
- Vocoder training → HiFi-GAN models: trains models (evidence: `vocoder/train.py`)
