diff --git a/clip.hpp b/clip.hpp index 318cfb5a..830a9e96 100644 --- a/clip.hpp +++ b/clip.hpp @@ -303,9 +303,14 @@ public: continue; std::u32string ts = decoder[t]; // printf("%d, %s \n", t, utf32_to_utf8(ts).c_str()); - text += " "+utf32_to_utf8(ts).replace(ts.length()-4, ts.length()-1, "") ; + std::string s = utf32_to_utf8(ts); + if(s.length() >= 4 && ends_with(s, "")){ + text += " "+s.replace(s.length()-4, s.length()-1, "") ; + }else{ + text += " "+s; + } } - std::vector bytes; + // std::vector bytes; // for (auto c : text){ // bytes.push_back(byte_decoder[c]); // } diff --git a/pmid.hpp b/pmid.hpp index 58821462..030d2b1b 100644 --- a/pmid.hpp +++ b/pmid.hpp @@ -547,7 +547,7 @@ struct PhotoMakerIDEncoder : public GGMLModule { #define PM_LORA_GRAPH_SIZE 10240 struct PhotoMakerLoraModel : public GGMLModule { - float multiplier = 1.0f; + float multiplier = 1.f; std::map lora_tensors; std::vector lora_tensors_to_be_ignored; std::string file_path; diff --git a/stable-diffusion.cpp b/stable-diffusion.cpp index 4da9fd85..538d6b0d 100644 --- a/stable-diffusion.cpp +++ b/stable-diffusion.cpp @@ -493,14 +493,12 @@ public: auto image_tokens = cond_stage_model.convert_token_to_id(trigger_word); GGML_ASSERT(image_tokens.size() == 1); - auto tokens_and_weights = cond_stage_model.tokenize(prompt, false); - std::vector& tokens = tokens_and_weights.first; + std::vector &tokens = tokens_and_weights.first; auto it = std::find(tokens.begin(), tokens.end(), image_tokens[0]); GGML_ASSERT(it != tokens.end()); // prompt must have trigger word tokens.erase(it); return cond_stage_model.decode(tokens); - } std::tuple> @@ -1583,7 +1581,7 @@ sd_image_t* txt2img(sd_ctx_t* sd_ctx, - t0 = ggml_time_ms(); + t0 = ggml_time_ms(); auto cond_pair = sd_ctx->sd->get_learned_condition(work_ctx, prompt, clip_skip, width, height); ggml_tensor* c = cond_pair.first; ggml_tensor* c_vector = cond_pair.second; // [adm_in_channels, ]