diff --git a/src/model/diffusion/qwen_image_2_1.hpp b/src/model/diffusion/qwen_image_2_1.hpp index 5b5872a4..cb044053 100644 --- a/src/model/diffusion/qwen_image_2_1.hpp +++ b/src/model/diffusion/qwen_image_2_1.hpp @@ -193,16 +193,16 @@ namespace Qwen { class QwenImage21TransformerBlock : public GGMLBlock { public: QwenImage21TransformerBlock(const QwenImage21Config& config) { - blocks["img_norm1"] = std::make_shared(config.hidden_size, 1e-6f, false); - blocks["img_norm2"] = std::make_shared(config.hidden_size, 1e-6f, false); - blocks["attn"] = std::make_shared(config); + blocks["img_norm1"] = std::make_shared(config.hidden_size, 1e-6f, false); + blocks["img_norm2"] = std::make_shared(config.hidden_size, 1e-6f, false); + blocks["attn"] = std::make_shared(config); if (config.fused_mlp) { blocks["img_mlp.gate_up"] = std::make_shared(config.hidden_size, 2 * config.intermediate_size, false); } else { blocks["img_mlp.proj"] = std::make_shared(config.hidden_size, config.intermediate_size, false); blocks["img_mlp.gate_layer"] = std::make_shared(config.hidden_size, config.intermediate_size, false); } - blocks["img_mlp.out"] = std::make_shared(config.intermediate_size, config.hidden_size, false); + blocks["img_mlp.out"] = std::make_shared(config.intermediate_size, config.hidden_size, false); } static ggml_tensor* modulate(ggml_context* ctx, ggml_tensor* x, ggml_tensor* params, int64_t prefix_length, bool gate = false) { @@ -220,12 +220,12 @@ namespace Qwen { } ggml_tensor* forward(GGMLRunnerContext* ctx, ggml_tensor* x, const std::vector& modulation, ggml_tensor* pe, const QwenImage21Layout& layout, const std::vector& masks) { - auto h = std::dynamic_pointer_cast(blocks["img_norm1"])->forward(ctx, x); - h = modulate(ctx->ggml_ctx, h, modulation[0], layout.prefix_length); - h = std::dynamic_pointer_cast(blocks["attn"])->forward(ctx, h, pe, layout.segments, masks); - x = ggml_add(ctx->ggml_ctx, x, modulate(ctx->ggml_ctx, h, modulation[1], layout.prefix_length, true)); - h = std::dynamic_pointer_cast(blocks["img_norm2"])->forward(ctx, x); - h = modulate(ctx->ggml_ctx, h, modulation[2], layout.prefix_length); + auto h = std::dynamic_pointer_cast(blocks["img_norm1"])->forward(ctx, x); + h = modulate(ctx->ggml_ctx, h, modulation[0], layout.prefix_length); + h = std::dynamic_pointer_cast(blocks["attn"])->forward(ctx, h, pe, layout.segments, masks); + x = ggml_add(ctx->ggml_ctx, x, modulate(ctx->ggml_ctx, h, modulation[1], layout.prefix_length, true)); + h = std::dynamic_pointer_cast(blocks["img_norm2"])->forward(ctx, x); + h = modulate(ctx->ggml_ctx, h, modulation[2], layout.prefix_length); ggml_tensor* gate; auto fused = blocks.find("img_mlp.gate_up"); if (fused != blocks.end()) { @@ -237,8 +237,8 @@ namespace Qwen { gate = std::dynamic_pointer_cast(blocks["img_mlp.gate_layer"])->forward(ctx, h); h = std::dynamic_pointer_cast(blocks["img_mlp.proj"])->forward(ctx, h); } - h = ggml_mul(ctx->ggml_ctx, h, ggml_silu(ctx->ggml_ctx, gate)); - h = std::dynamic_pointer_cast(blocks["img_mlp.out"])->forward(ctx, h); + h = ggml_mul(ctx->ggml_ctx, h, ggml_silu(ctx->ggml_ctx, gate)); + h = std::dynamic_pointer_cast(blocks["img_mlp.out"])->forward(ctx, h); return ggml_add(ctx->ggml_ctx, x, modulate(ctx->ggml_ctx, h, modulation[3], layout.prefix_length, true)); } }; diff --git a/src/model/te/llada_image_te.hpp b/src/model/te/llada_image_te.hpp index 022fd7a1..1c97a452 100644 --- a/src/model/te/llada_image_te.hpp +++ b/src/model/te/llada_image_te.hpp @@ -265,7 +265,7 @@ namespace LLaDAImageTE { struct SigVQConfig { int64_t image_size = 2048; - int64_t patch_size = 16; + int patch_size = 16; int64_t in_channels = 3; int64_t hidden_size = 1536; int64_t intermediate_size = 6144; diff --git a/src/model/vae/wan_vae.hpp b/src/model/vae/wan_vae.hpp index 79efca4a..035deae3 100644 --- a/src/model/vae/wan_vae.hpp +++ b/src/model/vae/wan_vae.hpp @@ -1070,11 +1070,11 @@ namespace WAN { } if (version == VERSION_QWEN_IMAGE_2_1) { - wan2_2 = true; - dec_dim = 144; - z_dim = 64; - input_channels = 4; - dim_mult = {1, 2, 4, 8, 8}; + wan2_2 = true; + dec_dim = 144; + z_dim = 64; + input_channels = 4; + dim_mult = {1, 2, 4, 8, 8}; } if (is_2D) { diff --git a/src/model_loader_files.cpp b/src/model_loader_files.cpp index f7f1cb37..8e838b11 100644 --- a/src/model_loader_files.cpp +++ b/src/model_loader_files.cpp @@ -147,7 +147,7 @@ bool ModelLoader::add_file_impl(const std::string& path, const std::string& pref } if (tensor.index_in_zip < 0) { const auto& stamp = physical_files[tensor.file_index]; - if (tensor.offset > stamp.size || static_cast(tensor.nbytes_to_read()) > stamp.size - tensor.offset) { //kcpp int8 fp8 + if (tensor.offset > stamp.size || static_cast(tensor.nbytes_to_read()) > stamp.size - tensor.offset) { // kcpp int8 fp8 LOG_ERROR("tensor '%s' extends beyond its model file", tensor.name.c_str()); return false; }