{"id":15293033,"url":"https://github.com/maum-ai/phaseaug","last_synced_at":"2025-04-10T05:07:42.193Z","repository":{"id":63050785,"uuid":"545298554","full_name":"maum-ai/phaseaug","owner":"maum-ai","description":"ICASSP 2023 Accepted","archived":false,"fork":false,"pushed_at":"2024-05-06T23:20:24.000Z","size":50143,"stargazers_count":189,"open_issues_count":7,"forks_count":14,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-04-10T05:07:24.417Z","etag":null,"topics":["gan","speech-synthesis","vocoder"],"latest_commit_sha":null,"homepage":"https://maum-ai.github.io/phaseaug/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/maum-ai.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-10-04T05:50:02.000Z","updated_at":"2025-01-08T17:52:17.000Z","dependencies_parsed_at":"2024-05-07T00:36:34.535Z","dependency_job_id":null,"html_url":"https://github.com/maum-ai/phaseaug","commit_stats":null,"previous_names":["maum-ai/phaseaug","mindslab-ai/phaseaug"],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maum-ai%2Fphaseaug","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maum-ai%2Fphaseaug/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maum-ai%2Fphaseaug/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maum-ai%2Fphaseaug/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/maum-ai","download_url":"https://codeload.github.com/maum-ai/phaseaug/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248161273,"owners_count":21057555,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["gan","speech-synthesis","vocoder"],"created_at":"2024-09-30T16:37:48.556Z","updated_at":"2025-04-10T05:07:42.160Z","avatar_url":"https://github.com/maum-ai.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PhaseAug\n\n**PhaseAug: A Differentiable Augmentation for Speech Synthesis to Simulate One-to-Many Mapping**\u003cbr\u003e\nJunhyeok Lee, Seungu Han, Hyunjae Cho, Wonbin Jung @ [MINDsLab Inc.](https://github.com/maum-ai), SNU, KAIST\n\n[![arXiv](https://img.shields.io/badge/arXiv-2211.04610-brightgreen.svg?style=flat-square)](https://arxiv.org/abs/2211.04610) [![GitHub Repo stars](https://img.shields.io/github/stars/maum-ai/phaseaug?color=yellow\u0026label=PhaseAug\u0026logo=github\u0026style=flat-square)](https://github.com/maum-ai/phaseaug) [![githubio](https://img.shields.io/badge/GitHub.io-Audio_Samples-blue?logo=Github\u0026style=flat-square)](https://maum-ai.github.io/phaseaug/)\n\n\n**Abstract** : Previous generative adversarial network (GAN)-based neural vocoders are trained to reconstruct the exact ground truth waveform from the paired mel-spectrogram and do not consider the one-to-many relationship of speech synthesis. This conventional training causes overfitting for both the discriminators and the generator, leading to the periodicity artifacts in the generated audio signal. In this work, we present PhaseAug, the first differentiable augmentation for speech synthesis that rotates the phase of each frequency bin to simulate one-to-many mapping. With our proposed method, we outperform baselines without any architecture modification. Code and audio samples will be available at https://github.com/maum-ai/phaseaug.\n\nAccepted to ICASSP 2023\n\n![phasor](asset/phaseaug_phasor.png) \n\n\n## TODO\n- [x] PyTorch 2.0 is released, need to modify STFT and iSTFT for complex support (solved at `1.0.0`)\n- [x] Arxiv updated\n- [x] Errata in paper will be fixed. Section 2.5 in paper, transition band half-width 0.06-\u003e 0.012.\n- [x] Section 2.5, mention about multiplyinng rotation matrix to \"the left side of F(x)\" will be added. -\u003e transpose m,k to reduce ambiguity\n- [x] Upload PhaseAug to [pypi](https://pypi.org/project/phaseaug/).\n- [x] Upload [VITS](https://arxiv.org/abs/2106.06103)+PhaseAug sampels at demo page.\n- [x] Refactoring codes for packaging.\n\n\n## Use PhaseAug\n- Install `alias-free-torch==0.0.6` and `phaseaug`\n```bash\npip install alias-free-torch==0.0.6 phaseaug \n```\n- Insert PhaseAug in your code, check [train.py](./train.py) as a example.\n```python\nfrom phaseaug.phaseaug import PhaseAug\n...\n# define phaseaug\naug = PhaseAug()\n...\n# discriminator update phase\naug_y, aug_y_g = aug.forward_sync(y, y_g_hat.detach())\ny_df_hat_r, y_df_hat_g, _, _ = mpd(aug_y, aug_y_g)\ny_ds_hat_r, y_ds_hat_g, _, _ = msd(aug_y, aug_y_g)\n...\n# generator update phase\naug_y, aug_y_g = aug.forward_sync(y, y_g_hat)\ny_df_hat_r, y_df_hat_g, fmap_f_r, fmap_f_g = mpd(aug_y, aug_y_g)\ny_ds_hat_r, y_ds_hat_g, fmap_s_r, fmap_s_g = msd(aug_y, aug_y_g)\n```\n\n- If you are applying `torch.cuda.amp.autocast` like [VITS](https://github.com/jaywalnut310/vits), you need to wrap PhaseAug with `autocast(enabled=False)` to prevent [ComplexHalf issue](https://github.com/jaywalnut310/vits/issues/15).\n```python\nfrom torch.cuda.amp import autocast\n...\nwith autocast(enabled=True)\n    # wrapping PhaseAug with autocast(enabled=False)\n    with autocast(enabled=False)\n        aug_y, aug_y_g = aug.forward_sync(y, y_g_hat)\n    # usually net_d parts are inside of autocast(enabled=True)\n    y_df_hat_r, y_df_hat_g, fmap_f_r, fmap_f_g = net_d(aug_y, aug_y_g)\n\n```\n\nAuthors recommend to read codes from [PITS](https://github.com/anonymous-pits/pits) for complicated application.  \n\n## Requirements\n- [PyTorch\u003e=1.7.0](https://pytorch.org/) for [alias-free-torch](https://github.com/junjun3518/alias-free-torch)\n- Support PyTorch\u003e=2.0.0\n- The requirements are highlighted in [requirements.txt](./requirements.txt).\n- We also provide docker setup [Dockerfile](./Dockerfile).\n```\ndocker build -t=phaseaug --build-arg USER_ID=$(id -u) --build-arg GROUP_ID=$(id -g) --build-arg USER_NAME=$USER\n```\n- Cloned [official HiFi-GAN repo](https://github.com/jik876/hifi-gan).\n- Downloaded [LJ Speech Dataset](https://keithito.com/LJ-Speech-Dataset/).\n- (optional) [MelGAN](https://github.com/descriptinc/melgan-neurips) generator\n\n## Training\n0. Clone this repository and copy python files to hifi-gan folder\n```bash\ngit clone --recursive https://github.com/maum-ai/phaseaug\ncp ./phaseaug/*.py ./phaseaug/hifi-gan/\ncd ./phaseaug/hifi-gan\n```\n\n  - optional: MelGAN generator\n  ```bash\n  cp ./phaseaug/config_v1_melgan.json ./phaseaug/hifi-gan/\n  ```\n  - Change generator to MelGAN generator at train.py\n  ```python\n  # import MelGanGenerator as Generator at [train.py](./train.py)\n  #from models import Generator # remove original import Generator\n  from models import MelGANGenerator as Generator\n  ```\n\n1. Modify dataset path at `train.py`\n```python\n     parser.add_argument('--input_wavs_dir',\n                         default='path/LJSpeech-1.1/wavs_22k')\n     parser.add_argument('--input_mels_dir',\n                         default='path/LJSpeech-1.1/wavs_22k')\n```\n\n2. Run train.py\n```\npython train.py --config config_v1.json --aug --filter --data_ratio {0.01/0.1/1.} --name phaseaug_hifigan\n```\n```\npython train.py --config config_v1_melgan.json --aug --filter --data_ratio {0.01/0.1/1.} --name phaseaug_melgan\n```\n\n\n## References\nThis implementation uses code from following repositories:\n- [Official HiFi-GAN implementation](https://github.com/jik876/hifi-gan)\n- [Official MelGAN implementation](https://github.com/descriptinc/melgan-neurips)\n- [Official CARGAN implementation](https://github.com/descriptinc/cargan)\n- [alias-free-torch](https://github.com/junjun3518/alias-free-torch)\n\nThis README and the webpage for the audio samples are inspired by:\n- [LJ Speech Dataset](https://keithito.com/LJ-Speech-Dataset/)\n- [Official HiFi-GAN implementation](https://github.com/jik876/hifi-gan)\n\n## Citation \u0026 Contact\n\nIf this repostory useful for yout research, please consider citing!\n```bib\n@INPROCEEDINGS{phaseaug,\n  author={Lee, Junhyeok and Han, Seungu and Cho, Hyunjae and Jung, Wonbin},\n  booktitle={ICASSP 2023 - 2023 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP)},\n  title={PhaseAug: A Differentiable Augmentation for Speech Synthesis to Simulate One-to-Many Mapping},\n  year={2023},\n  volume={},\n  number={},\n  pages={1-5},\n  doi={10.1109/ICASSP49357.2023.10096374}\n}\n```\n\nBibtex is updated to [ICASSP 2023 version](https://ieeexplore.ieee.org/document/10096374). Please note that page numbers are temporary numbers.\n\nIf you have a question or any kind of inquiries, please contact Junhyeok Lee at [jun3518@icloud.com](mailto:jun3518@icloud.com)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaum-ai%2Fphaseaug","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmaum-ai%2Fphaseaug","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaum-ai%2Fphaseaug/lists"}