SnJake commited on
Commit
09208f9
·
verified ·
1 Parent(s): e9938c4

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +109 -3
README.md CHANGED
@@ -1,3 +1,109 @@
1
- ---
2
- license: mit
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: mit
3
+ base_model: black-forest-labs/FLUX.2-klein-9B
4
+ tags:
5
+ - lora
6
+ - flux
7
+ - flux.2
8
+ - flux.2-klein-9b
9
+ - image-to-image
10
+ - text-to-image
11
+ - font
12
+ - typography
13
+ - atlas
14
+ - comfyui
15
+ - safetensors
16
+ ---
17
+
18
+ # Ref2FontV1 — Contextual LoRA for FLUX.2 Klein 9B
19
+
20
+ **Ref2FontV1** is a **contextual LoRA** trained for **black-forest-labs/FLUX.2-klein-9B**. It generates **1024×1024 font atlases** from a single reference image, following the same layout as the provided examples.
21
+
22
+ > Disclaimer: it works **well**, but **not perfectly**. Expect occasional artifacts and minor alignment issues.
23
+
24
+ ## Guide
25
+ The full usage, installation guide and detailed workflow live in the [GitHub repo](https://github.com/SnJake/Ref2Font):
26
+ ```
27
+ https://github.com/SnJake/Ref2Font
28
+ ```
29
+
30
+ ## What’s included
31
+ - `Ref2FontV1.safetensors` (LoRA weights)
32
+ - `Example Workflow/` (ComfyUI workflow with notes inside nodes)
33
+ - `Example/` (input images and their atlases)
34
+ - Post-processing scripts (`flux_pipeline.py`, `flux_grid_to_ttf.py`, `flux_upscale.py`)
35
+
36
+ ## License
37
+ MIT
38
+
39
+ ## ComfyUI setup
40
+ ### Required models
41
+ 1) Base model:
42
+ ```
43
+ https://huggingface.co/black-forest-labs/FLUX.2-klein-9B/blob/main/flux-2-klein-9b.safetensors
44
+ ```
45
+ Place in: `ComfyUI/models/diffusion_models`
46
+
47
+ 2) Text encoder (Qwen):
48
+ ```
49
+ https://huggingface.co/Comfy-Org/vae-text-encorder-for-flux-klein-9b/blob/main/split_files/text_encoders/qwen_3_8b.safetensors
50
+ ```
51
+ Place in: `ComfyUI/models/text_encoders`
52
+
53
+ 3) VAE:
54
+ ```
55
+ https://huggingface.co/Comfy-Org/vae-text-encorder-for-flux-klein-9b/blob/main/split_files/vae/flux2-vae.safetensors
56
+ ```
57
+ Place in: `ComfyUI/models/vae`
58
+
59
+ ### LoRA
60
+ Download:
61
+ ```
62
+ https://huggingface.co/SnJake/Ref2Font/blob/main/Ref2FontV1.safetensors
63
+ ```
64
+
65
+ Place in: `ComfyUI/models/loras`
66
+
67
+ ### Input image rules
68
+ - **Strict black & white only** (no gray, no shadows, no volume)
69
+ - **1024×1024** exactly
70
+ - Follow the examples in `Example/`
71
+
72
+ ## Post-processing: Atlas → TTF
73
+ Use the included pipeline script to convert the atlas into a TTF.
74
+
75
+ ### Example command (Windows)
76
+ ```powershell
77
+ python "Flux 2 Klein 9B\flux_pipeline.py" ^
78
+ --input "D:\ComfyUI_temp_nckhb_00003_.png" ^
79
+ --output-dir "G:\Programs\FontNN\Flux 2 Klein 9B\test" ^
80
+ --no-upscale ^
81
+ --use-grid ^
82
+ --vectorize contours ^
83
+ --simplify 0.5 ^
84
+ --canvas 1024 ^
85
+ --contour-level 0.5 ^
86
+ --trace-scale 4 ^
87
+ --trace-blur 1.0 ^
88
+ --smooth-iters 2 ^
89
+ --baseline-mode auto ^
90
+ --baseline-quantile 0.9 ^
91
+ --baseline-min-pixels 20 ^
92
+ --cols 8 ^
93
+ --rows 9 ^
94
+ --no-auto-invert
95
+ ```
96
+
97
+ **Upscaler is optional.** If you want to use `flux_upscale.py`, install PyTorch separately:
98
+ ```
99
+ pip install torch torchvision --index-url https://download.pytorch.org/whl/cu121
100
+ ```
101
+
102
+ ## Notes
103
+ - The upscaler is optional; you can skip it with `--no-upscale`.
104
+ - The optional upscaler is also hosted in this HF repo:
105
+ ```
106
+ https://huggingface.co/SnJake/Ref2Font
107
+ ```
108
+ - If the atlas looks inverted, try removing `--no-auto-invert` or add `--invert`.
109
+ - If letters look vertically misaligned, use `--baseline-mode auto`.