File size: 9,264 Bytes
4c3e3fc
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
---
language:
  - en
license: other
license_name: flux-non-commercial-license
base_model: black-forest-labs/FLUX.2-klein-base-9B
pipeline_tag: image-to-image
library_name: diffusers
tags:
  - flux
  - flux2
  - lora
  - image-editing
  - pixel-art
  - sprites
  - lpc
---

# LPC Four-Direction Walk — FLUX.2 Klein 9B

An experimental rank-16 LoRA for editing female LPC characters and 4×2
walking sprite sheets with **FLUX.2 [klein] Base 9B**.

## Supported tasks

| Task token | Input | Output |
|---|---|---|
| `TASK_ROTATE_STANDING` | South-facing dressed character | Same character facing north, east, or west |
| `TASK_STANDING_TO_WALK_FIRST_FRAME` | Standing character | First walking frame in the same direction |
| `TASK_PROPAGATE_APPEARANCE` | 4×2 sheet with frame 1 dressed | The same appearance applied to frames 2–8 |
| `TASK_DRESS_WALK_SHEET` | Female base 4×2 walk sheet | All eight frames dressed from a text description |
| `TASK_DRESS_STANDING` | South-facing female base | Standing character dressed from a text description |

Use the exact task token and sentence structure used during training:

```text
TASK_ROTATE_STANDING: Turn the south-facing standing female LPC character to face north. Preserve the exact hairstyle, hair color, clothing, shoes and accessories. Keep the character centered on a pure white background.
```

```text
TASK_STANDING_TO_WALK_FIRST_FRAME: Convert this west-facing standing LPC character into the first frame of the west-facing walking animation. Preserve the exact appearance and pure white background.
```

```text
TASK_PROPAGATE_APPEARANCE: Use frame 1 as the appearance reference. Apply exactly the same hairstyle, hair color, clothing, shoes and accessories to frames 2 through 8. Preserve every walking pose, frame order, 4 by 2 layout and pure white background.
```

```text
TASK_DRESS_WALK_SHEET: Dress the female LPC character in all 8 east-facing walking frames with blue bob hair, a red long-sleeve shirt, navy pants, brown boots, and gold glasses. Preserve every pose, frame order, 4 by 2 layout and pure white background.
```

```text
TASK_DRESS_STANDING: Dress the south-facing standing female LPC character with blue bob hair, a red long-sleeve shirt, navy pants, brown boots, and gold glasses. Preserve the pose and pure white background.
```

## Recommended inference settings

- Base model: `black-forest-labs/FLUX.2-klein-base-9B`
- LoRA strength: `1.0`
- Steps: `28`
- CFG: `5`
- Sampler: Euler
- Standing tasks: `1024×1024`
- 4×2 sheet tasks: `2048×1024`
- Background: white

## ComfyUI workflow

The workflow uses only ComfyUI core nodes and has been tested on Comfy Cloud.

