avoid build failures in macos

This commit is contained in:
leejet 2024-07-07 18:24:30 +08:00
parent adcfa6e03e
commit 3f3c328eeb
3 changed files with 9 additions and 5 deletions

View File

@ -8,6 +8,10 @@ struct SDCondition {
struct ggml_tensor* c_crossattn = NULL; // aka context struct ggml_tensor* c_crossattn = NULL; // aka context
struct ggml_tensor* c_vector = NULL; // aka y struct ggml_tensor* c_vector = NULL; // aka y
struct ggml_tensor* c_concat = NULL; struct ggml_tensor* c_concat = NULL;
SDCondition() = default;
SDCondition(struct ggml_tensor* c_crossattn, struct ggml_tensor* c_vector, struct ggml_tensor* c_concat) :
c_crossattn(c_crossattn), c_vector(c_vector), c_concat(c_concat) {}
}; };
struct Conditioner { struct Conditioner {
@ -514,7 +518,7 @@ struct FrozenCLIPEmbedderWithCustomWords : public Conditioner {
GGML_ASSERT(offset == ggml_nbytes(vec)); GGML_ASSERT(offset == ggml_nbytes(vec));
} }
// print_ggml_tensor(result); // print_ggml_tensor(result);
return {hidden_states, vec, NULL}; return SDCondition(hidden_states, vec, NULL);
} }
std::tuple<SDCondition, std::vector<bool>> std::tuple<SDCondition, std::vector<bool>>
@ -941,7 +945,7 @@ struct SD3CLIPEmbedder : public Conditioner {
hidden_states, hidden_states,
chunk_hidden_states->ne[0], chunk_hidden_states->ne[0],
ggml_nelements(hidden_states) / chunk_hidden_states->ne[0]); ggml_nelements(hidden_states) / chunk_hidden_states->ne[0]);
return {hidden_states, pooled, NULL}; return SDCondition(hidden_states, pooled, NULL);
} }
SDCondition get_learned_condition(ggml_context* work_ctx, SDCondition get_learned_condition(ggml_context* work_ctx,

View File

@ -1482,7 +1482,7 @@ SD_API sd_image_t* img2vid(sd_ctx_t* sd_ctx,
auto uc_vector = ggml_dup_tensor(work_ctx, cond.c_vector); auto uc_vector = ggml_dup_tensor(work_ctx, cond.c_vector);
SDCondition uncond = {uc_crossattn, uc_vector, uc_concat}; SDCondition uncond = SDCondition(uc_crossattn, uc_vector, uc_concat);
int64_t t1 = ggml_time_ms(); int64_t t1 = ggml_time_ms();
LOG_INFO("get_learned_condition completed, taking %" PRId64 " ms", t1 - t0); LOG_INFO("get_learned_condition completed, taking %" PRId64 " ms", t1 - t0);
@ -1513,7 +1513,7 @@ SD_API sd_image_t* img2vid(sd_ctx_t* sd_ctx,
sample_method, sample_method,
sigmas, sigmas,
-1, -1,
{NULL, NULL}); SDCondition(NULL, NULL, NULL));
int64_t t2 = ggml_time_ms(); int64_t t2 = ggml_time_ms();
LOG_INFO("sampling completed, taking %.2fs", (t2 - t1) * 1.0f / 1000); LOG_INFO("sampling completed, taking %.2fs", (t2 - t1) * 1.0f / 1000);

2
t5.hpp
View File

@ -151,7 +151,7 @@ protected:
value[i] = (*pieces)[i].second; // vocab_id value[i] = (*pieces)[i].second; // vocab_id
} }
trie_ = std::make_unique<Darts::DoubleArray>(); trie_ = std::unique_ptr<Darts::DoubleArray>(new Darts::DoubleArray());
if (trie_->build(key.size(), const_cast<char**>(&key[0]), nullptr, if (trie_->build(key.size(), const_cast<char**>(&key[0]), nullptr,
&value[0]) != 0) { &value[0]) != 0) {
status_ = BUILD_DOUBLE_ARRAY_FAILED; status_ = BUILD_DOUBLE_ARRAY_FAILED;