初始化项目,由ModelHub XC社区提供模型
Model: srk0102200/AnimTOON-3B Source: Original Platform
This commit is contained in:
36
.gitattributes
vendored
Normal file
36
.gitattributes
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
*.7z filter=lfs diff=lfs merge=lfs -text
|
||||
*.arrow filter=lfs diff=lfs merge=lfs -text
|
||||
*.bin filter=lfs diff=lfs merge=lfs -text
|
||||
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
||||
*.ckpt filter=lfs diff=lfs merge=lfs -text
|
||||
*.ftz filter=lfs diff=lfs merge=lfs -text
|
||||
*.gz filter=lfs diff=lfs merge=lfs -text
|
||||
*.h5 filter=lfs diff=lfs merge=lfs -text
|
||||
*.joblib filter=lfs diff=lfs merge=lfs -text
|
||||
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
||||
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
||||
*.model filter=lfs diff=lfs merge=lfs -text
|
||||
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
||||
*.npy filter=lfs diff=lfs merge=lfs -text
|
||||
*.npz filter=lfs diff=lfs merge=lfs -text
|
||||
*.onnx filter=lfs diff=lfs merge=lfs -text
|
||||
*.ot filter=lfs diff=lfs merge=lfs -text
|
||||
*.parquet filter=lfs diff=lfs merge=lfs -text
|
||||
*.pb filter=lfs diff=lfs merge=lfs -text
|
||||
*.pickle filter=lfs diff=lfs merge=lfs -text
|
||||
*.pkl filter=lfs diff=lfs merge=lfs -text
|
||||
*.pt filter=lfs diff=lfs merge=lfs -text
|
||||
*.pth filter=lfs diff=lfs merge=lfs -text
|
||||
*.rar filter=lfs diff=lfs merge=lfs -text
|
||||
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
||||
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
||||
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
||||
*.tar filter=lfs diff=lfs merge=lfs -text
|
||||
*.tflite filter=lfs diff=lfs merge=lfs -text
|
||||
*.tgz filter=lfs diff=lfs merge=lfs -text
|
||||
*.wasm filter=lfs diff=lfs merge=lfs -text
|
||||
*.xz filter=lfs diff=lfs merge=lfs -text
|
||||
*.zip filter=lfs diff=lfs merge=lfs -text
|
||||
*.zst filter=lfs diff=lfs merge=lfs -text
|
||||
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
||||
tokenizer.json filter=lfs diff=lfs merge=lfs -text
|
||||
179
README.md
Normal file
179
README.md
Normal file
@@ -0,0 +1,179 @@
|
||||
---
|
||||
language:
|
||||
- en
|
||||
license: mit
|
||||
library_name: transformers
|
||||
base_model: Qwen/Qwen2.5-3B-Instruct
|
||||
tags:
|
||||
- animation
|
||||
- lottie
|
||||
- svg
|
||||
- animtoon
|
||||
- vector-animation
|
||||
- text-to-animation
|
||||
- conversational
|
||||
- text-generation-inference
|
||||
datasets:
|
||||
- OmniLottie/MMLottie-2M
|
||||
pipeline_tag: text-generation
|
||||
---
|
||||
|
||||
# AnimTOON-3B (v3): Token-Efficient Vector Animation Generation
|
||||
|
||||
**3-4x fewer tokens than OmniLottie (CVPR 2026) for generating Lottie animations. Now with character animation support.**
|
||||
|
||||
| | AnimTOON | OmniLottie |
|
||||
|---|---|---|
|
||||
| **Tokens (simple)** | **166** | 616 |
|
||||
| **Tokens (complex)** | **597** | 4095 |
|
||||
| **VRAM** | **5GB** | 15.2GB |
|
||||
| **FPS** | **30** | 8 |
|
||||
| **Model Size** | **3B LoRA** | 4B full |
|
||||
| **Custom Tokenizer** | **No** | Yes (40k tokens) |
|
||||
| **Accepts SVG** | **Yes** | No |
|
||||
|
||||
## What is AnimTOON?
|
||||
|
||||
AnimTOON is a compact, plain-text animation format that any LLM can generate. Instead of outputting 18,000+ tokens of raw Lottie JSON, AnimTOON describes animations in ~166-597 tokens of human-readable text.
|
||||
|
||||
```
|
||||
anim fr=30 dur=120
|
||||
|
||||
layer Logo shape
|
||||
fill #000000
|
||||
path sh x2
|
||||
pos [0.5,0.5]
|
||||
rot 0.0->-67 0.04->46 0.14->-31 0.28->0 ease=bounce
|
||||
scale 0.0->[0,0] 0.14->[90,90] 0.28->[100,100] ease=smooth
|
||||
opacity 0.0->0 0.14->100 ease=fade
|
||||
```
|
||||
|
||||
This produces a complete animated .lottie file with bounce entrance, rotation wobble, and fade-in.
|
||||
|
||||
## How to Use
|
||||
|
||||
```python
|
||||
from transformers import AutoModelForCausalLM, AutoTokenizer
|
||||
import torch
|
||||
|
||||
tokenizer = AutoTokenizer.from_pretrained("srk0102200/AnimTOON-3B")
|
||||
model = AutoModelForCausalLM.from_pretrained(
|
||||
"srk0102200/AnimTOON-3B",
|
||||
dtype=torch.float16,
|
||||
device_map="cuda"
|
||||
)
|
||||
|
||||
prompt = "a red circle pulsing in the center with a smooth bounce"
|
||||
messages = [{"role": "user", "content": f"Generate AnimTOON animation: {prompt}"}]
|
||||
text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
|
||||
inputs = tokenizer(text, return_tensors="pt").to("cuda")
|
||||
|
||||
with torch.no_grad():
|
||||
out = model.generate(**inputs, max_new_tokens=512, temperature=0.7, do_sample=True)
|
||||
result = tokenizer.decode(out[0][inputs["input_ids"].shape[1]:], skip_special_tokens=True)
|
||||
print(result)
|
||||
```
|
||||
|
||||
## Convert to .lottie
|
||||
|
||||
```python
|
||||
# Clone: git clone https://github.com/srk0102/AnimTOON.git
|
||||
import sys; sys.path.insert(0, 'src')
|
||||
from toon_animator import animtoon_to_dotlottie_full
|
||||
|
||||
animtoon_to_dotlottie_full(result, "output.lottie")
|
||||
# Preview at https://lottiefiles.com/preview
|
||||
```
|
||||
|
||||
## Animate Any SVG
|
||||
|
||||
```python
|
||||
from lottie import parsers # pip install lottie
|
||||
|
||||
# Convert SVG to Lottie (perfect paths)
|
||||
anim = parsers.svg.parse_svg_file("your_logo.svg")
|
||||
lottie_dict = anim.to_dict()
|
||||
|
||||
# Generate AnimTOON animations with the model
|
||||
# Apply animations to the Lottie layers
|
||||
# Output: .lottie file with real SVG shapes + AI animations
|
||||
```
|
||||
|
||||
See full pipeline: [test_svg_pipeline.py](https://github.com/srk0102/AnimTOON/blob/master/test_svg_pipeline.py)
|
||||
|
||||
## Benchmark Results (Measured)
|
||||
|
||||
**Same prompt, same hardware:**
|
||||
|
||||
| Test | AnimTOON Tokens | OmniLottie Tokens | Ratio |
|
||||
|------|----------------|-------------------|-------|
|
||||
| Apple logo bounce | 207 (41 shape + 166 anim) | 1113 | 5.4x fewer |
|
||||
| Smiley face complex | 597 | 4095 | 6.9x fewer |
|
||||
| Simple ball bounce | 176 | 616 | 3.5x fewer |
|
||||
|
||||
**Dataset statistics (99,650 samples):**
|
||||
- Average raw Lottie JSON: 18,202 tokens
|
||||
- Average AnimTOON: 222 tokens
|
||||
- Token reduction: 98.8%
|
||||
|
||||
## Current Status (v3)
|
||||
|
||||
**v3 adds character animation support** trained on Spine + DragonBones skeletal data.
|
||||
|
||||
The model now works for:
|
||||
- Icon/logo animations (pulse, bounce, spin, fade, wobble)
|
||||
- **Character idle/walk cycles (14 layers, coordinated)**
|
||||
- **Multi-part SVG animation (47-part crab demo)**
|
||||
- Correct color matching from text descriptions
|
||||
- SVG + animation pipeline with per-part anchor points
|
||||
|
||||
**Limitations:**
|
||||
- No shape generation (requires SVG input)
|
||||
- Model output varies between runs (temperature-dependent)
|
||||
- Position animation on shape groups not yet supported
|
||||
- Not yet trained on facial expressions
|
||||
|
||||
## Training Details
|
||||
|
||||
| Parameter | Value |
|
||||
|-----------|-------|
|
||||
| Base Model | Qwen/Qwen2.5-3B-Instruct |
|
||||
| Method | LoRA (r=16, alpha=32) merged into base |
|
||||
| Version | v3 (final 3B Lite release) |
|
||||
| Training Data | 99,650 (MMLottie-2M) + 10,000 (layer-aware) + 984 (Spine/DragonBones) |
|
||||
| Hardware | 1x NVIDIA RTX 5060 Ti (16GB) |
|
||||
| Framework | Unsloth |
|
||||
| Token Reduction | 98.8% vs raw Lottie JSON |
|
||||
|
||||
## Architecture: Why Animation-Only is Better
|
||||
|
||||
> "Asking one model to draw AND animate is like asking one person to paint AND dance at the same time."
|
||||
|
||||
AnimTOON separates concerns:
|
||||
- **SVG provides shapes** (perfect, no hallucination, 0 tokens)
|
||||
- **Model generates animation** (focused, token-efficient)
|
||||
- **Converter merges them** (deterministic, 100% valid output)
|
||||
|
||||
OmniLottie generates everything in one model → hallucinated shapes, token bloat (2001 tokens for a "crab" that looks like binoculars).
|
||||
|
||||
## Links
|
||||
|
||||
- **GitHub:** [github.com/srk0102/AnimTOON](https://github.com/srk0102/AnimTOON)
|
||||
- **PitchHut:** [pitchhut.com/project/animtoon-lottie-animation](https://www.pitchhut.com/project/animtoon-lottie-animation)
|
||||
- **OmniLottie (comparison):** [arxiv.org/abs/2603.02138](https://arxiv.org/abs/2603.02138)
|
||||
- **MMLottie-2M Dataset:** [huggingface.co/datasets/OmniLottie/MMLottie-2M](https://huggingface.co/datasets/OmniLottie/MMLottie-2M)
|
||||
|
||||
## Citation
|
||||
|
||||
```bibtex
|
||||
@misc{sivaramakrishna2026animtoon,
|
||||
title={AnimTOON: Token-Efficient Vector Animation Generation via Compact Text Format},
|
||||
author={Siva RamaKrishna},
|
||||
year={2026},
|
||||
url={https://github.com/srk0102/AnimTOON}
|
||||
}
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
MIT License - see [LICENSE](https://github.com/srk0102/AnimTOON/blob/master/LICENSE)
|
||||
54
chat_template.jinja
Normal file
54
chat_template.jinja
Normal file
@@ -0,0 +1,54 @@
|
||||
{%- if tools %}
|
||||
{{- '<|im_start|>system\n' }}
|
||||
{%- if messages[0]['role'] == 'system' %}
|
||||
{{- messages[0]['content'] }}
|
||||
{%- else %}
|
||||
{{- 'You are Qwen, created by Alibaba Cloud. You are a helpful assistant.' }}
|
||||
{%- endif %}
|
||||
{{- "\n\n# Tools\n\nYou may call one or more functions to assist with the user query.\n\nYou are provided with function signatures within <tools></tools> XML tags:\n<tools>" }}
|
||||
{%- for tool in tools %}
|
||||
{{- "\n" }}
|
||||
{{- tool | tojson }}
|
||||
{%- endfor %}
|
||||
{{- "\n</tools>\n\nFor each function call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:\n<tool_call>\n{\"name\": <function-name>, \"arguments\": <args-json-object>}\n</tool_call><|im_end|>\n" }}
|
||||
{%- else %}
|
||||
{%- if messages[0]['role'] == 'system' %}
|
||||
{{- '<|im_start|>system\n' + messages[0]['content'] + '<|im_end|>\n' }}
|
||||
{%- else %}
|
||||
{{- '<|im_start|>system\nYou are Qwen, created by Alibaba Cloud. You are a helpful assistant.<|im_end|>\n' }}
|
||||
{%- endif %}
|
||||
{%- endif %}
|
||||
{%- for message in messages %}
|
||||
{%- if (message.role == "user") or (message.role == "system" and not loop.first) or (message.role == "assistant" and not message.tool_calls) %}
|
||||
{{- '<|im_start|>' + message.role + '\n' + message.content + '<|im_end|>' + '\n' }}
|
||||
{%- elif message.role == "assistant" %}
|
||||
{{- '<|im_start|>' + message.role }}
|
||||
{%- if message.content %}
|
||||
{{- '\n' + message.content }}
|
||||
{%- endif %}
|
||||
{%- for tool_call in message.tool_calls %}
|
||||
{%- if tool_call.function is defined %}
|
||||
{%- set tool_call = tool_call.function %}
|
||||
{%- endif %}
|
||||
{{- '\n<tool_call>\n{"name": "' }}
|
||||
{{- tool_call.name }}
|
||||
{{- '", "arguments": ' }}
|
||||
{{- tool_call.arguments | tojson }}
|
||||
{{- '}\n</tool_call>' }}
|
||||
{%- endfor %}
|
||||
{{- '<|im_end|>\n' }}
|
||||
{%- elif message.role == "tool" %}
|
||||
{%- if (loop.index0 == 0) or (messages[loop.index0 - 1].role != "tool") %}
|
||||
{{- '<|im_start|>user' }}
|
||||
{%- endif %}
|
||||
{{- '\n<tool_response>\n' }}
|
||||
{{- message.content }}
|
||||
{{- '\n</tool_response>' }}
|
||||
{%- if loop.last or (messages[loop.index0 + 1].role != "tool") %}
|
||||
{{- '<|im_end|>\n' }}
|
||||
{%- endif %}
|
||||
{%- endif %}
|
||||
{%- endfor %}
|
||||
{%- if add_generation_prompt %}
|
||||
{{- '<|im_start|>assistant\n' }}
|
||||
{%- endif %}
|
||||
69
config.json
Normal file
69
config.json
Normal file
@@ -0,0 +1,69 @@
|
||||
{
|
||||
"architectures": [
|
||||
"Qwen2ForCausalLM"
|
||||
],
|
||||
"attention_dropout": 0.0,
|
||||
"bos_token_id": 151643,
|
||||
"dtype": "float16",
|
||||
"eos_token_id": 151645,
|
||||
"hidden_act": "silu",
|
||||
"hidden_size": 2048,
|
||||
"initializer_range": 0.02,
|
||||
"intermediate_size": 11008,
|
||||
"layer_types": [
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention"
|
||||
],
|
||||
"max_position_embeddings": 32768,
|
||||
"max_window_layers": 70,
|
||||
"model_type": "qwen2",
|
||||
"num_attention_heads": 16,
|
||||
"num_hidden_layers": 36,
|
||||
"num_key_value_heads": 2,
|
||||
"pad_token_id": null,
|
||||
"rms_norm_eps": 1e-06,
|
||||
"rope_parameters": {
|
||||
"rope_theta": 1000000.0,
|
||||
"rope_type": "default"
|
||||
},
|
||||
"sliding_window": null,
|
||||
"tie_word_embeddings": true,
|
||||
"transformers_version": "5.3.0",
|
||||
"use_cache": true,
|
||||
"use_sliding_window": false,
|
||||
"vocab_size": 151936
|
||||
}
|
||||
14
generation_config.json
Normal file
14
generation_config.json
Normal file
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"bos_token_id": 151643,
|
||||
"do_sample": true,
|
||||
"eos_token_id": [
|
||||
151645,
|
||||
151643
|
||||
],
|
||||
"pad_token_id": 151643,
|
||||
"repetition_penalty": 1.05,
|
||||
"temperature": 0.7,
|
||||
"top_k": 20,
|
||||
"top_p": 0.8,
|
||||
"transformers_version": "5.3.0"
|
||||
}
|
||||
3
model.safetensors
Normal file
3
model.safetensors
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:9e021ad2795299db080811ec567dbec9605db16c21a86a28b0cac9ea4cbdf53e
|
||||
size 6171926680
|
||||
3
tokenizer.json
Normal file
3
tokenizer.json
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:3fd169731d2cbde95e10bf356d66d5997fd885dd8dbb6fb4684da3f23b2585d8
|
||||
size 11421892
|
||||
29
tokenizer_config.json
Normal file
29
tokenizer_config.json
Normal file
@@ -0,0 +1,29 @@
|
||||
{
|
||||
"add_prefix_space": false,
|
||||
"backend": "tokenizers",
|
||||
"bos_token": null,
|
||||
"clean_up_tokenization_spaces": false,
|
||||
"eos_token": "<|im_end|>",
|
||||
"errors": "replace",
|
||||
"extra_special_tokens": [
|
||||
"<|im_start|>",
|
||||
"<|im_end|>",
|
||||
"<|object_ref_start|>",
|
||||
"<|object_ref_end|>",
|
||||
"<|box_start|>",
|
||||
"<|box_end|>",
|
||||
"<|quad_start|>",
|
||||
"<|quad_end|>",
|
||||
"<|vision_start|>",
|
||||
"<|vision_end|>",
|
||||
"<|vision_pad|>",
|
||||
"<|image_pad|>",
|
||||
"<|video_pad|>"
|
||||
],
|
||||
"is_local": true,
|
||||
"model_max_length": 131072,
|
||||
"pad_token": "<|endoftext|>",
|
||||
"split_special_tokens": false,
|
||||
"tokenizer_class": "Qwen2Tokenizer",
|
||||
"unk_token": null
|
||||
}
|
||||
Reference in New Issue
Block a user