Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mode 'parallel' for EncSALayer to speed up infer on ONNX #191

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

KakaruHayate
Copy link

@KakaruHayate KakaruHayate commented May 12, 2024

图片

'transformer-parallel' is widely used in GPT-J-6B and has been proven to have the same effect as traditional transformer.
It can be simplified as:
图片

This saves a skip link and a LayerNorm.This can bring a slight improvement in training speed on Diffsinger.

After experimentation, this modification has shown a more significant improvement on ONNX.
The following are the experimental parameters and results. The benchmark was performed using infer_acoustic.py, and the backbone of the model used lynxnet, without using shallow diffusion.

run_parallel
...20/20 [00:20<00:00,  1.00s/it]
run_series
...20/20 [00:23<00:00,  1.15s/it]

run_parallel
...20/20 [00:20<00:00,  1.01s/it]
run_series
...20/20 [00:22<00:00,  1.13s/it]

run_parallel
...20/20 [00:21<00:00,  1.07s/it]
run_series
...20/20 [00:23<00:00,  1.17s/it]

run_parallel
...20/20 [00:20<00:00,  1.03s/it]
run_series
...20/20 [00:22<00:00,  1.13s/it]

run_parallel
...20/20 [00:20<00:00,  1.04s/it]
run_series
...20/20 [00:23<00:00,  1.16s/it]

On average, the inference speed has increased by 8%.
This change has been applied to yousaV1.42ReFlow and there have been no reports of any issues yet.

@KakaruHayate KakaruHayate deleted the patch-1 branch May 16, 2024 02:13
@KakaruHayate KakaruHayate restored the patch-1 branch May 16, 2024 02:16
@KakaruHayate KakaruHayate deleted the patch-1 branch May 16, 2024 02:17
@KakaruHayate KakaruHayate restored the patch-1 branch May 18, 2024 10:51
@KakaruHayate KakaruHayate reopened this May 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant