AEUPH commited on
Commit
9601892
·
verified ·
1 Parent(s): 1533f24

Add agent skill (SKILL.md) and LICENSE

Browse files
Files changed (1) hide show
  1. SKILL.md +96 -0
SKILL.md ADDED
@@ -0,0 +1,96 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ name: moss4gb
3
+ description: Run MOSS-Image-SFT (5B diffusion transformer) on a 4 GB GPU (GTX 1050 Ti) with bitsandbytes NF4 4-bit weights, no text encoder in the render path (prompt-embedding bank instead), CPU VAE decode, and optional ZeroGPU rendering/bank-training through the AEUPH/moss4gb Space. Use when a caller wants MOSS-Image generation on a small or no GPU card, or wants to build/extend a prompt-embedding bank for the 4 GB path.
4
+ ---
5
+
6
+ # MOSS4GB — MOSS-Image on a 4 GB card
7
+
8
+ `OpenMOSS-Team/MOSS-Image-SFT` (Apache-2.0 DiT + Qwen3.5-9B encoder) rebuilt for
9
+ a 4 GB GTX 1050 Ti: the DiT is NF4-quantized, the 9B encoder is replaced by a
10
+ prompt-embedding bank (~300 KB/prompt vs 17 GB), and the VAE decodes on CPU.
11
+ This is user AEUPH's low-VRAM package derived from that upstream repo.
12
+
13
+ **Repos and URLs**
14
+
15
+ | What | Where |
16
+ |---|---|
17
+ | This model/code | `AEUPH/moss4gb` on Hugging Face |
18
+ | Upstream weights | `OpenMOSS-Team/MOSS-Image-SFT` (transformer + vae + pipeline code) |
19
+ | Full-precision sibling Space | `https://AEUPH-moss-image-zgpu.hf.space/` (arbitrary prompts) |
20
+ | This 4GB Space | `https://AEUPH-moss4gb.hf.space/` (NF4 render + bank trainer + verifier) |
21
+ | MCP / API Surface | `https://AEUPH-moss4gb.hf.space/gradio_api/mcp/` or use the endpoint `/invocations` described below |
22
+ | Upstream skill | `moss-image-space` (sibling, prefer it when meant for arbitrary prompts) |
23
+
24
+ **When to use this package vs the sibling Space**
25
+
26
+ | Caller situation | Use |
27
+ |---|---|
28
+ | Has a 4–12 GB GPU, wants lowest-VRAM local inference | `moss4gb` CLI |
29
+ | Has almost no GPU / one-time render, OK to queue on remote GPU | ZeroGPU Space (the trainer tab) |
30
+ | Wants any natural-language prompt instantly | `moss-image-zgpu` (encoder-resident) |
31
+ | Wants deterministic, repeat renders at fixed seeds within .4GB | `moss4gb` (+ bank repeated prompt in bank) |
32
+
33
+ ## Install (local full control)
34
+
35
+ ```bash
36
+ hf download AEUPH/moss4gb --local-dir moss4gb-hf
37
+ cd moss4gb-hf
38
+ pip install torch diffusers>=0.38 'bitsandbytes>=0.49' 'transformers>=5.3' safetensors huggingface_hub
39
+ # DiT + VAE only (~9.7 GB); the 17 GB text encoder is only needed for bank building
40
+ hf download OpenMOSS-Team/MOSS-Image-SFT --include 'transformer/*' --include 'vae/*' --include 'pipeline_moss_image.py' --include 'scheduler/*' --local-dir models/MOSS-Image-SFT
41
+ python -m moss4gb doctor
42
+ ```
43
+
44
+ ## CLI contract (`python -m moss4gb`)
45
+
46
+ | Command | What it does |
47
+ |---|---|
48
+ | `doctor` | prints versions, VRAM, checkpoint files, bank contents |
49
+ | `bank list / show` | inspect bank entries (id, shape, dtype, prompt text) |
50
+ | `bank null` | write a one-token zero bank (plumbing test only): renders structure but not a matching subject |
51
+ | `bank build --prompt/--prompts-file --device cuda --dtype bfloat16 [--load-in-8bit]` | encode prompts with the 9B encoder → bank entries; refuses under transformers <5.3 |
52
+ | `bank import --source dir-or-file` | copy a bank built elsewhere into this project's assets/bank |
53
+ | `generate --prompt ... --bank-id p_xxx --height H --width W --steps N --cfg C --seed S --out path.png` | render one image; needs a bank entry that matches the prompt |
54
+
55
+ Flag caveats worth remembering: `--uncond-skip 22` is the default negative branch
56
+ config (negative branch layers were skipped to halve the negative compute);
57
+ `--compute-dtype float16` is default for Pascal, use `float32` if a run comes
58
+ out black/NaN; `--height/--width` must be multiples of 16; the card must be
59
+ very close to idle (the NF4 build peaks near 2.9 GB VRAM at 256×256).
60
+
61
+ ## Using the ZeroGPU Space (no local GPU needed)
62
+
63
+ 1. Open `https://AEUPH-moss4gb.hf.space/` (runtime tab "Render (4-bit)").
64
+ 2. Type any prompt. If it is not in the shipped bank, the Space encodes it once
65
+ with the 9B encoder on the Space's GPU (that cost is one extra ~40 s call)
66
+ and adds the entry to your download candidate bank.
67
+ 3. Pick `steps`, `cfg`, size, and a seed — same "prompt + cfg + size + seed"
68
+ gives a byte-identical image.
69
+ 4. To keep a prompt forever after a render: switch to the `Trainer` tab and run
70
+ the same prompt against the bank. The trainer tab also does batch builds, so
71
+ real banks for the 4GB CLI can be produced remotely then downloaded.
72
+ 5. `Bank imports` tab can inspect a downloaded `bank.safetensors` (entry
73
+ ids, token counts, prompt text) before you carry it to the 4GB machine.
74
+
75
+ ZeroGPU quota warns against loops: generate 3–5 renders, then check the
76
+ returned `seconds`/`s_per_step` before doing more. Anonymous callers have 2 min
77
+ /day, free accounts 5 min/day; log in with a Hugging Face token first.
78
+
79
+ ## Common errors
80
+
81
+ | Symptom | Meaning |
82
+ |---|---|
83
+ | `bank has no entry p_xxx` | prompt not encoded anywhere in this bank; `bank build --prompt`, or use the Space |
84
+ | `only X GB VRAM free of Y` | card is too busy; close other CUDA apps or use `--cfg 1` (halves per-step compute) |
85
+ | 17-token image looks like structured noise | that is the null bank's contract: it conditions on nothing |
86
+ | black/NaN image | fp16 residual overflow: retry `--compute-dtype float32` (2× slower) |
87
+ | `ValueError: chat template` | you are calling `encode_prompt` upstream-style; use the provided chat template `assets/qwen35_chat_template.jinja` (bundled) |
88
+ | subprocess killed at cudaMalloc during load | another process grabbed the card; re-check `nvidia-smi` before rerun |
89
+
90
+ ## Attribution and licence
91
+
92
+ Model weights and pipeline: `OpenMOSS-Team/MOSS-Image-SFT`, **Apache-2.0** — a
93
+ commercial-use licence with no attribution requirement, but credit OpenMOSS
94
+ when publishing. Generated images inherit that licence: no restriction on use.
95
+ The Qwen3.5-9B chat template is fetched from `Qwen/Qwen3.5-9B` under its own
96
+ licence for the bank builder only.