CyberRealistic-mnn / README.md
Mouserat's picture
Create README.md
8620b56 verified
|
Raw
History Blame Contribute Delete
7.98 kB
---
license: creativeml-openrail-m
base_model: cyberdelia/CyberRealistic
tags:
- mnn
- stable-diffusion
- stable-diffusion-1.5
- text-to-image
- photorealistic
- on-device
- quantized
- android
---
# CyberRealistic (MNN)
This repository provides an MNN-format conversion of
[cyberdelia/CyberRealistic](https://huggingface.co/cyberdelia/CyberRealistic) (`CyberRealistic_FINAL_FP16.safetensors`)
for use with the [nezumi-ai](https://github.com/mouse0329/nezumi-ai) image generation engine β€”
a fully offline AI chat app for Android supporting on-device image generation.
A Windows CLI (`nezumi-ai-sd-cli`) is also provided for testing/debugging on desktop, but the
primary target platform is Android. This model is not bundled with the app β€” users download it
separately and individually agree to its license terms.
> **Platform note**: `nezumi-ai-sd-cli` currently builds for **Windows only** (`.exe`).
> A Linux build is planned.
## Variants
SD1.5 models are distributed in a single quantization variant (unlike the SDXL/Illustrious
line, which offers int4/int8 variants):
| File | UNet quantization | Size |
|---|---|---|
| `CyberRealistic-mnn-int8-block32.zip` | 8-bit, block size 32 | ~1.23 GB |
## Model Provenance
| Field | Value |
|---|---|
| Base model | [cyberdelia/CyberRealistic](https://huggingface.co/cyberdelia/CyberRealistic), `CyberRealistic_FINAL_FP16.safetensors` |
| Original source | Photorealistic SD1.5 checkpoint by Cyberdelia, optimized for portraits and lifelike scenes with minimal prompt engineering |
| Format | MNN (`clip_v2.mnn` + `.weight`, `unet.mnn` + `.weight`, `vae_decoder_fp16.mnn` + `.weight`, `token_emb.bin`, `pos_emb.bin`, `tokenizer.json`) |
| 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) |
### Conversion steps
The upstream model is distributed as single `.safetensors` checkpoints rather than a
diffusers-format repository, so an extra pre-conversion step is required.
```bash
# 1. Download the checkpoint
curl -L -o CyberRealistic_FINAL_FP16.safetensors \
"https://huggingface.co/cyberdelia/CyberRealistic/resolve/main/CyberRealistic_FINAL_FP16.safetensors"
# 2. Convert single-file safetensors -> diffusers format
python -c "
from diffusers import StableDiffusionPipeline
import torch
pipe = StableDiffusionPipeline.from_single_file(
'./CyberRealistic_FINAL_FP16.safetensors',
torch_dtype=torch.float16,
safety_checker=None,
)
pipe.save_pretrained('./CyberRealistic_diffusers')
"
# 3. Convert diffusers format -> MNN
python convert_hf_to_mnn_sd.py \
--model ./CyberRealistic_diffusers \
--out ./out/CyberRealistic \
--size 512 \
--unet-bits 8 \
--unet-block 32 \
--clip-bits 8 \
--vae-bits 8
```
No fine-tuning or retraining was performed β€” weights are unchanged from the original
checkpoint aside from the diffusers-format repack and the MNN format conversion/quantization
above.
### Output files
```
clip_v2.mnn 0.13 MB
clip_v2.mnn.weight 148.92 MB
model.json 0.00 MB
pos_emb.bin 0.23 MB
token_emb.bin 72.38 MB
tokenizer.json 2.12 MB
unet.mnn 1.13 MB
unet.mnn.weight 911.38 MB
vae_decoder_fp16.mnn 0.22 MB
vae_decoder_fp16.mnn.weight 94.38 MB
TOTAL 1230.89 MB
```
## License
The upstream model's license labeling is inconsistent across sources, so we report both here
rather than assuming one is correct:
- **Hugging Face repository tag**: `creativeml-openrail-m`
(as declared in `cyberdelia/CyberRealistic`'s repo metadata)
- **Model card body text**: refers to the **"CreativeML Open RAIL++-M License"**
(a distinct, related license more commonly used for SDXL-era models)
RAIL-M and RAIL++-M share the same core structure and use-based restrictions (Attachment A),
differing mainly in scope of applicability (RAIL++-M extends coverage to text encoders in
addition to the diffusion model itself). We are not aware of this discrepancy having been
resolved by the upstream author as of this writing. Given the ambiguity, this repository:
- Uses `creativeml-openrail-m` as the declared HF license tag (matching the upstream repo's own tag)
- Documents the RAIL++-M wording found in the upstream model card here, for transparency
- Applies the more inclusive set of use-based restrictions from both variants, to be safe
- **Commercial use**: The upstream model card states commercial and non-commercial use are
both permitted, with proper credit and no malicious use. This is consistent with both
RAIL-M and RAIL++-M.
- **Redistribution**: Permitted under either license variant.
- **Attribution**: Required β€” credit to Cyberdelia (see above).
This checkpoint inherits the original model's use-based restrictions in full
(see Attachment A of the [RAIL-M full text](https://huggingface.co/spaces/CompVis/stable-diffusion-license)),
including prohibitions on use for exploiting minors, generating disinformation, harassment,
discrimination, unauthorized medical advice, and law-enforcement/immigration profiling.
Please review the [upstream model card](https://huggingface.co/cyberdelia/CyberRealistic) and
the [RAIL-M full text](https://huggingface.co/spaces/CompVis/stable-diffusion-license) yourself
before relying on this for commercial use β€” this is a summary, not legal advice.
> Note: the conversion script itself is part of the nezumi-ai project and licensed separately
> under LGPL v3 / a commercial license (see [LICENSE.md](https://github.com/mouse0329/nezumi-ai/blob/main/LICENSE.md)).
> That license applies to the *code*, not to this model checkpoint.
## Requirements (Android)
| Item | Minimum | Recommended |
|---|---|---|
| Android Version | 12 (API 31) | 14+ (API 34+) |
| RAM | 4GB | 6GB+ |
| Storage | 3GB free | 5GB+ |
| GPU | Optional β€” OpenCL-capable GPU (Adreno, Mali, PowerVR) | Recommended |
> SD1.5 requirements are lower than SDXL/Illustrious (8GB RAM minimum) β€” see that model's README
> for comparison.
## Usage
### Android (primary)
Used automatically by the [nezumi-ai](https://github.com/mouse0329/nezumi-ai) app's image-generation
feature (MNN backend, GPU/OpenCL β†’ CPU fallback). Download/select this model from within the app;
manual extraction is not required on Android.
### Windows CLI (testing/debugging)
Distributed as a zip archive. Extract it before use β€” in PowerShell:
```powershell
Expand-Archive CyberRealistic-mnn-int8-block32.zip C:\sd-model
```
Then run:
```bat
nezumi-ai-sd-cli "C:\sd-model" "RAW photo, realistic photo of a 22-year-old woman, natural lighting, depth of field, candid moment, color graded" --steps 25 --width 512 --height 512 --backend cpu --out out.png
```
#### Options
| Option | Description | Default |
|---|---|---|
| `<model_path>` | Path to the extracted MNN model folder | β€” |
| `<prompt>` | Text prompt | β€” |
| `--negative <text>` | Negative prompt | empty |
| `--width <n>` / `--height <n>` | Image size | 512 / 512 |
| `--steps <n>` | Sampling steps | 20 |
| `--cfg <f>` | CFG scale | 7.0 |
| `--seed <n>` | Seed (negative = random) | -1 |
| `--scheduler <name>` | Sampling scheduler: `euler`\|`ddim`\|`dpm`\|`dpm++2m`\|`dpm++2m-karras`\|`lcm`\|`eulera`\|`unipc` | `dpm++2m` |
| `--backend <name>` | `cpu`\|`opencl` | `cpu` |
| `--out <path>` | Output path. `.ppm` always works; `.png` requires `stb_image_write.h` | β€” |
> The upstream author recommends 25–30 steps, `dpm++2m-karras` or `eulera`, and CFG 7.0–8.0
> at 512Γ—512 (native), with hires-fix for higher resolutions. VAE is already baked in β€” no
> separate VAE file needed.
## Roadmap
- [ ] Linux build of `nezumi-ai-sd-cli`
- [ ] macOS build
- [ ] SDXL support
- [ ] Additional quantization variants
## Disclaimer
This is an unofficial, community conversion and is not affiliated with or endorsed
by Cyberdelia.