Instructions to use OzzyGT/drama_3_diffusers with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use OzzyGT/drama_3_diffusers with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("OzzyGT/drama_3_diffusers", dtype=torch.bfloat16, device_map="cuda") prompt = "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k" image = pipe(prompt).images[0] - Notebooks
- Google Colab
- Kaggle
File size: 3,061 Bytes
66ab83a 6155327 66ab83a 6155327 66ab83a | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 | ---
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`.
|