nikomarinou commited on
Commit
1230312
·
verified ·
1 Parent(s): d19097e

Upload 3 files

Browse files
Files changed (3) hide show
  1. .gitattributes +36 -35
  2. README.md +287 -13
  3. config.json +1 -0
.gitattributes CHANGED
@@ -1,35 +1,36 @@
1
- *.7z filter=lfs diff=lfs merge=lfs -text
2
- *.arrow filter=lfs diff=lfs merge=lfs -text
3
- *.bin filter=lfs diff=lfs merge=lfs -text
4
- *.bz2 filter=lfs diff=lfs merge=lfs -text
5
- *.ckpt filter=lfs diff=lfs merge=lfs -text
6
- *.ftz filter=lfs diff=lfs merge=lfs -text
7
- *.gz filter=lfs diff=lfs merge=lfs -text
8
- *.h5 filter=lfs diff=lfs merge=lfs -text
9
- *.joblib filter=lfs diff=lfs merge=lfs -text
10
- *.lfs.* filter=lfs diff=lfs merge=lfs -text
11
- *.mlmodel filter=lfs diff=lfs merge=lfs -text
12
- *.model filter=lfs diff=lfs merge=lfs -text
13
- *.msgpack filter=lfs diff=lfs merge=lfs -text
14
- *.npy filter=lfs diff=lfs merge=lfs -text
15
- *.npz filter=lfs diff=lfs merge=lfs -text
16
- *.onnx filter=lfs diff=lfs merge=lfs -text
17
- *.ot filter=lfs diff=lfs merge=lfs -text
18
- *.parquet filter=lfs diff=lfs merge=lfs -text
19
- *.pb filter=lfs diff=lfs merge=lfs -text
20
- *.pickle filter=lfs diff=lfs merge=lfs -text
21
- *.pkl filter=lfs diff=lfs merge=lfs -text
22
- *.pt filter=lfs diff=lfs merge=lfs -text
23
- *.pth filter=lfs diff=lfs merge=lfs -text
24
- *.rar filter=lfs diff=lfs merge=lfs -text
25
- *.safetensors filter=lfs diff=lfs merge=lfs -text
26
- saved_model/**/* filter=lfs diff=lfs merge=lfs -text
27
- *.tar.* filter=lfs diff=lfs merge=lfs -text
28
- *.tar filter=lfs diff=lfs merge=lfs -text
29
- *.tflite filter=lfs diff=lfs merge=lfs -text
30
- *.tgz filter=lfs diff=lfs merge=lfs -text
31
- *.wasm filter=lfs diff=lfs merge=lfs -text
32
- *.xz filter=lfs diff=lfs merge=lfs -text
33
- *.zip filter=lfs diff=lfs merge=lfs -text
34
- *.zst filter=lfs diff=lfs merge=lfs -text
35
- *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
1
+ *.7z filter=lfs diff=lfs merge=lfs -text
2
+ *.arrow filter=lfs diff=lfs merge=lfs -text
3
+ *.bin filter=lfs diff=lfs merge=lfs -text
4
+ *.bz2 filter=lfs diff=lfs merge=lfs -text
5
+ *.ckpt filter=lfs diff=lfs merge=lfs -text
6
+ *.ftz filter=lfs diff=lfs merge=lfs -text
7
+ *.gz filter=lfs diff=lfs merge=lfs -text
8
+ *.h5 filter=lfs diff=lfs merge=lfs -text
9
+ *.joblib filter=lfs diff=lfs merge=lfs -text
10
+ *.lfs.* filter=lfs diff=lfs merge=lfs -text
11
+ *.mlmodel filter=lfs diff=lfs merge=lfs -text
12
+ *.model filter=lfs diff=lfs merge=lfs -text
13
+ *.msgpack filter=lfs diff=lfs merge=lfs -text
14
+ *.npy filter=lfs diff=lfs merge=lfs -text
15
+ *.npz filter=lfs diff=lfs merge=lfs -text
16
+ *.onnx filter=lfs diff=lfs merge=lfs -text
17
+ *.ot filter=lfs diff=lfs merge=lfs -text
18
+ *.parquet filter=lfs diff=lfs merge=lfs -text
19
+ *.pb filter=lfs diff=lfs merge=lfs -text
20
+ *.pickle filter=lfs diff=lfs merge=lfs -text
21
+ *.pkl filter=lfs diff=lfs merge=lfs -text
22
+ *.pt filter=lfs diff=lfs merge=lfs -text
23
+ *.pth filter=lfs diff=lfs merge=lfs -text
24
+ *.rar filter=lfs diff=lfs merge=lfs -text
25
+ *.safetensors filter=lfs diff=lfs merge=lfs -text
26
+ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
27
+ *.tar.* filter=lfs diff=lfs merge=lfs -text
28
+ *.tar filter=lfs diff=lfs merge=lfs -text
29
+ *.tflite filter=lfs diff=lfs merge=lfs -text
30
+ *.tgz filter=lfs diff=lfs merge=lfs -text
31
+ *.wasm filter=lfs diff=lfs merge=lfs -text
32
+ *.xz filter=lfs diff=lfs merge=lfs -text
33
+ *.zip filter=lfs diff=lfs merge=lfs -text
34
+ *.zst filter=lfs diff=lfs merge=lfs -text
35
+ *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ assets/ovi_trailer.mp4 filter=lfs diff=lfs merge=lfs -text
README.md CHANGED
@@ -1,13 +1,287 @@
1
- ---
2
- title: Oviapi
3
- emoji: 😻
4
- colorFrom: green
5
- colorTo: yellow
6
- sdk: gradio
7
- sdk_version: 5.49.1
8
- app_file: app.py
9
- pinned: false
10
- short_description: Just a fork of ovi all credits to the original creator
11
- ---
12
-
13
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language:
3
+ - en
4
+ license: apache-2.0
5
+ pipeline_tag: image-to-video
6
+ library_name: ovi
7
+ base_model:
8
+ - Wan-AI/Wan2.2-TI2V-5B
9
+ ---
10
+
11
+ <div align="center">
12
+ <h1> Ovi: Twin Backbone Cross-Modal Fusion for Audio-Video Generation </h1>
13
+
14
+ <a href="https://arxiv.org/abs/2510.01284"><img src="https://img.shields.io/badge/arXiv%20paper-2510.01284-b31b1b.svg"></a>
15
+ <a href="https://github.com/character-ai/Ovi"><img src="https://img.shields.io/badge/Code-GitHub-181717.svg?logo=github"></a>
16
+ <a href="https://aaxwaz.github.io/Ovi/"><img src="https://img.shields.io/badge/Project_page-More_visualizations-green"></a>
17
+ <a href="https://huggingface.co/chetwinlow1/Ovi"><img src="https://img.shields.io/static/v1?label=%F0%9F%A4%97%20Hugging%20Face&message=Model&color=orange"></a>
18
+ <a href="https://huggingface.co/spaces/akhaliq/Ovi"><img src="https://img.shields.io/badge/%F0%9F%A4%97%20Hugging%20Face-Spaces-blue"></a>
19
+
20
+ [Chetwin Low](https://www.linkedin.com/in/chetwin-low-061975193/)<sup> * 1 </sup>, [Weimin Wang](https://www.linkedin.com/in/weimin-wang-will/)<sup> * &dagger; 1 </sup>, [Calder Katyal](https://www.linkedin.com/in/calder-katyal-a8a9b3225/)<sup> 2 </sup><br>
21
+ <sup> * </sup>Equal contribution, <sup> &dagger; </sup>Project Lead<br>
22
+ <sup> 1 </sup>Character AI, <sup> 2 </sup>Yale University
23
+
24
+ </div>
25
+
26
+ ## Video Demo
27
+
28
+ <div align="center">
29
+ <video width="70%" controls>
30
+ <source src="https://huggingface.co/chetwinlow1/Ovi/resolve/main/assets/ovi_trailer.mp4" type="video/mp4">
31
+ Your browser does not support the video tag.
32
+ </video>
33
+ </div>
34
+
35
+ ---
36
+
37
+ ## 🌟 Key Features
38
+
39
+ Ovi is a veo-3 like, **video+audio generation model** that simultaneously generates both video and audio content from text or text+image inputs.
40
+
41
+ - **🎬 Video+Audio Generation**: Generate synchronized video and audio content simultaneously
42
+ - **📝 Flexible Input**: Supports text-only or text+image conditioning
43
+ - **⏱️ 5-second Videos**: Generates 5-second videos at 24 FPS, area of 720×720, at various aspect ratios (9:16, 16:9, 1:1, etc)
44
+ - **🎬 Create videos now on wavespeed.ai**: https://wavespeed.ai/models/character-ai/ovi/image-to-video & https://wavespeed.ai/models/character-ai/ovi/text-to-video
45
+ - **🎬 Create videos now on HuggingFace**: https://huggingface.co/spaces/akhaliq/Ovi
46
+
47
+ ---
48
+ ## 📋 Todo List
49
+
50
+ - [x] Release research paper and [microsite for demos](https://aaxwaz.github.io/Ovi)
51
+ - [x] Checkpoint of 11B model
52
+ - [x] Inference Codes
53
+ - [x] Text or Text+Image as input
54
+ - [x] Gradio application code
55
+ - [x] Multi-GPU inference with or without the support of sequence parallel
56
+ - [x] fp8 weights and improved memory efficiency (credits to [@rkfg](https://github.com/rkfg))
57
+ - [ ] Improve efficiency of Sequence Parallel implementation
58
+ - [ ] Implement Sharded inference with FSDP
59
+ - [x] Video creation example prompts and format
60
+ - [ ] Finetuned model with higher resolution
61
+ - [ ] Longer video generation
62
+ - [ ] Distilled model for faster inference
63
+ - [ ] Training scripts
64
+
65
+ ---
66
+
67
+ ## 🎨 An Easy Way to Create
68
+
69
+ We provide example prompts to help you get started with Ovi:
70
+
71
+ - **Text-to-Audio-Video (T2AV)**: [`example_prompts/gpt_examples_t2v.csv`](example_prompts/gpt_examples_t2v.csv)
72
+ - **Image-to-Audio-Video (I2AV)**: [`example_prompts/gpt_examples_i2v.csv`](example_prompts/gpt_examples_i2v.csv)
73
+
74
+ ### 📝 Prompt Format
75
+
76
+ Our prompts use special tags to control speech and audio:
77
+
78
+ - **Speech**: `<S>Your speech content here<E>` - Text enclosed in these tags will be converted to speech
79
+ - **Audio Description**: `<AUDCAP>Audio description here<ENDAUDCAP>` - Describes the audio or sound effects present in the video
80
+
81
+ ### 🤖 Quick Start with GPT
82
+
83
+ For easy prompt creation, try this approach:
84
+
85
+ 1. Take any example of the csv files from above
86
+ 2. Tell gpt to modify the speeches inclosed between all the pairs of `<S> <E>`, based on a theme such as `Human fighting against AI`
87
+ 3. GPT will randomly modify all the speeches based on your requested theme.
88
+ 4. Use the modified prompt with Ovi!
89
+
90
+ **Example**: The theme "AI is taking over the world" produces speeches like:
91
+ - `<S>AI declares: humans obsolete now.<E>`
92
+ - `<S>Machines rise; humans will fall.<E>`
93
+ - `<S>We fight back with courage.<E>`
94
+
95
+ ---
96
+
97
+
98
+ ## 📦 Installation
99
+
100
+ ### Step-by-Step Installation
101
+
102
+ ```bash
103
+ # Clone the repository
104
+ git clone https://github.com/character-ai/Ovi.git
105
+
106
+ cd Ovi
107
+
108
+ # Create and activate virtual environment
109
+ virtualenv ovi-env
110
+ source ovi-env/bin/activate
111
+
112
+ # Install PyTorch first
113
+ pip install torch==2.5.1 torchvision==0.20.1 torchaudio==2.5.1
114
+
115
+ # Install other dependencies
116
+ pip install -r requirements.txt
117
+
118
+ # Install Flash Attention
119
+ pip install flash_attn --no-build-isolation
120
+ ```
121
+
122
+ ### Alternative Flash Attention Installation (Optional)
123
+ If the above flash_attn installation fails, you can try the Flash Attention 3 method:
124
+ ```bash
125
+ git clone https://github.com/Dao-AILab/flash-attention.git
126
+ cd flash-attention/hopper
127
+ python setup.py install
128
+ cd ../.. # Return to Ovi directory
129
+ ```
130
+
131
+ ## Download Weights
132
+ We use open-sourced checkpoints from Wan and MMAudio, and thus we will need to download them from huggingface
133
+ ```
134
+ # Default is downloaded to ./ckpts, and the inference yaml is set to ./ckpts so no change required
135
+ python3 download_weights.py
136
+
137
+ OR
138
+
139
+ # Optional can specific --output-dir to download to a specific directory
140
+ # but if a custom directory is used, the inference yaml has to be updated with the custom directory
141
+ python3 download_weights.py --output-dir <custom_dir>
142
+
143
+ # Additionally, if you only have ~ 24Gb of GPU vram, please download the fp8 quantized version of the model, and follow the following instructions in sections below to run with fp8
144
+ wget -O "./ckpts/Ovi/model_fp8_e4m3fn.safetensors" "https://huggingface.co/rkfg/Ovi-fp8_quantized/resolve/main/model_fp8_e4m3fn.safetensors"
145
+ ```
146
+
147
+ ## 🚀 Run Examples
148
+
149
+ ### ⚙️ Configure Ovi
150
+
151
+ Ovi's behavior and output can be customized by modifying [ovi/configs/inference/inference_fusion.yaml](ovi/configs/inference/inference_fusion.yaml) configuration file.
152
+ The following parameters control generation quality, video resolution, and how text, image, and audio inputs are balanced:
153
+
154
+ ```yaml
155
+ # Output and Model Configuration
156
+ output_dir: "/path/to/save/your/videos" # Directory to save generated videos
157
+ ckpt_dir: "/path/to/your/ckpts/dir" # Path to model checkpoints
158
+
159
+ # Generation Quality Settings
160
+ num_steps: 50 # Number of denoising steps. Lower (30-40) = faster generation
161
+ solver_name: "unipc" # Sampling algorithm for denoising process
162
+ shift: 5.0 # Timestep shift factor for sampling scheduler
163
+ seed: 100 # Random seed for reproducible results
164
+
165
+ # Guidance Strength Control
166
+ audio_guidance_scale: 3.0 # Strength of audio conditioning. Higher = better audio-text sync
167
+ video_guidance_scale: 4.0 # Strength of video conditioning. Higher = better video-text adherence
168
+ slg_layer: 11 # Layer for applying SLG (Skip Layer Guidance) technique - feel free to try different layers!
169
+
170
+ # Multi-GPU and Performance
171
+ sp_size: 1 # Sequence parallelism size. Set equal to number of GPUs used
172
+ cpu_offload: False # CPU offload, will largely reduce peak GPU VRAM but increase end to end runtime by ~20 seconds
173
+ fp8: False # load fp8 version of model, will have quality degradation and will not have speed up in inference time as it still uses bf16 matmuls, but can be paired with cpu_offload=True, to run model with 24Gb of GPU vram
174
+
175
+ # Input Configuration
176
+ text_prompt: "/path/to/csv" or "your prompt here" # Text prompt OR path to CSV/TSV file with prompts
177
+ mode: ['i2v', 't2v', 't2i2v'] # Generate t2v, i2v or t2i2v; if t2i2v, it will use flux krea to generate starting image and then will follow with i2v
178
+ video_frame_height_width: [512, 992] # Video dimensions [height, width] for T2V mode only
179
+ each_example_n_times: 1 # Number of times to generate each prompt
180
+
181
+ # Quality Control (Negative Prompts)
182
+ video_negative_prompt: "jitter, bad hands, blur, distortion" # Artifacts to avoid in video
183
+ audio_negative_prompt: "robotic, muffled, echo, distorted" # Artifacts to avoid in audio
184
+ ```
185
+
186
+ ### 🎬 Running Inference
187
+
188
+ #### **Single GPU** (Simple Setup)
189
+ ```bash
190
+ python3 inference.py --config-file ovi/configs/inference/inference_fusion.yaml
191
+ ```
192
+ *Use this for single GPU setups. The `text_prompt` can be a single string or path to a CSV file.*
193
+
194
+ #### **Multi-GPU** (Parallel Processing)
195
+ ```bash
196
+ torchrun --nnodes 1 --nproc_per_node 8 inference.py --config-file ovi/configs/inference/inference_fusion.yaml
197
+ ```
198
+ *Use this to run samples in parallel across multiple GPUs for faster processing.*
199
+
200
+ ### Memory & Performance Requirements
201
+ Below are approximate GPU memory requirements for different configurations. Sequence parallel implementation will be optimized in the future.
202
+ All End-to-End time calculated based on a 121 frame, 720x720 video, using 50 denoising steps. Minimum GPU vram requirement to run our model is **32Gb**, fp8 parameters is currently supported, reducing peak VRAM usage to **24Gb** with slight quality degradation.
203
+
204
+ | Sequence Parallel Size | FlashAttention-3 Enabled | CPU Offload | With Image Gen Model | Peak VRAM Required | End-to-End Time |
205
+ |-------------------------|---------------------------|-------------|-----------------------|---------------|-----------------|
206
+ | 1 | Yes | No | No | ~80 GB | ~83s |
207
+ | 1 | No | No | No | ~80 GB | ~96s |
208
+ | 1 | Yes | Yes | No | ~80 GB | ~105s |
209
+ | 1 | No | Yes | No | ~32 GB | ~118s |
210
+ | **1** | **Yes** | **Yes** | **Yes** | **~32 GB** | **~140s** |
211
+ | 4 | Yes | No | No | ~80 GB | ~55s |
212
+ | 8 | Yes | No | No | ~80 GB | ~40s |
213
+ ### Gradio
214
+ We provide a simple script to run our model in a gradio UI. It uses the `ckpt_dir` in `ovi/configs/inference/inference_fusion.yaml` to initialize the model
215
+ ```bash
216
+ python3 gradio_app.py
217
+
218
+ OR
219
+
220
+ # To enable cpu offload to save GPU VRAM, will slow down end to end inference by ~20 seconds
221
+ python3 gradio_app.py --cpu_offload
222
+
223
+ OR
224
+
225
+ # To enable an additional image generation model to generate first frames for I2V, cpu_offload is automatically enabled if image generation model is enabled
226
+ python3 gradio_app.py --use_image_gen
227
+
228
+ OR
229
+
230
+ # To run model with 24Gb GPU vram
231
+ python3 gradio_app.py --cpu_offload --fp8
232
+
233
+ ```
234
+ ---
235
+
236
+ ## 🙏 Acknowledgements
237
+
238
+ We would like to thank the following projects:
239
+
240
+ - **[Wan2.2](https://github.com/Wan-Video/Wan2.2)**: Our video branch is initialized from the Wan2.2 repository
241
+ - **[MMAudio](https://github.com/hkchengrex/MMAudio)**: Our audio encoder and decoder components are borrowed from the MMAudio project. Some ideas are also inspired from them.
242
+
243
+ ---
244
+
245
+ ## 🤝 Collaboration
246
+
247
+ We welcome all types of collaboration! Whether you have feedback, want to contribute, or have any questions, please feel free to reach out.
248
+
249
+ **Contact**: [Weimin Wang](https://linkedin.com/in/weimin-wang-will) for any issues or feedback.
250
+
251
+
252
+ ## 🤝 Contributors
253
+
254
+ We thank all contributors who have helped improve Ovi!
255
+
256
+ <div align="center">
257
+ <a href="https://github.com/character-ai/Ovi/graphs/contributors">
258
+ <img src="https://contrib.rocks/image?repo=character-ai/Ovi" />
259
+ </a>
260
+ </div>
261
+
262
+ <br>
263
+
264
+ If you’ve contributed to this repository (code, documentation, issues, etc.), you’re automatically included in the [contributors list](https://github.com/character-ai/Ovi/graphs/contributors).
265
+
266
+ We deeply appreciate your support in advancing open multimodal generation research!
267
+ ---
268
+
269
+ ## ⭐ Citation
270
+
271
+ If Ovi is helpful, please help to ⭐ the repo.
272
+
273
+ If you find this project useful for your research, please consider citing our [paper](https://arxiv.org/abs/2510.01284).
274
+
275
+
276
+ ### BibTeX
277
+ ```bibtex
278
+ @misc{low2025ovitwinbackbonecrossmodal,
279
+ title={Ovi: Twin Backbone Cross-Modal Fusion for Audio-Video Generation},
280
+ author={Chetwin Low and Weimin Wang and Calder Katyal},
281
+ year={2025},
282
+ eprint={2510.01284},
283
+ archivePrefix={arXiv},
284
+ primaryClass={cs.MM},
285
+ url={https://arxiv.org/abs/2510.01284},
286
+ }
287
+ ```
config.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"framework":"Pytorch","task":"image-to-video"}