Skip to content

Commit b4b5b4c

Browse files
committed
Merge branch 'qwen_image' into qwen_image_edit
2 parents 0741f14 + 7519e2f commit b4b5b4c

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

qwen_image.hpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,10 @@ namespace Qwen {
9797
blocks["to_out.0"] = std::shared_ptr<GGMLBlock>(new Linear(inner_dim, out_dim, out_bias));
9898
// to_out.1 is nn.Dropout
9999

100-
blocks["to_add_out"] = std::shared_ptr<GGMLBlock>(new Linear(inner_dim, out_context_dim, out_bias));
100+
float scale = 1.f / 32.f;
101+
// The purpose of the scale here is to prevent NaN issues in certain situations.
102+
// For example when using CUDA but the weights are k-quants (not all prompts).
103+
blocks["to_add_out"] = std::shared_ptr<GGMLBlock>(new Linear(inner_dim, out_context_dim, out_bias, false, false, scale));
101104
}
102105

103106
std::pair<ggml_tensor*, ggml_tensor*> forward(struct ggml_context* ctx,

0 commit comments

Comments
 (0)