tonera commited on
Commit
d55756b
·
verified ·
1 Parent(s): b6145d2

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +87 -71
README.md CHANGED
@@ -1,93 +1,109 @@
1
  ---
2
- language:
3
- - en
4
- license: other
5
- license_name: flux-1-dev-non-commercial-license
6
- license_link: LICENSE.md
7
- extra_gated_prompt: By clicking "Agree", you agree to the [FluxDev Non-Commercial License Agreement](https://huggingface.co/black-forest-labs/FLUX.1-dev/blob/main/LICENSE.md)
8
- and acknowledge the [Acceptable Use Policy](https://huggingface.co/black-forest-labs/FLUX.1-dev/blob/main/POLICY.md).
9
  tags:
10
- - text-to-image
11
- - image-generation
12
- - flux
 
 
 
 
 
 
 
13
  ---
14
 
15
- ![FLUX.1 [dev] Grid](./dev_grid.jpg)
 
 
 
 
16
 
17
- `FLUX.1 [dev]` is a 12 billion parameter rectified flow transformer capable of generating images from text descriptions.
18
- For more information, please read our [blog post](https://blackforestlabs.ai/announcing-black-forest-labs/).
19
 
20
- # Key Features
21
- 1. Cutting-edge output quality, second only to our state-of-the-art model `FLUX.1 [pro]`.
22
- 2. Competitive prompt following, matching the performance of closed source alternatives .
23
- 3. Trained using guidance distillation, making `FLUX.1 [dev]` more efficient.
24
- 4. Open weights to drive new scientific research, and empower artists to develop innovative workflows.
25
- 5. Generated outputs can be used for personal, scientific, and commercial purposes as described in the [`FLUX.1 [dev]` Non-Commercial License](https://huggingface.co/black-forest-labs/FLUX.1-dev/blob/main/LICENSE.md).
26
 
27
- # Usage
28
- We provide a reference implementation of `FLUX.1 [dev]`, as well as sampling code, in a dedicated [github repository](https://github.com/black-forest-labs/flux).
29
- Developers and creatives looking to build on top of `FLUX.1 [dev]` are encouraged to use this as a starting point.
30
 
31
- ## API Endpoints
32
- The FLUX.1 models are also available via API from the following sources
33
- - [bfl.ml](https://docs.bfl.ml/) (currently `FLUX.1 [pro]`)
34
- - [replicate.com](https://replicate.com/collections/flux)
35
- - [fal.ai](https://fal.ai/models/fal-ai/flux/dev)
36
- - [mystic.ai](https://www.mystic.ai/black-forest-labs/flux1-dev)
37
 
38
- ## ComfyUI
39
- `FLUX.1 [dev]` is also available in [Comfy UI](https://github.com/comfyanonymous/ComfyUI) for local inference with a node-based workflow.
40
 
41
- ## Diffusers
42
 
43
- To use `FLUX.1 [dev]` with the 🧨 diffusers python library, first install or upgrade diffusers
44
 
45
- ```shell
46
- pip install -U diffusers
 
 
 
 
 
 
47
  ```
48
 
49
- Then you can use `FluxPipeline` to run the model
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
50
 
51
  ```python
52
  import torch
53
  from diffusers import FluxPipeline
54
 
55
- pipe = FluxPipeline.from_pretrained("black-forest-labs/FLUX.1-dev", torch_dtype=torch.bfloat16)
56
- pipe.enable_model_cpu_offload() #save some VRAM by offloading the model to CPU. Remove this if you have enough GPU power
57
-
58
- prompt = "A cat holding a sign that says hello world"
59
- image = pipe(
60
- prompt,
61
- height=1024,
62
- width=1024,
63
- guidance_scale=3.5,
64
- num_inference_steps=50,
65
- max_sequence_length=512,
66
- generator=torch.Generator("cpu").manual_seed(0)
67
- ).images[0]
68
- image.save("flux-dev.png")
 
 
 
 
 
 
 
 
 
69
  ```
70
 
71
- To learn more check out the [diffusers](https://huggingface.co/docs/diffusers/main/en/api/pipelines/flux) documentation
72
 
73
- ---
74
- # Limitations
75
- - This model is not intended or able to provide factual information.
76
- - As a statistical model this checkpoint might amplify existing societal biases.
77
- - The model may fail to generate output that matches the prompts.
78
- - Prompt following is heavily influenced by the prompting-style.
79
-
80
- # Out-of-Scope Use
81
- The model and its derivatives may not be used
82
-
83
- - In any way that violates any applicable national, federal, state, local or international law or regulation.
84
- - For the purpose of exploiting, harming or attempting to exploit or harm minors in any way; including but not limited to the solicitation, creation, acquisition, or dissemination of child exploitative content.
85
- - To generate or disseminate verifiably false information and/or content with the purpose of harming others.
86
- - To generate or disseminate personal identifiable information that can be used to harm an individual.
87
- - To harass, abuse, threaten, stalk, or bully individuals or groups of individuals.
88
- - To create non-consensual nudity or illegal pornographic content.
89
- - For fully automated decision making that adversely impacts an individual's legal rights or otherwise creates or modifies a binding, enforceable obligation.
90
- - Generating or facilitating large-scale disinformation campaigns.
91
-
92
- # License
93
- This model falls under the [`FLUX.1 [dev]` Non-Commercial License](https://huggingface.co/black-forest-labs/FLUX.1-dev/blob/main/LICENSE.md).
 
1
  ---
2
+ pipeline_tag: text-to-image
3
+ library_name: diffusers
 
 
 
 
 
4
  tags:
5
+ - Flux
6
+ - text-to-image
7
+ - quantization
8
+ - svdquant
9
+ - nunchaku
10
+ - fp4
11
+ - int4
12
+ base_model: black-forest-labs/FLUX.1-dev
13
+ base_model_relation: finetune
14
+ license: other
15
  ---
16
 
17
+ # Model Card (SVDQuant · Nepotism_xii)
18
+
19
+ ![Nepotism_xii sample output](Attached_image.png)
20
+
21
+ > **Language**: English | [中文](README_CN.md)
22
 
23
+ ## Model name
 
24
 
25
+ - **Model repo**: `tonera/Nepotism_xii-Nunchaku`
26
+ - **Source checkpoint (full-precision)**: [Nepotism on Civitai](https://civitai.com/models/618792/nepotism) this quantization is derived from the **XII** (and Flux.1 D family) release; licensing and usage are also subject to upstream terms and Civitai’s policies.
27
+ - **Full Diffusers layout** (VAE, text encoders, scheduler, etc.): `{REPO_ID}`
28
+ - **Quantized Transformer weights** (for Nunchaku):
29
+ - `{REPO_ID}/svdq-fp4_r32-Nepotism_xii-Nunchaku.safetensors`
30
+ - `{REPO_ID}/svdq-int4_r32-Nepotism_xii-Nunchaku.safetensors`
31
 
32
+ ## Quantization / inference
 
 
33
 
34
+ - **Inference engine**: Nunchaku (`https://github.com/nunchaku-ai/nunchaku`)
 
 
 
 
 
35
 
36
+ Nunchaku targets **4-bit (FP4/INT4)** inference to reduce VRAM and latency while preserving quality. The `svdq-*_r32-Nepotism_xii-Nunchaku.safetensors` files in this repo are **SVDQuant**-quantized Flux Transformer weights and should be used with **FluxPipeline** on supported setups.
 
37
 
38
+ ## Install Nunchaku first
39
 
40
+ - **Official install docs** (recommended): `https://nunchaku.tech/docs/nunchaku/installation/installation.html`
41
 
42
+ ### (Recommended) Prebuilt wheel
43
+
44
+ - **Prerequisite**: Use a `PyTorch` version that matches the Nunchaku release notes (newer is often better).
45
+ - **Install**: Pick a wheel for your Python, CUDA, and PyTorch from GitHub Releases / Hugging Face / ModelScope, e.g.:
46
+
47
+ ```bash
48
+ # Example — replace with the correct wheel URL for your torch/cuda/python
49
+ pip install https://github.com/nunchaku-ai/nunchaku/releases/download/vX.Y.Z/nunchaku-X.Y.Z+torch2.9-cp311-cp311-linux_x86_64.whl
50
  ```
51
 
52
+ - **Tip (RTX 50 series)**: When supported by Nunchaku, **FP4** weights often give better compatibility and speed (see Nunchaku docs).
53
+
54
+ ## Quality reference (N=25 samples)
55
+
56
+ Summary metrics (higher is generally closer to reference for PSNR/SSIM; **lower LPIPS is better**).
57
+
58
+ ### FP4
59
+
60
+ | Metric | mean | p50 | p90 | best | worst |
61
+ |--------|------|-----|-----|------|-------|
62
+ | PSNR | 21.8159 | 21.9766 | 29.447 | 30.8016 | 13.0762 |
63
+ | SSIM | 0.811984 | 0.835828 | 0.938092 | 0.944179 | 0.582228 |
64
+ | LPIPS | 0.209448 | 0.178698 | 0.400699 | 0.0461679 | 0.64835 |
65
+
66
+ ### INT4
67
+
68
+ | Metric | mean | p50 | p90 | best | worst |
69
+ |--------|------|-----|-----|------|-------|
70
+ | PSNR | 20.8759 | 20.8797 | 25.5093 | 30.0388 | 14.8672 |
71
+ | SSIM | 0.78943 | 0.812346 | 0.890699 | 0.913605 | 0.557165 |
72
+ | LPIPS | 0.243332 | 0.203449 | 0.419361 | 0.0868137 | 0.657203 |
73
+
74
+ ## Usage (Diffusers + Nunchaku Flux Transformer)
75
+
76
+ Set `REPO_ID` to your Hugging Face repo id or local root. Load the **`svdq-{precision}_r32-Nepotism_xii-Nunchaku.safetensors`** transformer and the full pipeline from **`{REPO_ID}`** (alongside `model_index.json`, `transformer/`, `vae/`, etc.).
77
 
78
  ```python
79
  import torch
80
  from diffusers import FluxPipeline
81
 
82
+ from nunchaku import NunchakuFluxTransformer2dModel
83
+ from nunchaku.utils import get_precision
84
+
85
+ REPO_ID = "tonera/Nepotism_xii-Nunchaku"
86
+ MODEL_STEM = "Nepotism_xii-Nunchaku"
87
+
88
+ if __name__ == "__main__":
89
+ precision = get_precision() # 'int4' or 'fp4' from GPU
90
+ transformer = NunchakuFluxTransformer2dModel.from_pretrained(
91
+ f"{REPO_ID}/svdq-{precision}_r32-{MODEL_STEM}.safetensors"
92
+ )
93
+ pipeline = FluxPipeline.from_pretrained(
94
+ f"{REPO_ID}",
95
+ transformer=transformer,
96
+ torch_dtype=torch.bfloat16,
97
+ ).to("cuda")
98
+
99
+ image = pipeline(
100
+ "A cat holding a sign that says hello world",
101
+ num_inference_steps=50,
102
+ guidance_scale=3.5,
103
+ ).images[0]
104
+ image.save(f"nepotism_xii-{precision}.png")
105
  ```
106
 
107
+ Licensing follows `LICENSE.md` in this repo and upstream model terms.
108
 
109
+ If your Diffusers files live under a subfolder (e.g. local `diffusers/`), use `f"{REPO_ID}/diffusers"` for `FluxPipeline.from_pretrained` and prefix the transformer path the same way.