Mohit5899 commited on
Commit
a891f4f
·
verified ·
1 Parent(s): 0bd9b36

Rewrite model card

Browse files
Files changed (2) hide show
  1. README.md +103 -44
  2. code/videodit.py +1 -1
README.md CHANGED
@@ -1,90 +1,149 @@
1
  ---
2
  license: mit
 
 
3
  library_name: pytorch
4
  pipeline_tag: text-to-video
5
  tags:
6
  - text-to-video
 
7
  - diffusion-transformer
8
  - rectified-flow
9
  - stickers
10
- - from-scratch
11
- - tiny
12
  ---
13
 
 
 
14
  # Bhaav-E
15
 
16
- A **212M-parameter text-to-video model** that makes **2-second animated stickers** (256 × 256, 17 frames, 8 fps, looping).
17
- It was trained from scratch for about $12 of GPU time on 75K stickers generated by code.
18
 
19
- **Try it free:** [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/Mohit-5899/bhaav-e/blob/main/bhaav_e_demo.ipynb) (runs the web demo on a free Colab GPU) · [showcase page](https://huggingface.co/spaces/Mohit5899/bhaav-e)
 
 
 
20
 
21
- Code, data generator, training logs and full evaluation: **[github.com/Mohit-5899/bhaav-e](https://github.com/Mohit-5899/bhaav-e)**
22
 
23
  | | | | |
24
- |---|---|---|---|
25
  | ![](examples/00_seed0.gif) | ![](examples/01_seed0.gif) | ![](examples/02_seed0.gif) | ![](examples/03_seed0.gif) |
26
  | *a crying emoji bouncing, tears falling, light blue background* | *a red furious emoji pulsing, steam puffing from its head, dark navy background* | *a blue success checkmark drawing itself inside a circle, confetti bursting out, white background* | *a party popper emoji pulsing, sparkles twinkling around it, light grey background* |
27
  | ![](examples/04_seed0.gif) | ![](examples/05_seed0.gif) | ![](examples/06_seed0.gif) | ![](examples/07_seed0.gif) |
28
  | *a cool emoji with sunglasses floating gently, sparkles twinkling around it, peach background* | *a glowing star emoji wobbling side to side, sparkles twinkling around it, dark navy background* | *a purple loading spinner spinning round and round, pulsing, black background* | *a screaming in shock emoji wobbling side to side, peach background* |
29
 
30
- Seed 0, 50 steps, guidance 3, first sample for each prompt (not cherry-picked).
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
31
 
32
  ## Files
33
 
34
- | file | what |
35
  |---|---|
36
- | `bhaav_e.safetensors` | r2 (release) VideoDiT, EMA weights, fp32, step 40,000 |
37
- | `config.json` | model size, sampler defaults |
38
- | `text/info.json`, `latents/vae_config.json` | caption-encoder settings and VAE latent statistics, read by `sample.py` |
39
- | `r1/` | the first run (natural data mix), same format, for comparison |
40
- | `code/videodit.py`, `code/sample.py` | the model definition and the sampler |
 
 
41
 
42
- ## Model
 
43
 
44
- - **VideoDiT** (trained, ours): 16 transformer blocks, width 768, 12 heads, 2×2 patches over a 48 × 5 × 16 × 16 latent
45
- (320 tokens). Caption through cross-attention, noise level through adaptive LayerNorm.
46
- - **Frozen, borrowed:** [Wan2.2 VAE](https://huggingface.co/Wan-AI/Wan2.2-TI2V-5B-Diffusers) (video ↔ latent),
47
- [Flan-T5-Base](https://huggingface.co/google/flan-t5-base) encoder (caption → vectors).
48
- - **Training:** rectified flow (predict `v = noise − clean`), Muon + AdamW, batch 64 × 40,000 steps, bf16, one RTX PRO
49
- 4500 for about 3.6 h (≈ $2.60). Captions dropped 10% of the time for classifier-free guidance.
50
 
51
- ## Usage
52
 
53
- Needs a CUDA GPU (tested on a 24 GB L4).
 
 
 
54
 
55
  ```bash
 
56
  pip install torch diffusers transformers sentencepiece safetensors pillow numpy huggingface_hub
57
- hf download Mohit5899/bhaav-e --local-dir bhaav-e
58
- cd bhaav-e/code && python sample.py --ckpt ../bhaav_e.safetensors --cache .. \
59
- --prompt "a crying emoji bouncing, tears falling, light blue background" --out ../samples
60
  ```
61
 
62
- Write prompts in the training style: *subject, motion, effect, background*. Known subjects are 10 emotion faces
63
- (laugh, crying, heart-eyes, facepalm, angry, shocked, wink, thinking, sleepy, cool), 10 animated emoji (fire, heart,
64
- party popper, thumbs-up, star, 100, clap, rocket, trophy, light bulb) and 10 UI animations (spinner, dots loader,
65
- success, error, like, bell, download, progress, toggle, typing). Effects: tears, tears of joy, hearts, sparkles,
66
- sweat, steam, zzz, thought bubble, confetti, embers, exhaust, none. There are 12 plain background colours.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
67
 
68
  ## Evaluation
69
 
70
- There are 256 test prompts with combinations seen in training, and 256 with combinations held out from training. Each
71
- generated sticker is checked automatically for subject, motion, effect, background and accent. A clip counts as a model
72
- error only if the checker reads the real version of that clip correctly.
73
 
74
- | | seen | unseen |
75
  |---|---|---|
76
- | r1 (natural mix) | 2.0% | 5.3% |
77
- | **r2 (this model, effects balanced per subject)** | **2.0%** | **3.3%** |
78
 
79
- The unseen difference is not statistically significant (one seed each, sign test p = 0.23). The main remaining
80
- failure is adding a subject's usual effect when none was asked for.
 
 
81
 
82
  ## Limitations
83
 
84
- A closed, tiny world: 30 subjects, 12 effects, 12 backgrounds, 256 px. It does not draw subjects outside the training
85
- set. Image-to-sticker (given first frame) was trained but the sampler does not expose it yet.
 
 
 
 
 
 
 
 
 
 
 
 
 
86
 
87
- ## Credits
88
 
89
- The emoji art in the training data is [Microsoft Fluent Emoji](https://github.com/microsoft/fluentui-emoji) (MIT). The
90
- Wan2.2 VAE and Flan-T5 are Apache-2.0.
 
1
  ---
2
  license: mit
3
+ language:
4
+ - en
5
  library_name: pytorch
6
  pipeline_tag: text-to-video
7
  tags:
8
  - text-to-video
9
+ - video-generation
10
  - diffusion-transformer
11
  - rectified-flow
12
  - stickers
13
+ - animation
 
14
  ---
15
 
16
+ <div align="center">
17
+
18
  # Bhaav-E
19
 
20
+ **A compact text-to-video model for animated stickers**
 
21
 
22
+ [![Project Page](https://img.shields.io/badge/Project-Page-e8590c)](https://huggingface.co/spaces/Mohit5899/bhaav-e)
23
+ [![GitHub](https://img.shields.io/badge/GitHub-Code-181717?logo=github)](https://github.com/Mohit-5899/bhaav-e)
24
+ [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/Mohit-5899/bhaav-e/blob/main/bhaav_e_demo.ipynb)
25
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://github.com/Mohit-5899/bhaav-e/blob/main/LICENSE)
26
 
27
+ </div>
28
 
29
  | | | | |
30
+ |:---:|:---:|:---:|:---:|
31
  | ![](examples/00_seed0.gif) | ![](examples/01_seed0.gif) | ![](examples/02_seed0.gif) | ![](examples/03_seed0.gif) |
32
  | *a crying emoji bouncing, tears falling, light blue background* | *a red furious emoji pulsing, steam puffing from its head, dark navy background* | *a blue success checkmark drawing itself inside a circle, confetti bursting out, white background* | *a party popper emoji pulsing, sparkles twinkling around it, light grey background* |
33
  | ![](examples/04_seed0.gif) | ![](examples/05_seed0.gif) | ![](examples/06_seed0.gif) | ![](examples/07_seed0.gif) |
34
  | *a cool emoji with sunglasses floating gently, sparkles twinkling around it, peach background* | *a glowing star emoji wobbling side to side, sparkles twinkling around it, dark navy background* | *a purple loading spinner spinning round and round, pulsing, black background* | *a screaming in shock emoji wobbling side to side, peach background* |
35
 
36
+ <sub>Uncurated samples (seed 0, 50 steps, guidance 3.0): the first and only sample generated for each prompt.</sub>
37
+
38
+ ## Model Details
39
+
40
+ Bhaav-E generates 2-second looping stickers from a text prompt. It is a 211.92M-parameter video diffusion
41
+ transformer trained from scratch with rectified flow, operating in the latent space of the frozen Wan2.2 video VAE and
42
+ conditioned on a frozen Flan-T5-Base text encoder.
43
+
44
+ - **Developed by:** Mohit
45
+ - **Model type:** latent video diffusion transformer (rectified flow)
46
+ - **Output:** 17 frames, 256 × 256, 8 fps, looping
47
+ - **Language:** English prompts
48
+ - **License:** MIT (frozen components: Apache-2.0)
49
+ - **Code:** [github.com/Mohit-5899/bhaav-e](https://github.com/Mohit-5899/bhaav-e)
50
+
51
+ | Component | Specification |
52
+ |---|---|
53
+ | Denoiser (trained) | 16 transformer blocks, width 768, 12 heads, 2 × 2 patches (320 tokens) |
54
+ | Text encoder (frozen) | [google/flan-t5-base](https://huggingface.co/google/flan-t5-base), max 35 tokens |
55
+ | Autoencoder (frozen) | [Wan2.2 VAE](https://huggingface.co/Wan-AI/Wan2.2-TI2V-5B-Diffusers), 48 latent channels |
56
+ | Sampler | 50 Euler steps, classifier-free guidance 3.0, time shift 5.0 |
57
 
58
  ## Files
59
 
60
+ | File | Description |
61
  |---|---|
62
+ | `bhaav_e.safetensors` | Bhaav-E (recommended): EMA weights, step 40,000, fp32 |
63
+ | `config.json` | model size and sampler defaults |
64
+ | `text/info.json`, `latents/vae_config.json` | text-encoder settings and VAE latent statistics used at inference |
65
+ | `r1/` | baseline checkpoint trained on the natural attribute distribution, same format |
66
+ | `code/` | model definition (`videodit.py`) and sampler (`sample.py`) |
67
+
68
+ ## Uses
69
 
70
+ **Intended use:** generating short animated stickers, reaction emoji and UI micro-animations, and research on small
71
+ video diffusion models, compositional generalization and evaluation with procedurally generated data.
72
 
73
+ **Out of scope:** subjects outside the training vocabulary, photorealistic video, high resolution or long clips.
 
 
 
 
 
74
 
75
+ ## How to Use
76
 
77
+ **No installation:** open the [Colab notebook](https://colab.research.google.com/github/Mohit-5899/bhaav-e/blob/main/bhaav_e_demo.ipynb),
78
+ select **Runtime → Run all**, and open the `gradio.live` link it prints. This runs the full web demo on a free GPU.
79
+
80
+ **Python** (CPU or GPU):
81
 
82
  ```bash
83
+ git clone https://github.com/Mohit-5899/bhaav-e && cd bhaav-e
84
  pip install torch diffusers transformers sentencepiece safetensors pillow numpy huggingface_hub
 
 
 
85
  ```
86
 
87
+ ```python
88
+ import sys; sys.path.insert(0, "space")
89
+ from bhaav import Bhaav, save_gif
90
+
91
+ pipe = Bhaav() # downloads this checkpoint, the VAE and the text encoder
92
+ frames = pipe.generate("a crying emoji bouncing, tears falling, light blue background",
93
+ steps=50, cfg=3.0, seed=0)
94
+ save_gif(frames, "sticker.gif")
95
+ ```
96
+
97
+ **Prompt format:** *subject, motion, effect, background*. The model supports 30 subjects (10 emotion faces, 10
98
+ animated emoji, 10 UI animations), 9 motions, 12 effects and 12 background colours; the full list is in the
99
+ [GitHub README](https://github.com/Mohit-5899/bhaav-e#prompt-format).
100
+
101
+ ## Training
102
+
103
+ | | |
104
+ |---|---|
105
+ | Data | 85,816 procedurally rendered clips; 61,571 used for training, with effects balanced per subject |
106
+ | Objective | rectified flow, MSE on predicted velocity |
107
+ | Optimizer | Muon (lr 0.02) for transformer weight matrices, AdamW (lr 2e-4) for other parameters |
108
+ | Batch size × steps | 64 × 40,000 |
109
+ | Precision | bf16 autocast |
110
+ | Compute | 1 × NVIDIA RTX PRO 4500 (32 GB), ≈ 3.6 hours |
111
 
112
  ## Evaluation
113
 
114
+ 256 prompts with attribute combinations seen in training and 256 with combinations held out from training. Automatic
115
+ checkers read subject, motion, effect, background and accent from each generated clip; errors are counted only where
116
+ the checker reads the corresponding real clip correctly.
117
 
118
+ | Model | Seen combinations | Unseen combinations |
119
  |---|---|---|
120
+ | **Bhaav-E** | **2.0%** | **3.3%** |
121
+ | Bhaav-E r1 (baseline) | 2.0% | 5.3% |
122
 
123
+ Error rate on any attribute, guidance 3.0. The dominant failure mode is effect leakage: adding the effect most
124
+ associated with a subject when none is requested. The unseen difference between the models is not statistically
125
+ significant (exact sign test, p = 0.23; one training seed each). Full report:
126
+ [runs/r2/RESULTS.md](https://github.com/Mohit-5899/bhaav-e/blob/main/runs/r2/RESULTS.md).
127
 
128
  ## Limitations
129
 
130
+ - Closed vocabulary: only the 30 trained subjects, 12 effects and 12 backgrounds.
131
+ - 256 × 256 resolution and 2-second duration.
132
+ - Unrequested effects are occasionally added.
133
+ - Evaluated with one seed per model and about 250 prompts per split.
134
+
135
+ ## Citation
136
+
137
+ ```bibtex
138
+ @misc{bhaave2026,
139
+ title = {Bhaav-E: A Compact Text-to-Video Model for Animated Stickers},
140
+ author = {Mohit},
141
+ year = {2026},
142
+ howpublished = {\url{https://github.com/Mohit-5899/bhaav-e}}
143
+ }
144
+ ```
145
 
146
+ ## Acknowledgements
147
 
148
+ Built on [Wan2.2](https://github.com/Wan-Video/Wan2.2), [Flan-T5](https://huggingface.co/google/flan-t5-base) and
149
+ [Microsoft Fluent Emoji](https://github.com/microsoft/fluentui-emoji) (MIT, training artwork).
code/videodit.py CHANGED
@@ -4,7 +4,7 @@ Design source: the DiT idea (Peebles & Xie, 2023) at the published "s210" size (
4
  12 heads, about 212M parameters). We copy the blueprint, not code; `count_params` checks we built the same size.
5
 
6
  What it does, in one line: given a noisy sketch x_t, the noise level t and a caption, predict the velocity
7
- v = noise - clean (rectified flow, see how-training-works.md 5a).
8
 
9
  Shapes (B = batch):
10
  x [B, 48, 5, 16, 16] VAE latent: 48 channels, 5 time steps, 16 x 16 positions
 
4
  12 heads, about 212M parameters). We copy the blueprint, not code; `count_params` checks we built the same size.
5
 
6
  What it does, in one line: given a noisy sketch x_t, the noise level t and a caption, predict the velocity
7
+ v = noise - clean (rectified flow, see docs/how-training-works.md 5a).
8
 
9
  Shapes (B = batch):
10
  x [B, 48, 5, 16, 16] VAE latent: 48 channels, 5 time steps, 16 x 16 positions