Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f5997a1

Browse files
committed
fix: do not force using f32 for some flux layers
This sometimes leads to worse result
1 parent 1bdc767 commit f5997a1

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

flux.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ namespace Flux {
1313
struct MLPEmbedder : public UnaryBlock {
1414
public:
1515
MLPEmbedder(int64_t in_dim, int64_t hidden_dim) {
16-
blocks["in_layer"] = std::shared_ptr<GGMLBlock>(new Linear(in_dim, hidden_dim, true, true));
16+
blocks["in_layer"] = std::shared_ptr<GGMLBlock>(new Linear(in_dim, hidden_dim, true));
1717
blocks["out_layer"] = std::shared_ptr<GGMLBlock>(new Linear(hidden_dim, hidden_dim, true));
1818
}
1919

@@ -449,7 +449,7 @@ namespace Flux {
449449
int64_t patch_size,
450450
int64_t out_channels) {
451451
blocks["norm_final"] = std::shared_ptr<GGMLBlock>(new LayerNorm(hidden_size, 1e-06f, false));
452-
blocks["linear"] = std::shared_ptr<GGMLBlock>(new Linear(hidden_size, patch_size * patch_size * out_channels, true, true));
452+
blocks["linear"] = std::shared_ptr<GGMLBlock>(new Linear(hidden_size, patch_size * patch_size * out_channels));
453453
blocks["adaLN_modulation.1"] = std::shared_ptr<GGMLBlock>(new Linear(hidden_size, 2 * hidden_size));
454454
}
455455

@@ -634,13 +634,13 @@ namespace Flux {
634634
int64_t out_channels = params.in_channels;
635635
int64_t pe_dim = params.hidden_size / params.num_heads;
636636

637-
blocks["img_in"] = std::shared_ptr<GGMLBlock>(new Linear(params.in_channels, params.hidden_size, true, true));
637+
blocks["img_in"] = std::shared_ptr<GGMLBlock>(new Linear(params.in_channels, params.hidden_size, true));
638638
blocks["time_in"] = std::shared_ptr<GGMLBlock>(new MLPEmbedder(256, params.hidden_size));
639639
blocks["vector_in"] = std::shared_ptr<GGMLBlock>(new MLPEmbedder(params.vec_in_dim, params.hidden_size));
640640
if (params.guidance_embed) {
641641
blocks["guidance_in"] = std::shared_ptr<GGMLBlock>(new MLPEmbedder(256, params.hidden_size));
642642
}
643-
blocks["txt_in"] = std::shared_ptr<GGMLBlock>(new Linear(params.context_in_dim, params.hidden_size, true, true));
643+
blocks["txt_in"] = std::shared_ptr<GGMLBlock>(new Linear(params.context_in_dim, params.hidden_size, true));
644644

645645
for (int i = 0; i < params.depth; i++) {
646646
blocks["double_blocks." + std::to_string(i)] = std::shared_ptr<GGMLBlock>(new DoubleStreamBlock(params.hidden_size,

0 commit comments

Comments
 (0)