1. Install
   [`LPC_FourDirection_Walk_ComfyUI.safetensors`](https://huggingface.co/Baragi-AI/LPC-FourDirection-Walk-Flux-Klein-9B/resolve/main/LPC_FourDirection_Walk_ComfyUI.safetensors)
   as a LoRA.
2. Import
   [`workflows/LPC_FourDirection_Walk_ComfyUI.json`](workflows/LPC_FourDirection_Walk_ComfyUI.json).
3. Select an input image and paste one of the task prompts above.
4. Set `ImageScaleToTotalPixels` to `1.0` MP for standing/frame tasks or
   `2.0` MP for 4×2 sheets.
5. Generate with LoRA strength `1.0`, 28 steps, CFG `5`, and Euler.

The graph uses:

- `flux-2-klein-base-9b-fp8.safetensors`
- `qwen_3_8b_fp8mixed.safetensors`
- `full_encoder_small_decoder.safetensors`

Keep the input reference latent connected to both positive and negative
conditioning. This matches the official FLUX.2 Klein edit graph.

An API-format version is available at
[`workflows/LPC_FourDirection_Walk_API.json`](workflows/LPC_FourDirection_Walk_API.json).

## GUI

The included Korean-language Gradio workbench turns the five trained tasks
into a guided character-production flow. It works with Comfy Cloud or a local
ComfyUI server.

```powershell
python -m venv .venv
.\.venv\Scripts\python -m pip install --upgrade pip
.\.venv\Scripts\python -m pip install -r requirements.txt
.\.venv\Scripts\python app.py
```

For Comfy Cloud, copy `.env.example` to `.env` and set:

```dotenv
COMFY_URL=https://cloud.comfy.org
COMFY_API_KEY=your_api_key
```

The API key is read at runtime and is not written to the repository or output
files.

Use the virtual-environment commands above even if Anaconda `base` is active.
Gradio 5.x imports the removed `huggingface_hub.HfFolder` API and is not
supported by this GUI.

### Guided workflow

- **Quick build:** dress the bundled standing base, create selected standing
  directions, and build each direction's 4×2 walking sheet stage by stage.
  Run-all is a separate action and shows its Comfy job count first. Each stage
  can be regenerated immediately with a new recorded seed.
- **LoRA strength:** the always-visible shared slider applies `0``1.5` to
  every generation task; `0` disables the LoRA and `1.0` is the default.
- **Standing:** upload a character or start from the bundled female LPC base,
  then create a dressed standing proof and its 32-color palette.
- **Directions:** inspect north, west, south, and east standing results on one
  turnaround board. Up to four direction jobs run concurrently, and each
  result appears as soon as it finishes.
- **Walking:** create a first walking frame, insert it into the matching
  bundled 4×2 pose base, then propagate the appearance to all eight frames.
  Each completed sheet gets an immediate looping animation preview.
- **Pixel and palette:** snap to native LPC pixels, align 4×2 foot anchors,
  lock or rebuild a 32-color palette, and export indexed PNG or GIF.
- **Results and settings:** review local session outputs, test the Comfy
  connection, tune generation settings, or access the exact English task
  prompts in the advanced single-task panel.

Generated files are saved under the ignored local `outputs/` directory. The
bundled bases match the fixed feminine thin body and head used during training;
other body types are outside this toy model's supported scope.

### Pixel and palette output

The GUI includes deterministic sprite post-processing:

- **Lock reference palette:** maps every output pixel to the nearest color in
  the input image or an optional shared palette-reference image. Select the
  same reference for north, south, east, and west to keep one palette across
  all directions.
- **Allow new colors (32):** builds a new adaptive 32-color palette from the
  generated result. Use this when the prompt adds hair, clothing, or
  accessories whose colors are absent from the base.
- **Align 4×2 frames:** detects the white background and aligns each
  generated frame's foot anchor with the corresponding input frame.
- **Pixel snap:** uses
  [perfectPixel](https://github.com/theamusing/perfectPixel) to detect and
  refine the generated pixel grid before optional nearest-neighbor upscaling.
- **Shared direction palette:** once every selected direction is complete,
  one 32-color palette is calculated from all completed images and applied
  back to every direction without dithering.
- **Resolution:** returns either native `64×64` single frames /
  `256×128` 4×2 sheets or the generated upscaled resolution.
- **Output:** returns an indexed PNG sheet or an eight-frame looping GIF.
  GIF frames follow the 4×2 sheet in row-major order.

Both palette modes write a 32-entry indexed palette without dithering. The
background remains white.

## Verified Comfy Cloud examples

| Task | Input | Output |
|---|---|---|
| Dress standing character | ![Standing input](examples/standing_input.png) | ![Standing output](examples/cloud_t05_comfy_converted.png) |
| Propagate frame 1 appearance | ![Propagation input](examples/propagate_input.png) | ![Propagation output](examples/cloud_t03_comfy_converted.png) |

## Files

- `LPC_FourDirection_Walk.safetensors`: original fal/PEFT format
- `LPC_FourDirection_Walk_ComfyUI.safetensors`: ComfyUI-compatible key names
- LoRA rank: 16
- Tensors: 176, float32
- Original SHA-256: `5e092a1451be9565862c491e58cfd85514869433570e85f2d2661ff613cbab6c`
- ComfyUI SHA-256: `272ed2f178dc205b016d5783757ff0ee7ddaec834f95bdd7fc061d08e3dc2afe`

Use the original file with fal. Use the `_ComfyUI` file with ComfyUI. The
conversion only renames the fal PEFT prefix `base_model.model.` to ComfyUI's
FLUX model prefix `diffusion_model.`; tensor values are unchanged. The
reproducible converter is included as `convert_fal_lora_to_comfy.py`.

## Limitations

This is a toy-project LoRA trained on one female LPC body type. It may alter
silhouettes, frame spacing, or poses, especially for appearances outside the
training distribution. Generated sheets are not guaranteed to be
pixel-perfect and may need alignment or nearest-neighbor cleanup.

## License and attribution

The weights are a derivative of FLUX.2 [klein] Base 9B and are distributed
under the **FLUX Non-Commercial License v2.1**. Read `LICENSE.md` and `NOTICE`
before downloading or using them. Commercial or production use of the model
requires appropriate permission from Black Forest Labs.

Training assets are derived from
[ElizaWy/LPC](https://github.com/ElizaWy/LPC) and retain their respective LPC
asset licenses and attribution requirements. See `THIRD_PARTY_NOTICES.txt`.

This project is not affiliated with or endorsed by Black Forest Labs or the
LPC contributors.