# hugofloresgarcia/vampnet architecture

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

- Interactive diagram: https://gitdiagram.com/hugofloresgarcia/vampnet
- Repository: https://github.com/hugofloresgarcia/vampnet

## Overview

VampNet is an audio continuation and inpainting system: users provide audio, choose a model and masking/sampling controls, then receive generated audio. Its broader product includes model training and fine-tuning, export, embedding analysis, and two performance tools. Core inference and helper calls are supported by excerpts or the SOURCE INDEX; training/export and the Max client workflow are included where the README documents them. Unsampled implementation details are not inferred.

Main entry points: [`vampnet/interface.py`](https://github.com/hugofloresgarcia/vampnet/blob/main/vampnet/interface.py) (Audio interface), [`app.py`](https://github.com/hugofloresgarcia/vampnet/blob/main/app.py) (Gradio interface), [`vampnet/modules/transformer.py`](https://github.com/hugofloresgarcia/vampnet/blob/main/vampnet/modules/transformer.py) (VampNet transformer), [`token_telephone/vamp_helper.py`](https://github.com/hugofloresgarcia/vampnet/blob/main/token_telephone/vamp_helper.py) (Telephone inference helper)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_inference["Audio Inference"]
  node_webui["Gradio interface<br/>[app.py]"]
  node_masking["Mask construction<br/>[mask.py]"]
end

subgraph group_model["Model Runtime"]
  node_interface["Audio interface<br/>[interface.py]"]
  node_beats["Beat tracking<br/>[beats.py]"]
  node_transformer["VampNet transformer<br/>[transformer.py]"]
  node_layers["Neural layers<br/>[layers.py]"]
  node_activations["Activations<br/>[activations.py]"]
end

subgraph group_training["Model Development"]
  node_trainer["Training<br/>[train.py]"]
  node_finetune["Fine-tuning setup<br/>[fine_tune.py]"]
  node_export["Model export<br/>[export.py]"]
end

subgraph group_analysis["Embedding Analysis"]
  node_embeddings["GTZAN embeddings"]
end

subgraph group_performance["Performance Tools"]
  node_telephone["Token Telephone<br/>[tt.py]"]
  node_telephonehelper["Telephone inference helper<br/>[vamp_helper.py]"]
  node_ttutil["Telephone utilities<br/>[ttutil.py]"]
  node_unloopclient["Unloop client<br/>[client.py]"]
  node_maxpatch["Max performance patch<br/>[unloop.maxpat]"]
end

node_listener(("Audio user"))
node_modelhub[("Hugging Face models")]
node_audio(("Audio input"))

node_listener -->|"submits audio"| node_webui
node_audio -->|"provides audio"| node_webui
node_webui -->|"runs inference"| node_interface
node_webui -->|"builds masks"| node_masking
node_interface -->|"uses model"| node_transformer
node_interface -->|"extracts beats"| node_beats
node_interface -->|"constructs masks"| node_masking
node_transformer -->|"uses layers"| node_layers
node_transformer -->|"uses activations"| node_activations
node_interface -.->|"loads weights"| node_modelhub
node_finetune -->|"prepares jobs"| node_trainer
node_trainer -->|"trains model"| node_transformer
node_export -->|"publishes model"| node_modelhub
node_embeddings -->|"loads interface"| node_interface
node_telephone -->|"requests variation"| node_telephonehelper
node_telephone -->|"uses utilities"| node_ttutil
node_telephonehelper -->|"runs variation"| node_interface
node_telephonehelper -->|"builds masks"| node_masking
node_unloopclient -->|"calls server"| node_webui
node_maxpatch -.->|"controls client"| node_unloopclient

click node_webui "https://github.com/hugofloresgarcia/vampnet/blob/main/app.py"
click node_masking "https://github.com/hugofloresgarcia/vampnet/blob/main/vampnet/mask.py"
click node_interface "https://github.com/hugofloresgarcia/vampnet/blob/main/vampnet/interface.py"
click node_beats "https://github.com/hugofloresgarcia/vampnet/blob/main/vampnet/beats.py"
click node_transformer "https://github.com/hugofloresgarcia/vampnet/blob/main/vampnet/modules/transformer.py"
click node_layers "https://github.com/hugofloresgarcia/vampnet/blob/main/vampnet/modules/layers.py"
click node_activations "https://github.com/hugofloresgarcia/vampnet/blob/main/vampnet/modules/activations.py"
click node_trainer "https://github.com/hugofloresgarcia/vampnet/blob/main/scripts/exp/train.py"
click node_finetune "https://github.com/hugofloresgarcia/vampnet/blob/main/scripts/exp/fine_tune.py"
click node_export "https://github.com/hugofloresgarcia/vampnet/blob/main/scripts/exp/export.py"
click node_embeddings "https://github.com/hugofloresgarcia/vampnet/blob/main/scripts/utils/gtzan_embeddings.py"
click node_telephone "https://github.com/hugofloresgarcia/vampnet/blob/main/token_telephone/tt.py"
click node_telephonehelper "https://github.com/hugofloresgarcia/vampnet/blob/main/token_telephone/vamp_helper.py"
click node_ttutil "https://github.com/hugofloresgarcia/vampnet/blob/main/token_telephone/ttutil.py"
click node_unloopclient "https://github.com/hugofloresgarcia/vampnet/blob/main/unloop/client.py"
click node_maxpatch "https://github.com/hugofloresgarcia/vampnet/blob/main/unloop/max/unloop.maxpat"

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_webui,node_masking,node_listener toneBlue
class node_interface,node_beats,node_transformer,node_layers,node_activations,node_modelhub toneAmber
class node_trainer,node_finetune,node_export toneMint
class node_embeddings toneRose
class node_telephone,node_telephonehelper,node_ttutil,node_unloopclient,node_maxpatch,node_audio toneIndigo
```

## Components

### Audio Inference

- [Gradio interface](https://github.com/hugofloresgarcia/vampnet/blob/main/app.py): `app.py`
- [Mask construction](https://github.com/hugofloresgarcia/vampnet/blob/main/vampnet/mask.py): `vampnet/mask.py`

### Model Runtime

- [Audio interface](https://github.com/hugofloresgarcia/vampnet/blob/main/vampnet/interface.py): `vampnet/interface.py`
- [Beat tracking](https://github.com/hugofloresgarcia/vampnet/blob/main/vampnet/beats.py): `vampnet/beats.py`
- [VampNet transformer](https://github.com/hugofloresgarcia/vampnet/blob/main/vampnet/modules/transformer.py): `vampnet/modules/transformer.py`
- [Neural layers](https://github.com/hugofloresgarcia/vampnet/blob/main/vampnet/modules/layers.py): `vampnet/modules/layers.py`
- [Activations](https://github.com/hugofloresgarcia/vampnet/blob/main/vampnet/modules/activations.py): `vampnet/modules/activations.py`

### Model Development

- [Training](https://github.com/hugofloresgarcia/vampnet/blob/main/scripts/exp/train.py): `scripts/exp/train.py`
- [Fine-tuning setup](https://github.com/hugofloresgarcia/vampnet/blob/main/scripts/exp/fine_tune.py): `scripts/exp/fine_tune.py`
- [Model export](https://github.com/hugofloresgarcia/vampnet/blob/main/scripts/exp/export.py): `scripts/exp/export.py`

### Embedding Analysis

- [GTZAN embeddings](https://github.com/hugofloresgarcia/vampnet/blob/main/scripts/utils/gtzan_embeddings.py): `scripts/utils/gtzan_embeddings.py`

### Performance Tools

- [Token Telephone](https://github.com/hugofloresgarcia/vampnet/blob/main/token_telephone/tt.py): `token_telephone/tt.py`
- [Telephone inference helper](https://github.com/hugofloresgarcia/vampnet/blob/main/token_telephone/vamp_helper.py): `token_telephone/vamp_helper.py`
- [Telephone utilities](https://github.com/hugofloresgarcia/vampnet/blob/main/token_telephone/ttutil.py): `token_telephone/ttutil.py`
- [Unloop client](https://github.com/hugofloresgarcia/vampnet/blob/main/unloop/client.py): `unloop/client.py`
- [Max performance patch](https://github.com/hugofloresgarcia/vampnet/blob/main/unloop/max/unloop.maxpat): `unloop/max/unloop.maxpat`

### Other components

- **Audio user**
- **Hugging Face models**
- **Audio input**

## Connections

- Audio user → Gradio interface: submits audio (evidence: `README.md`)
- Audio input → Gradio interface: provides audio (evidence: `README.md`)
- Gradio interface → Audio interface: runs inference (evidence: `app.py`)
- Gradio interface → Mask construction: builds masks (evidence: `app.py`)
- Audio interface → VampNet transformer: uses model (evidence: `vampnet/interface.py`)
- Audio interface → Beat tracking: extracts beats (evidence: `vampnet/interface.py`)
- Audio interface → Mask construction: constructs masks (evidence: `vampnet/interface.py`)
- VampNet transformer → Neural layers: uses layers (evidence: `vampnet/modules/transformer.py`)
- VampNet transformer → Activations: uses activations (evidence: `vampnet/modules/transformer.py`)
- Audio interface → Hugging Face models: loads weights (evidence: `README.md`)
- Fine-tuning setup → Training: prepares jobs (evidence: `README.md`)
- Training → VampNet transformer: trains model (evidence: `scripts/exp/train.py`)
- Model export → Hugging Face models: publishes model (evidence: `README.md`)
- GTZAN embeddings → Audio interface: loads interface (evidence: `scripts/utils/gtzan_embeddings.py`)
- Token Telephone → Telephone inference helper: requests variation (evidence: `token_telephone/tt.py`)
- Token Telephone → Telephone utilities: uses utilities (evidence: `token_telephone/tt.py`)
- Telephone inference helper → Audio interface: runs variation (evidence: `token_telephone/vamp_helper.py`)
- Telephone inference helper → Mask construction: builds masks (evidence: `token_telephone/vamp_helper.py`)
- Unloop client → Gradio interface: calls server (evidence: `README.md`)
- Max performance patch → Unloop client: controls client (evidence: `README.md`)
