patch size consistent with Flux1

This commit is contained in:
Stéphane du Hamel 2025-12-12 02:39:09 +01:00
parent fd032bcfa7
commit 196bb895fd
3 changed files with 3 additions and 13 deletions

View File

@ -1309,7 +1309,6 @@ namespace Flux {
} else if (sd_version_is_longcat(version)) { } else if (sd_version_is_longcat(version)) {
flux_params.context_in_dim = 3584; flux_params.context_in_dim = 3584;
flux_params.vec_in_dim = 0; flux_params.vec_in_dim = 0;
flux_params.patch_size = 1;
} }
for (auto pair : tensor_storage_map) { for (auto pair : tensor_storage_map) {
std::string tensor_name = pair.first; std::string tensor_name = pair.first;

View File

@ -1346,12 +1346,6 @@ public:
latent_rgb_bias = flux2_latent_rgb_bias; latent_rgb_bias = flux2_latent_rgb_bias;
patch_sz = 2; patch_sz = 2;
} }
} else if (dim == 64) {
if (sd_version_is_flux(version) || sd_version_is_z_image(version) || sd_version_is_longcat(version)) {
latent_rgb_proj = flux_latent_rgb_proj;
latent_rgb_bias = flux_latent_rgb_bias;
patch_sz = 2;
}
} else if (dim == 48) { } else if (dim == 48) {
if (sd_version_is_wan(version)) { if (sd_version_is_wan(version)) {
latent_rgb_proj = wan_22_latent_rgb_proj; latent_rgb_proj = wan_22_latent_rgb_proj;
@ -1916,7 +1910,7 @@ public:
int vae_scale_factor = 8; int vae_scale_factor = 8;
if (version == VERSION_WAN2_2_TI2V) { if (version == VERSION_WAN2_2_TI2V) {
vae_scale_factor = 16; vae_scale_factor = 16;
} else if (sd_version_is_flux2(version) || sd_version_is_longcat(version)) { } else if (sd_version_is_flux2(version)) {
vae_scale_factor = 16; vae_scale_factor = 16;
} else if (version == VERSION_CHROMA_RADIANCE) { } else if (version == VERSION_CHROMA_RADIANCE) {
vae_scale_factor = 1; vae_scale_factor = 1;
@ -1945,8 +1939,6 @@ public:
latent_channel = 3; latent_channel = 3;
} else if (sd_version_is_flux2(version)) { } else if (sd_version_is_flux2(version)) {
latent_channel = 128; latent_channel = 128;
} else if (sd_version_is_longcat(version)) {
latent_channel = 64;
} else { } else {
latent_channel = 16; latent_channel = 16;
} }
@ -2247,7 +2239,6 @@ public:
sd_version_is_qwen_image(version) || sd_version_is_qwen_image(version) ||
sd_version_is_wan(version) || sd_version_is_wan(version) ||
sd_version_is_flux2(version) || sd_version_is_flux2(version) ||
sd_version_is_longcat(version) ||
version == VERSION_CHROMA_RADIANCE) { version == VERSION_CHROMA_RADIANCE) {
latent = vae_output; latent = vae_output;
} else if (version == VERSION_SD1_PIX2PIX) { } else if (version == VERSION_SD1_PIX2PIX) {

View File

@ -553,7 +553,7 @@ public:
struct ggml_tensor* decode(GGMLRunnerContext* ctx, struct ggml_tensor* z) { struct ggml_tensor* decode(GGMLRunnerContext* ctx, struct ggml_tensor* z) {
// z: [N, z_channels, h, w] // z: [N, z_channels, h, w]
if (sd_version_is_flux2(version) || sd_version_is_longcat(version)) { if (sd_version_is_flux2(version)) {
// [N, C*p*p, h, w] -> [N, C, h*p, w*p] // [N, C*p*p, h, w] -> [N, C, h*p, w*p]
int64_t p = 2; int64_t p = 2;
@ -592,7 +592,7 @@ public:
auto quant_conv = std::dynamic_pointer_cast<Conv2d>(blocks["quant_conv"]); auto quant_conv = std::dynamic_pointer_cast<Conv2d>(blocks["quant_conv"]);
z = quant_conv->forward(ctx, z); // [N, 2*embed_dim, h/8, w/8] z = quant_conv->forward(ctx, z); // [N, 2*embed_dim, h/8, w/8]
} }
if (sd_version_is_flux2(version) || sd_version_is_longcat(version)) { if (sd_version_is_flux2(version)) {
z = ggml_ext_chunk(ctx->ggml_ctx, z, 2, 2)[0]; z = ggml_ext_chunk(ctx->ggml_ctx, z, 2, 2)[0];
// [N, C, H, W] -> [N, C*p*p, H/p, W/p] // [N, C, H, W] -> [N, C*p*p, H/p, W/p]