neural: add flux 2 klein 4b

This commit is contained in:
luboslenco
2026-05-29 20:02:12 +02:00
parent 4316384c29
commit ef88a47fe8
3 changed files with 119 additions and 80 deletions
+86 -42
View File
@@ -1,19 +1,91 @@
#include "../global.h"
static string_array_t *edit_image_node_qwen_args(char *dir, char *prompt) {
string_array_t *argv = any_array_create_from_raw(
(void *[]){
string("%s/%s", dir, neural_node_sd_bin()),
"--diffusion-model",
string("%s/qwen-image-edit-2511-Q4_K_S.gguf", dir),
"--vae",
string("%s/Qwen_Image-VAE.safetensors", dir),
"--llm",
string("%s/Qwen2.5-VL-7B-Instruct-Q4_K_S.gguf", dir),
"--llm_vision",
string("%s/mmproj-F16.gguf", dir),
"--offload-to-cpu",
"--diffusion-fa",
"--steps",
"30",
"-s",
"-1",
"--cfg-scale",
"2.5",
"--flow-shift",
"3",
"--qwen-image-zero-cond-t",
"-W",
"512",
"-H",
"512",
"-p",
prompt,
"-r",
string("%s/input.png", dir),
"-o",
string("%s/output.png", dir),
NULL,
},
31);
return argv;
}
static string_array_t *edit_image_node_flux_klein_args(char *dir, char *prompt) {
string_array_t *argv = any_array_create_from_raw(
(void *[]){
string("%s/%s", dir, neural_node_sd_bin()),
"--diffusion-model",
string("%s/flux-2-klein-4b-Q8_0.gguf", dir),
"--vae",
// string("%s/full_encoder_small_decoder.safetensors", dir),
string("%s/flux_ae.safetensors", dir),
"--llm",
string("%s/Qwen3-4B-Q8_0.gguf", dir),
"--cfg-scale",
"1.0",
"--sampling-method",
"euler",
"--diffusion-fa",
"--offload-to-cpu",
"--steps",
"4",
"-s",
"-1",
"-W",
"512",
"-H",
"512",
"-r",
string("%s/input.png", dir),
"-p",
prompt,
"-o",
string("%s/output.png", dir),
NULL,
},
28);
return argv;
}
void edit_image_node_button(i32 node_id) {
ui_node_canvas_t *canvas = ui_nodes_get_canvas(true);
ui_node_t *node = ui_get_node(canvas->nodes, node_id);
char *node_name = parser_material_node_name(node, NULL);
ui_handle_t *h = ui_handle(node_name);
string_array_t *models = any_array_create_from_raw(
(void *[]){
"Qwen Image Edit",
},
1);
i32 model = ui_combo(ui_nest(h, 0), models, tr("Model"), false, UI_ALIGN_LEFT, true);
char *prompt = ui_text_area(ui_nest(h, 1), UI_ALIGN_LEFT, true, tr("prompt"), true);
string_array_t *models = any_array_create_from_raw((void *[]){"Qwen Image Edit", "FLUX 2 klein"}, 2);
i32 model = ui_combo(ui_nest(h, 0), models, tr("Model"), false, UI_ALIGN_LEFT, true);
char *prompt = ui_text_area(ui_nest(h, 1), UI_ALIGN_LEFT, true, tr("prompt"), true);
node->buttons->buffer[0]->height = string_split(prompt, "\n")->length + 2;
if (neural_node_button(node, models->buffer[model])) {
@@ -33,41 +105,13 @@ void edit_image_node_button(i32 node_id) {
prompt = ".";
}
string_array_t *argv = any_array_create_from_raw(
(void *[]){
string("%s/%s", dir, neural_node_sd_bin()),
"--diffusion-model",
string("%s/qwen-image-edit-2511-Q4_K_S.gguf", dir),
"--vae",
string("%s/Qwen_Image-VAE.safetensors", dir),
"--llm",
string("%s/Qwen2.5-VL-7B-Instruct-Q4_K_S.gguf", dir),
"--llm_vision",
string("%s/mmproj-F16.gguf", dir),
"--offload-to-cpu",
"--diffusion-fa",
"--steps",
"30",
"-s",
"-1",
"--cfg-scale",
"2.5",
"--flow-shift",
"3",
"--qwen-image-zero-cond-t",
"-W",
"512",
"-H",
"512",
"-p",
prompt,
"-r",
string("%s/input.png", dir),
"-o",
string("%s/output.png", dir),
NULL,
},
31);
string_array_t *argv;
if (model == 0) {
argv = edit_image_node_qwen_args(dir, prompt);
}
else {
argv = edit_image_node_flux_klein_args(dir, prompt);
}
iron_exec_async(argv->buffer[0], argv->buffer);
sys_notify_on_update(neural_node_check_result, node);
+18 -19
View File
@@ -32,6 +32,21 @@ void neural_node_models_init() {
.web = "https://huggingface.co/armory3d/z_image_turbo",
.license = "apache-2.0"}),
GC_ALLOC_INIT(neural_node_model_t,
{.name = "FLUX 2 klein",
.memory = "4GB",
.size = "8.2GB",
.nodes = "Text to Image, Edit Image",
.urls = any_array_create_from_raw(
(void *[]){
"https://huggingface.co/leejet/FLUX.2-klein-4B-GGUF/resolve/main/flux-2-klein-4b-Q8_0.gguf",
"https://huggingface.co/black-forest-labs/FLUX.2-small-decoder/resolve/main/full_encoder_small_decoder.safetensors",
"https://huggingface.co/unsloth/Qwen3-4B-GGUF/resolve/main/Qwen3-4B-Q8_0.gguf",
},
3),
.web = "https://huggingface.co/leejet/FLUX.2-klein-4B-GGUF",
.license = "apache-2.0"}),
GC_ALLOC_INIT(neural_node_model_t,
{.name = "Qwen Image",
.memory = "13GB",
@@ -63,22 +78,6 @@ void neural_node_models_init() {
.web = "https://huggingface.co/unsloth/Qwen-Image-Edit-2511-GGUF",
.license = "apache-2.0"}),
GC_ALLOC_INIT(neural_node_model_t,
{.name = "Wan",
.memory = "10GB",
.size = "21.3GB",
.nodes = "Text to Image",
.urls = any_array_create_from_raw(
(void *[]){
"https://huggingface.co/QuantStack/Wan2.2-T2V-A14B-GGUF/resolve/main/LowNoise/Wan2.2-T2V-A14B-LowNoise-Q4_K_S.gguf",
"https://huggingface.co/QuantStack/Wan2.2-T2V-A14B-GGUF/resolve/main/HighNoise/Wan2.2-T2V-A14B-HighNoise-Q4_K_S.gguf",
"https://huggingface.co/QuantStack/Wan2.2-T2V-A14B-GGUF/resolve/main/VAE/Wan2.1_VAE.safetensors",
"https://huggingface.co/city96/umt5-xxl-encoder-gguf/resolve/main/umt5-xxl-encoder-Q4_K_S.gguf",
},
4),
.web = "https://huggingface.co/QuantStack/Wan2.2-T2V-A14B-GGUF",
.license = "apache-2.0"}),
GC_ALLOC_INIT(neural_node_model_t,
{.name = "Marigold",
.memory = "6GB",
@@ -119,14 +118,14 @@ void neural_node_models_init() {
.web = "https://huggingface.co/armory3d/hunyuan3d21_portable",
.license = "hunyuan3d"}),
GC_ALLOC_INIT(neural_node_model_t, {.name = "Qwen",
GC_ALLOC_INIT(neural_node_model_t, {.name = "Qwen",
.memory = "16GB",
.size = "15.7GB",
.nodes = "Text to Text, Console",
.urls = any_array_create_from_raw(
(void *[]){
"https://huggingface.co/unsloth/Qwen3.6-27B-GGUF/resolve/main/Qwen3.6-27B-Q4_K_M.gguf",
// "https://huggingface.co/unsloth/Qwen3.6-27B-GGUF/resolve/main/mmproj-F16.gguf",
"https://huggingface.co/unsloth/Qwen3.6-27B-GGUF/resolve/main/Qwen3.6-27B-Q4_K_M.gguf",
// "https://huggingface.co/unsloth/Qwen3.6-27B-GGUF/resolve/main/mmproj-F16.gguf",
},
1),
.web = "https://huggingface.co/unsloth/Qwen3.6-27B-GGUF",
+15 -19
View File
@@ -91,42 +91,38 @@ string_array_t *text_to_image_node_qwen_args(char *dir, char *prompt) {
return argv;
}
string_array_t *text_to_image_node_wan_args(char *dir, char *prompt) {
string_array_t *text_to_image_node_flux_klein_args(char *dir, char *prompt) {
string_array_t *argv = any_array_create_from_raw(
(void *[]){
string("%s/%s", dir, neural_node_sd_bin()),
"-M",
"vid_gen",
"--diffusion-model",
string("%s/Wan2.2-T2V-A14B-LowNoise-Q4_K_S.gguf", dir),
"--high-noise-diffusion-model",
string("%s/Wan2.2-T2V-A14B-HighNoise-Q4_K_S.gguf", dir),
string("%s/flux-2-klein-4b-Q8_0.gguf", dir),
"--vae",
string("%s/Wan2.1_VAE.safetensors", dir),
"--t5xxl",
string("%s/umt5-xxl-encoder-Q4_K_S.gguf", dir),
// string("%s/full_encoder_small_decoder.safetensors", dir),
string("%s/flux_ae.safetensors", dir),
"--llm",
string("%s/Qwen3-4B-Q8_0.gguf", dir),
"--cfg-scale",
"1.0",
"--sampling-method",
"euler",
"--diffusion-fa",
"--offload-to-cpu",
"--steps",
"20",
"--high-noise-sampling-method",
"euler",
"--high-noise-steps",
"10",
"4",
"-W",
"512",
"-H",
"512",
"--offload-to-cpu",
"-s",
"-1",
"-o",
string("%s/output.png", dir),
"-p",
prompt,
string("'%s'", prompt),
NULL,
},
31);
26);
return argv;
}
@@ -150,7 +146,7 @@ void text_to_image_node_run(ui_node_t *node, void (*callback)(ui_node_t *)) {
argv = text_to_image_node_qwen_args(dir, prompt);
}
else {
argv = text_to_image_node_wan_args(dir, prompt);
argv = text_to_image_node_flux_klein_args(dir, prompt);
}
if (node->buttons->buffer[1]->default_value->buffer[0] > 0.0) {
array_insert(argv, argv->length - 1, "--circular");
@@ -168,7 +164,7 @@ void text_to_image_node_button(i32 node_id) {
"Stable Diffusion",
"Z-Image-Turbo",
"Qwen Image",
"Wan",
"FLUX 2 klein",
},
4);
i32 model = ui_combo(ui_nest(h, 0), models, tr("Model"), false, UI_ALIGN_LEFT, true);