diff options
Diffstat (limited to 'README.md')
| -rw-r--r-- | README.md | 53 |
1 files changed, 49 insertions, 4 deletions
@@ -22,6 +22,8 @@ <a href="README.md">English</a> | <a href="README.zh-TW.md">Traditional Chinese guide</a> </p> +This is a fork of [JusperLee/Apollo GitHub Repository](https://github.com/JusperLee/Apollo). It has been modified to run inside a docker container on gfx803. + ## 📖 Abstract Audio restoration has become increasingly significant in modern society, not only due to the demand for high-quality auditory experiences enabled by advanced playback devices, but also because the growing capabilities of generative audio models necessitate high-fidelity audio. Typically, audio restoration is defined as a task of predicting undistorted audio from damaged input, often trained using a GAN framework to balance perception and distortion. Since audio degradation is primarily concentrated in mid- and high-frequency ranges, especially due to codecs, a key challenge lies in designing a generator capable of preserving low-frequency information while accurately reconstructing high-quality mid- and high-frequency content. Inspired by recent advancements in high-sample-rate music separation, speech enhancement, and audio codec models, we propose Apollo, a generative model designed for high-sample-rate audio restoration. Apollo employs an explicit **frequency band split module** to model the relationships between different frequency bands, allowing for **more coherent and higher-quality** restored audio. Evaluated on the MUSDB18-HQ and MoisesDB datasets, Apollo consistently outperforms existing SR-GAN models across various bit rates and music genres, particularly excelling in complex scenarios involving mixtures of multiple instruments and vocals. Apollo significantly improves music restoration quality while maintaining computational efficiency. @@ -34,16 +36,59 @@ Audio restoration has become increasingly significant in modern society, not onl ## ⚡️ Installation -Clone the repository +1. Clone this repository. +2. Build the docker container. + +```bash +docker compose build +``` + +3. Create neccessary directories: ```bash -git clone https://github.com/JusperLee/Apollo.git && cd Apollo -conda create --name look2hear --file look2hear.yml -conda activate look2hear +mkdir -p work .cache/huggingface .cache/miopen +``` + +4. Run the docker container. + +```bash +docker compose up -d ``` ## 🖥️ Usage +## Basic inference + +1. Copy input music into work directory. + +```bash +cp /path/to/low-quality.mp3 work/input.mp3 +``` + +2. Bash into docker container and run the model. + +```bash +# 1. Decode MP3 and resample to 44.1 kHz (Apollo requires 44.1 kHz) +ffmpeg -y -hide_banner -i /work/input.mp3 -map 0:a:0 -vn \ + -af "aresample=44100:resampler=soxr:precision=28" \ + -c:a pcm_f32le /work/input_44k.wav + +# 2. Restore on the GPU (ROCm exposes the card as torch "cuda") +python /workspace/Apollo/inference.py \ + --in_wav=/work/input_44k.wav \ + --out_wav=/work/input_restored.wav \ + --device=cuda \ + --chunk-seconds=6 \ + --overlap-seconds=1 \ + --chunk-pad-seconds=1 \ + --chunk-batch-size=1 + +# 3. Encode 44.1 kHz / 16-bit FLAC (optional) +ffmpeg -y -hide_banner -i /work/input_restored.wav -map 0:a:0 \ + -ar 44100 -sample_fmt s16 -c:a flac -compression_level 8 \ + /work/input.flac +``` + ### 🗂️ Datasets Apollo is trained on the MUSDB18-HQ and MoisesDB datasets. To download the datasets, run the following commands: |
