evilsocket commited on
Commit
d14cdfb
·
verified ·
1 Parent(s): 6396105

Upload folder using huggingface_hub

Browse files
Files changed (4) hide show
  1. LICENSE +192 -0
  2. README.md +88 -0
  3. alucard_model.safetensors +3 -0
  4. config.json +26 -0
LICENSE ADDED
@@ -0,0 +1,192 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FAIR License (Free Access for Individuals and Researchers)
2
+ ==========================================================
3
+
4
+ Version 1.0.0
5
+
6
+ Copyright (c) 2026-present Simone Margaritelli (evilsocket@gmail.com)
7
+ All Rights Reserved.
8
+
9
+ Software: Alucard
10
+ Repository: https://github.com/evilsocket/alucard
11
+ Author: Simone Margaritelli
12
+ Contact: evilsocket@gmail.com
13
+
14
+
15
+ 1. DEFINITIONS
16
+
17
+ "Software" means the software identified above, including all source code,
18
+ documentation, configuration files, and associated materials available in
19
+ the repository identified above.
20
+
21
+ "Derivative Work" means any work that incorporates, modifies, extends, or
22
+ is based upon the Software in whole or in part.
23
+
24
+ "Commercial Use" means any use of the Software or a Derivative Work in
25
+ connection with any activity intended to generate revenue, monetary gain,
26
+ or other commercial advantage. This includes, but is not limited to:
27
+
28
+ (a) offering the Software or a Derivative Work as a paid product or
29
+ service;
30
+ (b) using the Software or a Derivative Work as part of a
31
+ Software-as-a-Service (SaaS) offering;
32
+ (c) incorporating the Software or a Derivative Work into a product or
33
+ service that is monetized through any means, including but not
34
+ limited to subscriptions, advertisements, in-app purchases,
35
+ licensing fees, or consulting fees;
36
+ (d) using the Software or a Derivative Work internally within a
37
+ for-profit organization to support revenue-generating operations.
38
+
39
+ "Business Use" means any use of the Software or a Derivative Work by or on
40
+ behalf of a legal entity (including but not limited to a corporation, LLC,
41
+ partnership, sole proprietorship, or equivalent) in the course of that
42
+ entity's business operations, regardless of whether the specific use
43
+ directly generates revenue.
44
+
45
+ "Non-Commercial Use" means use of the Software solely for personal,
46
+ educational, academic research, or non-profit purposes, where no Commercial
47
+ Use or Business Use is involved.
48
+
49
+ "Attribution" means the notice specified in Section 4 of this License.
50
+
51
+ "Author" means the copyright holder identified above.
52
+
53
+
54
+ 2. NON-COMMERCIAL USE GRANT
55
+
56
+ Subject to the terms and conditions of this License, the Author hereby
57
+ grants you a worldwide, royalty-free, non-exclusive license to use, copy,
58
+ modify, and distribute the Software and Derivative Works for Non-Commercial
59
+ Use, provided that you:
60
+
61
+ (a) retain all copyright notices, this License text, and any other
62
+ notices of attribution in all copies or substantial portions of the
63
+ Software;
64
+ (b) clearly mark any modifications as changed from the original Software;
65
+ (c) distribute any Derivative Work under the terms of this same License.
66
+
67
+
68
+ 3. COMMERCIAL USE — ATTRIBUTION REQUIRED
69
+
70
+ Any Commercial Use of the Software or a Derivative Work is permitted only
71
+ if the Attribution requirements set forth in Section 4 are fully satisfied.
72
+
73
+ If such use also constitutes Business Use as defined in Section 1, the
74
+ requirements of Section 5 apply in addition to (and not instead of) the
75
+ requirements of this Section and Section 4.
76
+
77
+
78
+ 4. ATTRIBUTION REQUIREMENTS
79
+
80
+ Any person or entity engaged in Commercial Use of the Software or a
81
+ Derivative Work must provide Attribution that includes ALL of the
82
+ following:
83
+
84
+ (a) the text "Powered by Alucard" or "Built with
85
+ Alucard";
86
+ (b) a clickable hyperlink to https://github.com/evilsocket/alucard
87
+ (where technically feasible; if not feasible, the
88
+ full URL must be displayed as plain text);
89
+ (c) the text "Created by Simone Margaritelli".
90
+
91
+ The Attribution must be clearly visible to end users and must appear in at
92
+ least one of the following locations:
93
+
94
+ (a) the primary user interface of the product or service (for example,
95
+ a page footer, an "about" page, or a sidebar);
96
+ (b) the landing page or main documentation page of the product or
97
+ service;
98
+ (c) if the product or service has no user interface, in the README file
99
+ or primary documentation distributed with it.
100
+
101
+ The Attribution must NOT be hidden behind multiple clicks, placed in fine
102
+ print, rendered in a color or size that makes it difficult to read, or
103
+ otherwise obscured from reasonable view.
104
+
105
+ The Attribution must remain in place for the entire duration of the
106
+ Commercial Use.
107
+
108
+
109
+ 5. BUSINESS USE — COMMERCIAL AGREEMENT REQUIRED
110
+
111
+ Any Business Use of the Software or a Derivative Work requires a separate
112
+ written commercial agreement signed by the Author. To obtain a commercial
113
+ agreement, contact the Author at the email address identified at the top
114
+ of this License.
115
+
116
+ Use of the Software or a Derivative Work for Business Use without such a
117
+ signed agreement constitutes a violation of this License and an
118
+ infringement of the Author's copyright.
119
+
120
+ This requirement applies regardless of whether the Business Use also
121
+ satisfies the Attribution requirements of Sections 3 and 4.
122
+
123
+
124
+ 6. CONTRIBUTIONS
125
+
126
+ Any contributions submitted to the Software (including but not limited to
127
+ pull requests, patches, and issue reports containing code) are licensed
128
+ under the terms of this License.
129
+
130
+ By submitting a contribution, the contributor grants the Author a
131
+ perpetual, irrevocable, worldwide, royalty-free, non-exclusive license to
132
+ use, reproduce, modify, distribute, sublicense, and otherwise exploit the
133
+ contribution under any terms the Author sees fit, including under licenses
134
+ other than this one.
135
+
136
+
137
+ 7. TERMINATION
138
+
139
+ Your rights under this License terminate automatically and without notice
140
+ upon any violation of its terms. Upon termination, you must immediately
141
+ cease all use, copying, modification, and distribution of the Software and
142
+ any Derivative Works.
143
+
144
+ If you cure a violation within thirty (30) days of receiving written notice
145
+ from the Author, and if such violation is your first violation of this
146
+ License, your rights under this License shall be reinstated.
147
+
148
+ The Author reserves the right to pursue any and all available legal
149
+ remedies for any violation of this License, including but not limited to
150
+ injunctive relief and damages.
151
+
152
+
153
+ 8. DISCLAIMER OF WARRANTY
154
+
155
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
156
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
157
+ FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT. IN NO EVENT SHALL
158
+ THE AUTHOR OR COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES, OR OTHER
159
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT, OR OTHERWISE, ARISING
160
+ FROM, OUT OF, OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
161
+ DEALINGS IN THE SOFTWARE.
162
+
163
+
164
+ 9. LIMITATION OF LIABILITY
165
+
166
+ IN NO EVENT SHALL THE AUTHOR BE LIABLE TO YOU OR ANY THIRD PARTY FOR ANY
167
+ DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
168
+ (INCLUDING BUT NOT LIMITED TO PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
169
+ LOSS OF USE, DATA, OR PROFITS, OR BUSINESS INTERRUPTION) HOWEVER CAUSED
170
+ AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
171
+ TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
172
+ OF THE SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
173
+
174
+
175
+ 10. GENERAL PROVISIONS
176
+
177
+ (a) Severability. If any provision of this License is held to be
178
+ unenforceable or invalid by a court of competent jurisdiction, that
179
+ provision shall be modified to the minimum extent necessary to make it
180
+ enforceable, and the remaining provisions shall continue in full force
181
+ and effect.
182
+
183
+ (b) Disputes. Any disputes arising under or in connection with this
184
+ License shall be resolved by the courts of competent jurisdiction.
185
+
186
+ (c) Entire Agreement. This License constitutes the entire agreement
187
+ between the parties with respect to Non-Commercial Use of the
188
+ Software. Commercial Use and Business Use are additionally governed
189
+ by the separate agreement referenced in Section 5.
190
+
191
+ (d) Reservation of Rights. All rights not expressly granted under this
192
+ License are reserved by the Author.
README.md ADDED
@@ -0,0 +1,88 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: other
3
+ license_name: fair-1.0.0
4
+ license_link: LICENSE
5
+ library_name: pytorch
6
+ tags:
7
+ - image-generation
8
+ - pixel-art
9
+ - sprites
10
+ - flow-matching
11
+ - diffusion
12
+ - text-to-image
13
+ - game-assets
14
+ pipeline_tag: text-to-image
15
+ ---
16
+
17
+ # Alucard
18
+
19
+ A small (32M parameter) text-to-sprite generative model using flow matching. Generates 128x128 RGBA sprites from text prompts, with optional reference frame input for animation generation.
20
+
21
+ **GitHub**: [evilsocket/alucard](https://github.com/evilsocket/alucard)
22
+
23
+ ## Architecture
24
+
25
+ - **UNet** (32M params) with 8-channel input (4 noisy RGBA + 4 reference RGBA)
26
+ - **AdaLN-Zero** conditioning from CLIP ViT-B/32 text embeddings + sinusoidal timestep
27
+ - **Flow matching** (rectified flow) training objective
28
+ - **Dual classifier-free guidance** for independent text and reference frame control
29
+ - Self-attention at 32x32 and 16x16 resolutions
30
+
31
+ ## Two Modes
32
+
33
+ 1. **Text to Sprite** - generate a sprite from a text prompt alone
34
+ 2. **Text + Reference to Sprite** - generate the next animation frame conditioned on a previous frame and text describing the change
35
+
36
+ ## Usage
37
+
38
+ ```python
39
+ import torch
40
+ from safetensors.torch import load_file
41
+ from alucard.model import UNet
42
+ from alucard.sample import sample
43
+
44
+ # Load model
45
+ state_dict = load_file("alucard_model.safetensors")
46
+ model = UNet()
47
+ model.load_state_dict(state_dict)
48
+ model = model.cuda().eval()
49
+
50
+ # Encode text with CLIP
51
+ import open_clip
52
+ clip_model, _, _ = open_clip.create_model_and_transforms("ViT-B-32", pretrained="openai")
53
+ tokenizer = open_clip.get_tokenizer("ViT-B-32")
54
+ clip_model = clip_model.cuda().eval()
55
+
56
+ tokens = tokenizer(["a pixel art knight sprite"]).cuda()
57
+ with torch.no_grad():
58
+ text_emb = clip_model.encode_text(tokens)
59
+ text_emb = text_emb / text_emb.norm(dim=-1, keepdim=True)
60
+
61
+ # Generate
62
+ sprites = sample(model, text_emb, num_steps=20, cfg_text=5.0, device="cuda")
63
+ ```
64
+
65
+ ## Model Details
66
+
67
+ | Property | Value |
68
+ |----------|-------|
69
+ | Parameters | 31,956,228 (32M) |
70
+ | Input | 128x128 RGBA (4ch noisy + 4ch reference) |
71
+ | Output | 128x128 RGBA |
72
+ | Text encoder | CLIP ViT-B/32 (frozen, 512-dim) |
73
+ | Conditioning | AdaLN-Zero |
74
+ | Training | Flow matching (rectified flow) |
75
+ | Base channels | 64, multipliers [1, 2, 4, 4] |
76
+ | Attention | Self-attention at 32x32 and 16x16 |
77
+
78
+ ## Training
79
+
80
+ Trained on 33K sprites from publicly available datasets (Kaggle Pixel Art, Kenney CC0, GameTileNet, Pixel Art Nouns, TinyHero).
81
+
82
+ ## License
83
+
84
+ Released under the [FAIR License (Free for Attribution and Individual Rights) v1.0.0](LICENSE).
85
+
86
+ - **Non-commercial use** (personal, educational, research, non-profit) is freely permitted under the terms of the license.
87
+ - **Commercial use** (SaaS, paid apps, any monetization) requires visible attribution to the project and its author. See the [license](LICENSE) for details.
88
+ - **Business use** (any use by or on behalf of a business entity) requires a signed commercial agreement with the author. Contact `evilsocket@gmail.com` for inquiries.
alucard_model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:fda04e052089b7daf87ed9bd62c7dc4418c9bedf01cc35a9bd322552d1e13ea5
3
+ size 63950544
config.json ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architecture": "alucard-unet",
3
+ "in_channels": 8,
4
+ "out_channels": 4,
5
+ "base_channels": 64,
6
+ "channel_mults": [
7
+ 1,
8
+ 2,
9
+ 4,
10
+ 4
11
+ ],
12
+ "num_res_blocks": 2,
13
+ "attn_resolutions": [
14
+ 32,
15
+ 16
16
+ ],
17
+ "text_dim": 512,
18
+ "image_size": 128,
19
+ "text_encoder": "openai/clip-vit-base-patch32",
20
+ "parameters": 31956228,
21
+ "dtype": "float16",
22
+ "source_checkpoint": "checkpoints/best.pt",
23
+ "source_epoch": 33,
24
+ "source_step": 8772,
25
+ "weights": "ema"
26
+ }