Skip to content

Commit 419dd92

Browse files
committed
Disable forcing CLIP weights to F32 for reduced memory usage
1 parent 9e64a0e commit 419dd92

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

otherarch/sdcpp/clip.hpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -547,6 +547,12 @@ class CLIPEmbeddings : public GGMLBlock {
547547

548548
void init_params(struct ggml_context* ctx, const String2GGMLType& tensor_types = {}, const std::string prefix = "") {
549549
enum ggml_type token_wtype = GGML_TYPE_F32;
550+
#if 1
551+
// kcpp reduce memory usage (reverts https://github.com/leejet/stable-diffusion.cpp/pull/601)
552+
auto tensor_type = tensor_types.find(prefix + "token_embedding.weight");
553+
if (tensor_type != tensor_types.end())
554+
token_wtype = tensor_type->second;
555+
#endif
550556
enum ggml_type position_wtype = GGML_TYPE_F32;
551557

552558
params["token_embedding.weight"] = ggml_new_tensor_2d(ctx, token_wtype, embed_dim, vocab_size);

0 commit comments

Comments
 (0)