buttercrab commited on
Commit
033902b
·
1 Parent(s): 2dd3b31

add README

Browse files
Files changed (1) hide show
  1. README.md +131 -0
README.md ADDED
@@ -0,0 +1,131 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ pipeline_tag: text-to-speech
4
+ language:
5
+ - en
6
+ tags:
7
+ - model_hub_mixin
8
+ - pytorch_model_hub_mixin
9
+ widget:
10
+ - text: "[S1] Dia is an open weights text to dialogue model. [S2] You get full control over scripts and voices. [S1] Wow. Amazing. (laughs) [S2] Try it now on Git hub or Hugging Face."
11
+ example_title: "Dia intro"
12
+ - text: "[S1] Oh fire! Oh my goodness! What's the procedure? What to we do people? The smoke could be coming through an air duct! [S2] Oh my god! Okay.. it's happening. Everybody stay calm! [S1] What's the procedure... [S2] Everybody stay fucking calm!!!... Everybody fucking calm down!!!!! [S1] No! No! If you touch the handle, if its hot there might be a fire down the hallway!"
13
+ example_title: "Panic protocol"
14
+ ---
15
+
16
+ <center>
17
+ <a href="https://github.com/nari-labs/dia">
18
+ <img src="https://github.com/nari-labs/dia/raw/main/dia/static/images/banner.png">
19
+ </a>
20
+ </center>
21
+
22
+ Dia is a 1.6B parameter text to speech model created by Nari Labs. It was pushed to the Hub using the [PytorchModelHubMixin](https://huggingface.co/docs/huggingface_hub/package_reference/mixins#huggingface_hub.PyTorchModelHubMixin) integration.
23
+
24
+ Dia **directly generates highly realistic dialogue from a transcript**. You can condition the output on audio, enabling emotion and tone control. The model can also produce nonverbal communications like laughter, coughing, clearing throat, etc.
25
+
26
+ To accelerate research, we are providing access to pretrained model checkpoints and inference code. The model weights are hosted on [Hugging Face](https://huggingface.co/nari-labs/Dia-1.6B). The model only supports English generation at the moment.
27
+
28
+ We also provide a [demo page](https://yummy-fir-7a4.notion.site/dia) comparing our model to [ElevenLabs Studio](https://elevenlabs.io/studio) and [Sesame CSM-1B](https://github.com/SesameAILabs/csm).
29
+
30
+ - (Update) We have a ZeroGPU Space running! Try it now [here](https://huggingface.co/spaces/nari-labs/Dia-1.6B). Thanks to the HF team for the support :)
31
+ - Join our [discord server](https://discord.gg/bJq6vjRRKv) for community support and access to new features.
32
+ - Play with a larger version of Dia: generate fun conversations, remix content, and share with friends. 🔮 Join the [waitlist](https://tally.so/r/meokbo) for early access.
33
+
34
+ ## ⚡️ Quickstart
35
+
36
+ This will open a Gradio UI that you can work on.
37
+
38
+ ```bash
39
+ git clone https://github.com/nari-labs/dia.git
40
+ cd dia && uv run app.py
41
+ ```
42
+
43
+ or if you do not have `uv` pre-installed:
44
+
45
+ ```bash
46
+ git clone https://github.com/nari-labs/dia.git
47
+ cd dia
48
+ python -m venv .venv
49
+ source .venv/bin/activate
50
+ pip install uv
51
+ uv run app.py
52
+ ```
53
+
54
+ Note that the model was not fine-tuned on a specific voice. Hence, you will get different voices every time you run the model.
55
+ You can keep speaker consistency by either adding an audio prompt (a guide coming VERY soon - try it with the second example on Gradio for now), or fixing the seed.
56
+
57
+ ## Features
58
+
59
+ - Generate dialogue via `[S1]` and `[S2]` tag
60
+ - Generate non-verbal like `(laughs)`, `(coughs)`, etc.
61
+ - Below verbal tags will be recognized, but might result in unexpected output.
62
+ - `(laughs), (clears throat), (sighs), (gasps), (coughs), (singing), (sings), (mumbles), (beep), (groans), (sniffs), (claps), (screams), (inhales), (exhales), (applause), (burps), (humming), (sneezes), (chuckle), (whistles)`
63
+ - Voice cloning. See [`example/voice_clone.py`](example/voice_clone.py) for more information.
64
+ - In the Hugging Face space, you can upload the audio you want to clone and place its transcript before your script. Make sure the transcript follows the required format. The model will then output only the content of your script.
65
+
66
+ ## ⚙️ Usage
67
+
68
+ ### As a Python Library
69
+
70
+ ```python
71
+ import soundfile as sf
72
+
73
+ from dia.model import Dia
74
+
75
+
76
+ model = Dia.from_pretrained("nari-labs/Dia-1.6B")
77
+
78
+ text = "[S1] Dia is an open weights text to dialogue model. [S2] You get full control over scripts and voices. [S1] Wow. Amazing. (laughs) [S2] Try it now on Git hub or Hugging Face."
79
+
80
+ output = model.generate(text)
81
+
82
+ sf.write("simple.mp3", output, 44100)
83
+ ```
84
+
85
+ A pypi package and a working CLI tool will be available soon.
86
+
87
+ ## 💻 Hardware and Inference Speed
88
+
89
+ Dia has been tested on only GPUs (pytorch 2.0+, CUDA 12.6). CPU support is to be added soon.
90
+ The initial run will take longer as the Descript Audio Codec also needs to be downloaded.
91
+
92
+ On enterprise GPUs, Dia can generate audio in real-time. On older GPUs, inference time will be slower.
93
+ For reference, on a A4000 GPU, Dia roughly generates 40 tokens/s (86 tokens equals 1 second of audio).
94
+ `torch.compile` will increase speeds for supported GPUs.
95
+
96
+ The full version of Dia requires around 10GB of VRAM to run. We will be adding a quantized version in the future.
97
+
98
+ If you don't have hardware available or if you want to play with bigger versions of our models, join the waitlist [here](https://tally.so/r/meokbo).
99
+
100
+ ## 🪪 License
101
+
102
+ This project is licensed under the Apache License 2.0 - see the [LICENSE](LICENSE) file for details.
103
+
104
+ ## ⚠️ Disclaimer
105
+
106
+ This project offers a high-fidelity speech generation model intended for research and educational use. The following uses are **strictly forbidden**:
107
+
108
+ - **Identity Misuse**: Do not produce audio resembling real individuals without permission.
109
+ - **Deceptive Content**: Do not use this model to generate misleading content (e.g. fake news)
110
+ - **Illegal or Malicious Use**: Do not use this model for activities that are illegal or intended to cause harm.
111
+
112
+ By using this model, you agree to uphold relevant legal standards and ethical responsibilities. We **are not responsible** for any misuse and firmly oppose any unethical usage of this technology.
113
+
114
+ ## 🔭 TODO / Future Work
115
+
116
+ - Docker support.
117
+ - Optimize inference speed.
118
+ - Add quantization for memory efficiency.
119
+
120
+ ## 🤝 Contributing
121
+
122
+ We are a tiny team of 1 full-time and 1 part-time research-engineers. We are extra-welcome to any contributions!
123
+ Join our [Discord Server](https://discord.gg/bJq6vjRRKv) for discussions.
124
+
125
+ ## 🤗 Acknowledgements
126
+
127
+ - We thank the [Google TPU Research Cloud program](https://sites.research.google/trc/about/) for providing computation resources.
128
+ - Our work was heavily inspired by [SoundStorm](https://arxiv.org/abs/2305.09636), [Parakeet](https://jordandarefsky.com/blog/2024/parakeet/), and [Descript Audio Codec](https://github.com/descriptinc/descript-audio-codec).
129
+ - HuggingFace for providing the ZeroGPU Grant.
130
+ - "Nari" is a pure Korean word for lily.
131
+ - We thank Jason Y. for providing help with data filtering.