drama_3_diffusers / README.md
OzzyGT's picture
OzzyGT HF Staff
Upload README.md
6155327 verified
|
Raw History Blame Contribute Delete
3.06 kB
---
language:
- zh
- en
- ja
- ko
- es
- pt
- ar
- ru
- fr
- de
- sv
- it
- tr
- 'no'
- nl
- cy
- eu
- ca
- da
- gl
- ta
- hu
- fi
- pl
- et
- hi
- la
- ur
- th
- vi
- jw
- bn
- yo
- sl
- cs
- sw
- nn
- he
- ms
- uk
- id
- kk
- bg
- lv
- my
- tl
- sk
- ne
- fa
- af
- el
- bo
- hr
- ro
- sn
- mi
- yi
- am
- be
- km
- is
- az
- sd
- br
- sq
- ps
- mn
- ht
- ml
- sr
- sa
- te
- ka
- bs
- pa
- lt
- kn
- si
- hy
- mr
- as
- gu
- fo
license: other
license_name: fish-audio-community-license
license_link: LICENSE
base_model:
- fishaudio/drama-3
pipeline_tag: text-to-speech
library_name: diffusers
tags:
- drama-3
- fish-audio
- modular-diffusers
- text-to-speech
- voice-cloning
---
# Drama 3 Diffusers
<audio controls src="https://huggingface.co/datasets/OzzyGT/diffusers-examples/resolve/main/drama_3/dialogue.wav"></audio>
*Generated with the code below, seed `2`.*
Diffusers version of [fishaudio/drama-3](https://huggingface.co/fishaudio/drama-3). Run it with the blocks in [OzzyGT/drama_3_custom_blocks](https://huggingface.co/OzzyGT/drama_3_custom_blocks). Built with Fish Audio.
Note: You need `diffusers>=0.41.0`, `transformers>=5.3.0` and `soundfile`.
## Licensing
The weights are under the [Fish Audio Community License](LICENSE), the same as the original; see also the [NOTICE](NOTICE). Among other terms, it does not allow cloning the voice of a real person without their consent or offering speech generation to others as a hosted service, and commercial use is limited to licensees under USD 500,000 annual revenue.
## Sample dialogue
It needs about 29 GiB of VRAM and 33 GiB of system RAM; with `slots=64`, about 21 GiB of VRAM.
```python
import soundfile as sf
import torch
from diffusers import ModularPipelineBlocks
from diffusers.utils import get_class_from_dynamic_module
blocks = ModularPipelineBlocks.from_pretrained("OzzyGT/drama_3_custom_blocks", trust_remote_code=True)
pipe = blocks.init_pipeline()
pipe.load_components(dtype={"default": torch.bfloat16, "audio_decoder": torch.float32, "codec": torch.float32})
enable_moe_cache = get_class_from_dynamic_module(
"OzzyGT/drama_3_custom_blocks", "moe_cache.py", class_name="enable_moe_cache", trust_remote_code=True
)
enable_moe_cache(pipe.backbone, slots=128, device="cuda")
pipe.audio_decoder.to("cuda")
pipe.codec.to("cuda")
prompt = (
"<|speaker:0|> [excited] Guess what? I finally got the tickets! Front row!"
"<|speaker:1|> [deep male voice] [skeptical] Front row. For the concert that sold out in four minutes."
"<|speaker:0|> [laughing] I refreshed the page for an hour, okay? Don't judge me."
"<|speaker:1|> [sighs] Fine, I'm impressed. [pause] But if you make me stand in the rain again..."
"<|speaker:0|> [whisper] It's indoors this time. I checked."
"<|speaker:1|> [laughs] Okay. Okay, I'm in."
)
state = pipe(prompt=prompt, generator=torch.Generator().manual_seed(2))
sf.write("speech.wav", state.get("audio"), state.get("sample_rate"))
```
To clone a voice, pass a clip as `reference_audio` and its transcript as `reference_text`.