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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: creativeml-openrail-m
|
| 3 |
+
base_model: s6yx/ReV_Animated
|
| 4 |
+
tags:
|
| 5 |
+
- mnn
|
| 6 |
+
- stable-diffusion
|
| 7 |
+
- stable-diffusion-1.5
|
| 8 |
+
- text-to-image
|
| 9 |
+
- anime
|
| 10 |
+
- on-device
|
| 11 |
+
- quantized
|
| 12 |
+
- android
|
| 13 |
+
---
|
| 14 |
+
|
| 15 |
+
# ReV Animated (MNN)
|
| 16 |
+
|
| 17 |
+
This repository provides an MNN-format conversion of
|
| 18 |
+
[s6yx/ReV_Animated](https://huggingface.co/s6yx/ReV_Animated) (v1.2.2, fp16)
|
| 19 |
+
for use with the [nezumi-ai](https://github.com/mouse0329/nezumi-ai) image generation engine β
|
| 20 |
+
a fully offline AI chat app for Android supporting on-device image generation.
|
| 21 |
+
|
| 22 |
+
A Windows CLI (`nezumi-ai-sd-cli`) is also provided for testing/debugging on desktop, but the
|
| 23 |
+
primary target platform is Android. This model is not bundled with the app β users download it
|
| 24 |
+
separately and individually agree to its license terms.
|
| 25 |
+
|
| 26 |
+
> **Platform note**: `nezumi-ai-sd-cli` currently builds for **Windows only** (`.exe`).
|
| 27 |
+
> A Linux build is planned.
|
| 28 |
+
|
| 29 |
+
## Variants
|
| 30 |
+
|
| 31 |
+
SD1.5 models are distributed in a single quantization variant (unlike the SDXL/Illustrious
|
| 32 |
+
line, which offers int4/int8 variants):
|
| 33 |
+
|
| 34 |
+
| File | UNet quantization | Size |
|
| 35 |
+
|---|---|---|
|
| 36 |
+
| `ReV_Animated-mnn-int8-block32.zip` | 8-bit, block size 32 | ~1.23 GB |
|
| 37 |
+
|
| 38 |
+
## Model Provenance
|
| 39 |
+
|
| 40 |
+
| Field | Value |
|
| 41 |
+
|---|---|
|
| 42 |
+
| Base model | [s6yx/ReV_Animated](https://huggingface.co/s6yx/ReV_Animated), `rev_1.2.2-fp16.safetensors` |
|
| 43 |
+
| Original source | Checkpoint merge by s6yx; handles anime, semi-realistic, and fantasy styles in one model |
|
| 44 |
+
| Format | MNN (`clip_v2.mnn` + `.weight`, `unet.mnn` + `.weight`, `vae_decoder_fp16.mnn` + `.weight`, `token_emb.bin`, `pos_emb.bin`, `tokenizer.json`) |
|
| 45 |
+
| Conversion tool | [`convert_hf_to_mnn_sd.py`](https://github.com/mouse0329/nezumi-ai/blob/main/mnn-sd-engine/conversion/convert_hf_to_mnn_sd.py) (nezumi-ai) |
|
| 46 |
+
|
| 47 |
+
### Conversion steps
|
| 48 |
+
|
| 49 |
+
Unlike other conversions in this collection, the upstream model is distributed as a single
|
| 50 |
+
`.safetensors` checkpoint rather than a diffusers-format repository, so an extra pre-conversion
|
| 51 |
+
step is required before the MNN conversion script can read it.
|
| 52 |
+
|
| 53 |
+
```bash
|
| 54 |
+
# 1. Download the fp16 checkpoint
|
| 55 |
+
huggingface-cli download s6yx/ReV_Animated rev_1.2.2/rev_1.2.2-fp16.safetensors --local-dir .
|
| 56 |
+
|
| 57 |
+
# 2. Convert single-file safetensors -> diffusers format
|
| 58 |
+
python -c "
|
| 59 |
+
from diffusers import StableDiffusionPipeline
|
| 60 |
+
import torch
|
| 61 |
+
|
| 62 |
+
pipe = StableDiffusionPipeline.from_single_file(
|
| 63 |
+
'./rev_1.2.2/rev_1.2.2-fp16.safetensors',
|
| 64 |
+
torch_dtype=torch.float16,
|
| 65 |
+
safety_checker=None,
|
| 66 |
+
)
|
| 67 |
+
pipe.save_pretrained('./ReV_Animated_diffusers')
|
| 68 |
+
"
|
| 69 |
+
|
| 70 |
+
# 3. Convert diffusers format -> MNN
|
| 71 |
+
python convert_hf_to_mnn_sd.py \
|
| 72 |
+
--model ./ReV_Animated_diffusers \
|
| 73 |
+
--out ./out/ReV_Animated \
|
| 74 |
+
--size 512 \
|
| 75 |
+
--unet-bits 8 \
|
| 76 |
+
--unet-block 32 \
|
| 77 |
+
--clip-bits 8 \
|
| 78 |
+
--vae-bits 8
|
| 79 |
+
```
|
| 80 |
+
|
| 81 |
+
No fine-tuning or retraining was performed β weights are unchanged from the original
|
| 82 |
+
checkpoint aside from the diffusers-format repack and the MNN format conversion/quantization
|
| 83 |
+
above.
|
| 84 |
+
|
| 85 |
+
### Output files
|
| 86 |
+
|
| 87 |
+
```
|
| 88 |
+
clip_v2.mnn 0.13 MB
|
| 89 |
+
clip_v2.mnn.weight 148.92 MB
|
| 90 |
+
model.json 0.00 MB
|
| 91 |
+
pos_emb.bin 0.23 MB
|
| 92 |
+
token_emb.bin 72.38 MB
|
| 93 |
+
tokenizer.json 2.12 MB
|
| 94 |
+
unet.mnn 1.13 MB
|
| 95 |
+
unet.mnn.weight 911.38 MB
|
| 96 |
+
vae_decoder_fp16.mnn 0.22 MB
|
| 97 |
+
vae_decoder_fp16.mnn.weight 94.38 MB
|
| 98 |
+
TOTAL 1230.89 MB
|
| 99 |
+
```
|
| 100 |
+
|
| 101 |
+
## License
|
| 102 |
+
|
| 103 |
+
- **Original model license**: CreativeML Open RAIL-M ([full text](https://huggingface.co/spaces/CompVis/stable-diffusion-license))
|
| 104 |
+
β all credit for the weights and merge work goes to s6yx.
|
| 105 |
+
- **Redistribution**: Permitted under the original model's license.
|
| 106 |
+
- **Commercial use**: Permitted within the terms of the RAIL-M license.
|
| 107 |
+
- **Attribution**: Required (see above).
|
| 108 |
+
|
| 109 |
+
Please read and comply with the original license before using this model.
|
| 110 |
+
|
| 111 |
+
This checkpoint inherits the original model's use-based restrictions in full
|
| 112 |
+
(see Attachment A of the [full license text](https://huggingface.co/spaces/CompVis/stable-diffusion-license)),
|
| 113 |
+
including prohibitions on use for exploiting minors, generating disinformation, harassment,
|
| 114 |
+
discrimination, unauthorized medical advice, and law-enforcement/immigration profiling.
|
| 115 |
+
|
| 116 |
+
> Note: this is a checkpoint merge, meaning it is derived from multiple upstream Stable
|
| 117 |
+
> Diffusion models. The RAIL-M license and its use-based restrictions apply to the merged
|
| 118 |
+
> result as distributed by s6yx.
|
| 119 |
+
|
| 120 |
+
> Note: the conversion script itself is part of the nezumi-ai project and licensed separately
|
| 121 |
+
> under LGPL v3 / a commercial license (see [LICENSE.md](https://github.com/mouse0329/nezumi-ai/blob/main/LICENSE.md)).
|
| 122 |
+
> That license applies to the *code*, not to this model checkpoint.
|
| 123 |
+
|
| 124 |
+
## Requirements (Android)
|
| 125 |
+
|
| 126 |
+
| Item | Minimum | Recommended |
|
| 127 |
+
|---|---|---|
|
| 128 |
+
| Android Version | 12 (API 31) | 14+ (API 34+) |
|
| 129 |
+
| RAM | 4GB | 6GB+ |
|
| 130 |
+
| Storage | 3GB free | 5GB+ |
|
| 131 |
+
| GPU | Optional β OpenCL-capable GPU (Adreno, Mali, PowerVR) | Recommended |
|
| 132 |
+
|
| 133 |
+
> SD1.5 requirements are lower than SDXL/Illustrious (8GB RAM minimum) β see that model's README
|
| 134 |
+
> for comparison.
|
| 135 |
+
|
| 136 |
+
## Usage
|
| 137 |
+
|
| 138 |
+
### Android (primary)
|
| 139 |
+
|
| 140 |
+
Used automatically by the [nezumi-ai](https://github.com/mouse0329/nezumi-ai) app's image-generation
|
| 141 |
+
feature (MNN backend, GPU/OpenCL β CPU fallback). Download/select this model from within the app;
|
| 142 |
+
manual extraction is not required on Android.
|
| 143 |
+
|
| 144 |
+
### Windows CLI (testing/debugging)
|
| 145 |
+
|
| 146 |
+
Distributed as a zip archive. Extract it before use β in PowerShell:
|
| 147 |
+
|
| 148 |
+
```powershell
|
| 149 |
+
Expand-Archive ReV_Animated-mnn-int8-block32.zip C:\sd-model
|
| 150 |
+
```
|
| 151 |
+
|
| 152 |
+
Then run:
|
| 153 |
+
|
| 154 |
+
```bat
|
| 155 |
+
nezumi-ai-sd-cli "C:\sd-model" "1girl, fantasy knight, detailed armor, anime style" --steps 20 --width 512 --height 768 --backend cpu --out out.png
|
| 156 |
+
```
|
| 157 |
+
|
| 158 |
+
#### Options
|
| 159 |
+
|
| 160 |
+
| Option | Description | Default |
|
| 161 |
+
|---|---|---|
|
| 162 |
+
| `<model_path>` | Path to the extracted MNN model folder | β |
|
| 163 |
+
| `<prompt>` | Text prompt | β |
|
| 164 |
+
| `--negative <text>` | Negative prompt | empty |
|
| 165 |
+
| `--width <n>` / `--height <n>` | Image size | 512 / 512 |
|
| 166 |
+
| `--steps <n>` | Sampling steps | 20 |
|
| 167 |
+
| `--cfg <f>` | CFG scale | 7.0 |
|
| 168 |
+
| `--seed <n>` | Seed (negative = random) | -1 |
|
| 169 |
+
| `--scheduler <name>` | Sampling scheduler: `euler`\|`ddim`\|`dpm`\|`dpm++2m`\|`dpm++2m-karras`\|`lcm`\|`eulera`\|`unipc` | `dpm++2m` |
|
| 170 |
+
| `--backend <name>` | `cpu`\|`opencl` | `cpu` |
|
| 171 |
+
| `--out <path>` | Output path. `.ppm` always works; `.png` requires `stb_image_write.h` | β |
|
| 172 |
+
|
| 173 |
+
> Prompt order matters for this model β words near the front of the prompt carry more weight.
|
| 174 |
+
> A common structure is: content type β description β style β composition. Works well across
|
| 175 |
+
> anime, semi-realistic, and fantasy-landscape prompts.
|
| 176 |
+
|
| 177 |
+
## Roadmap
|
| 178 |
+
|
| 179 |
+
- [ ] Linux build of `nezumi-ai-sd-cli`
|
| 180 |
+
- [ ] macOS build
|
| 181 |
+
- [ ] SDXL support
|
| 182 |
+
- [ ] Additional quantization variants
|
| 183 |
+
|
| 184 |
+
## Disclaimer
|
| 185 |
+
|
| 186 |
+
This is an unofficial, community conversion and is not affiliated with or endorsed
|
| 187 |
+
by s6yx.
|