Skip to content

Commit

Permalink
Finalize 0.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
enhuiz committed Dec 14, 2023
1 parent 2c2acf8 commit 28f89aa
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 8 deletions.
3 changes: 1 addition & 2 deletions config/enhancer_stage1.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
lcfm_training_mode: ae
load_fg_only: true
batch_size_per_gpu: 16
# Uncomment this if you are training your model
# denoiser_run_dir: runs/denoiser
denoiser_run_dir: runs/denoiser
5 changes: 2 additions & 3 deletions config/enhancer_stage2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,5 @@ training_seconds: 3.0
gan_training_start_step: null
lcfm_z_scale: 6
praat_augment_prob: 0.2
# Uncomment this if you are training your model
# enhancer_stage1_run_dir: runs/enhancer_stage1
# denoiser_run_dir: runs/denoiser
denoiser_run_dir: runs/denoiser
enhancer_stage1_run_dir: runs/enhancer_stage1
2 changes: 2 additions & 0 deletions resemble_enhance/data/distorter/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ def _sample_rir(self):
return rir

def apply(self, wav, sr):
# ref: https://github.com/haoheliu/voicefixer_main/blob/b06e07c945ac1d309b8a57ddcd599ca376b98cd9/dataloaders/augmentation/magical_effects.py#L158

if len(self.rir_paths) == 0:
return wav

Expand Down
7 changes: 7 additions & 0 deletions resemble_enhance/enhancer/__main__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import argparse
import random
import time
from pathlib import Path

import torch
Expand Down Expand Up @@ -70,6 +71,8 @@ def main():

args = parser.parse_args()

start_time = time.perf_counter()

run_dir = args.run_dir

paths = sorted(args.in_dir.glob(f"**/*{args.suffix}"))
Expand Down Expand Up @@ -111,6 +114,10 @@ def main():
out_path.parent.mkdir(parents=True, exist_ok=True)
torchaudio.save(out_path, hwav[None], sr)

# Cool emoji effect saying the job is done
elapsed_time = time.perf_counter() - start_time
print(f"🌟 Enhancement done! {len(paths)} files processed in {elapsed_time:.2f}s")


if __name__ == "__main__":
main()
6 changes: 3 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ def shell(*args):
return out.decode("ascii").strip()


def write_version(version_core, dev=True):
if dev:
def write_version(version_core, pre_release=True):
if pre_release:
last_commit_time = shell("git", "log", "-1", "--format=%cd", "--date=iso-strict")
last_commit_time = datetime.strptime(last_commit_time, "%Y-%m-%dT%H:%M:%S%z")
last_commit_time = last_commit_time.astimezone(timezone.utc)
Expand All @@ -36,7 +36,7 @@ def write_version(version_core, dev=True):
setup(
name="resemble-enhance",
python_requires=">=3.10",
version=write_version("0.0.1"),
version=write_version("0.0.1", pre_release=False),
description="Speech denoising and enhancement with deep learning",
long_description=long_description,
long_description_content_type="text/markdown",
Expand Down

0 comments on commit 28f89aa

Please sign in to comment.