Skip to content

Commit 3f3c328

Browse files
committed
avoid build failures in macos
1 parent adcfa6e commit 3f3c328

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

conditioner.hpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ struct SDCondition {
88
struct ggml_tensor* c_crossattn = NULL; // aka context
99
struct ggml_tensor* c_vector = NULL; // aka y
1010
struct ggml_tensor* c_concat = NULL;
11+
12+
SDCondition() = default;
13+
SDCondition(struct ggml_tensor* c_crossattn, struct ggml_tensor* c_vector, struct ggml_tensor* c_concat) :
14+
c_crossattn(c_crossattn), c_vector(c_vector), c_concat(c_concat) {}
1115
};
1216

1317
struct Conditioner {
@@ -514,7 +518,7 @@ struct FrozenCLIPEmbedderWithCustomWords : public Conditioner {
514518
GGML_ASSERT(offset == ggml_nbytes(vec));
515519
}
516520
// print_ggml_tensor(result);
517-
return {hidden_states, vec, NULL};
521+
return SDCondition(hidden_states, vec, NULL);
518522
}
519523

520524
std::tuple<SDCondition, std::vector<bool>>
@@ -941,7 +945,7 @@ struct SD3CLIPEmbedder : public Conditioner {
941945
hidden_states,
942946
chunk_hidden_states->ne[0],
943947
ggml_nelements(hidden_states) / chunk_hidden_states->ne[0]);
944-
return {hidden_states, pooled, NULL};
948+
return SDCondition(hidden_states, pooled, NULL);
945949
}
946950

947951
SDCondition get_learned_condition(ggml_context* work_ctx,

stable-diffusion.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1482,7 +1482,7 @@ SD_API sd_image_t* img2vid(sd_ctx_t* sd_ctx,
14821482

14831483
auto uc_vector = ggml_dup_tensor(work_ctx, cond.c_vector);
14841484

1485-
SDCondition uncond = {uc_crossattn, uc_vector, uc_concat};
1485+
SDCondition uncond = SDCondition(uc_crossattn, uc_vector, uc_concat);
14861486

14871487
int64_t t1 = ggml_time_ms();
14881488
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,
15131513
sample_method,
15141514
sigmas,
15151515
-1,
1516-
{NULL, NULL});
1516+
SDCondition(NULL, NULL, NULL));
15171517

15181518
int64_t t2 = ggml_time_ms();
15191519
LOG_INFO("sampling completed, taking %.2fs", (t2 - t1) * 1.0f / 1000);

t5.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ class T5UniGramTokenizer {
151151
value[i] = (*pieces)[i].second; // vocab_id
152152
}
153153

154-
trie_ = std::make_unique<Darts::DoubleArray>();
154+
trie_ = std::unique_ptr<Darts::DoubleArray>(new Darts::DoubleArray());
155155
if (trie_->build(key.size(), const_cast<char**>(&key[0]), nullptr,
156156
&value[0]) != 0) {
157157
status_ = BUILD_DOUBLE_ARRAY_FAILED;

0 commit comments

Comments
 (0)