mirror of
https://github.com/leejet/stable-diffusion.cpp.git
synced 2026-11-11 19:36:33 +00:00
chore: format code
This commit is contained in:
1 parent
40b1788476
commit
e0ed724e28
69 files changed
+711
-441
No files matched your search
@@ -660,7 +660,7 @@ namespace Rope {
|
||||
const int axes_dim_num = static_cast<int>(axes_dim.size());
|
||||
auto make_image_ids = [=, &result](int image_h, int image_w, int image_index) {
|
||||
std::vector<std::vector<float>> image_ids(static_cast<size_t>(bs) * image_h * image_w,
|
||||
std::vector<float>(axes_dim_num, 0.f));
|
||||
std::vector<float>(axes_dim_num, 0.f));
|
||||
result.positions.append_image(image_h, image_w);
|
||||
int h_start = -(image_h - image_h / 2);
|
||||
int w_start = -(image_w - image_w / 2);
|
||||
|
||||
@@ -543,18 +543,18 @@ namespace Boogu {
|
||||
blocks["x_embedder"] = std::make_shared<Linear>(this->config.patch_size * this->config.patch_size * this->config.in_channels, this->config.hidden_size, true);
|
||||
blocks["ref_image_patch_embedder"] = std::make_shared<Linear>(this->config.patch_size * this->config.patch_size * this->config.in_channels, this->config.hidden_size, true);
|
||||
blocks["time_caption_embed"] = std::make_shared<LuminaCombinedTimestepCaptionEmbedding>(this->config.hidden_size,
|
||||
this->config.instruction_feat_dim,
|
||||
256,
|
||||
this->config.norm_eps,
|
||||
this->config.timestep_scale);
|
||||
this->config.instruction_feat_dim,
|
||||
256,
|
||||
this->config.norm_eps,
|
||||
this->config.timestep_scale);
|
||||
|
||||
for (int i = 0; i < this->config.num_refiner_layers; i++) {
|
||||
blocks["noise_refiner." + std::to_string(i)] = std::make_shared<BooguImageTransformerBlock>(this->config.hidden_size,
|
||||
this->config.num_attention_heads,
|
||||
this->config.num_kv_heads,
|
||||
this->config.multiple_of,
|
||||
this->config.norm_eps,
|
||||
true);
|
||||
this->config.num_attention_heads,
|
||||
this->config.num_kv_heads,
|
||||
this->config.multiple_of,
|
||||
this->config.norm_eps,
|
||||
true);
|
||||
blocks["ref_image_refiner." + std::to_string(i)] = std::make_shared<BooguImageTransformerBlock>(this->config.hidden_size,
|
||||
this->config.num_attention_heads,
|
||||
this->config.num_kv_heads,
|
||||
@@ -562,11 +562,11 @@ namespace Boogu {
|
||||
this->config.norm_eps,
|
||||
true);
|
||||
blocks["context_refiner." + std::to_string(i)] = std::make_shared<BooguImageTransformerBlock>(this->config.hidden_size,
|
||||
this->config.num_attention_heads,
|
||||
this->config.num_kv_heads,
|
||||
this->config.multiple_of,
|
||||
this->config.norm_eps,
|
||||
false);
|
||||
this->config.num_attention_heads,
|
||||
this->config.num_kv_heads,
|
||||
this->config.multiple_of,
|
||||
this->config.norm_eps,
|
||||
false);
|
||||
}
|
||||
|
||||
for (int i = 0; i < this->config.num_double_stream_layers; i++) {
|
||||
|
||||
@@ -243,7 +243,7 @@ namespace Flux3 {
|
||||
set_backend_tensor_data(pe, pe_values.data());
|
||||
auto runner_ctx = get_context();
|
||||
auto out = model.forward(&runner_ctx, x, text, references, make_input(*params.timesteps), make_input(zero),
|
||||
config.flow_map ? make_input(*extra->target_timestep) : nullptr, pe);
|
||||
config.flow_map ? make_input(*extra->target_timestep) : nullptr, pe);
|
||||
ggml_build_forward_expand(gf, out);
|
||||
return gf;
|
||||
};
|
||||
|
||||
@@ -238,10 +238,10 @@ namespace HiDreamO1 {
|
||||
blocks["language_model"] = std::make_shared<LLM::TextModel>(this->config.llm);
|
||||
blocks["t_embedder1"] = std::make_shared<TimestepEmbedder>(this->config.llm.hidden_size);
|
||||
blocks["x_embedder"] = std::make_shared<BottleneckPatchEmbed>(this->config.patch_size * this->config.patch_size * 3,
|
||||
this->config.llm.hidden_size / 4,
|
||||
this->config.llm.hidden_size);
|
||||
this->config.llm.hidden_size / 4,
|
||||
this->config.llm.hidden_size);
|
||||
blocks["final_layer2"] = std::make_shared<FinalLayer>(this->config.llm.hidden_size,
|
||||
this->config.patch_size * this->config.patch_size * 3);
|
||||
this->config.patch_size * this->config.patch_size * 3);
|
||||
}
|
||||
|
||||
std::shared_ptr<LLM::TextModel> text_model() {
|
||||
|
||||
@@ -302,9 +302,9 @@ namespace Hunyuan {
|
||||
int64_t head_dim = this->config.hidden_size / this->config.num_heads;
|
||||
blocks["txt_in"] = std::make_shared<TokenRefiner>(this->config.context_in_dim, this->config.num_heads, head_dim, 2);
|
||||
blocks["img_in"] = std::make_shared<PatchEmbed>(static_cast<int64_t>(224) /*Not used*/,
|
||||
this->config.patch_size,
|
||||
this->config.in_channels,
|
||||
this->config.hidden_size);
|
||||
this->config.patch_size,
|
||||
this->config.in_channels,
|
||||
this->config.hidden_size);
|
||||
blocks["time_in"] = std::make_shared<Flux::MLPEmbedder>(256, this->config.hidden_size);
|
||||
if (this->config.vec_in_dim > 0) {
|
||||
blocks["vector_in"] = std::make_shared<Flux::MLPEmbedder>(this->config.vec_in_dim, this->config.hidden_size);
|
||||
|
||||
@@ -73,9 +73,9 @@ namespace Krea2 {
|
||||
int64_t dim_head = head_dim();
|
||||
int64_t unit = dim_head / 16;
|
||||
axes_dim = {
|
||||
static_cast<int>(dim_head - 12 * unit),
|
||||
static_cast<int>(6 * unit),
|
||||
static_cast<int>(6 * unit),
|
||||
static_cast<int>(dim_head - 12 * unit),
|
||||
static_cast<int>(6 * unit),
|
||||
static_cast<int>(6 * unit),
|
||||
};
|
||||
axes_dim_sum = axes_dim[0] + axes_dim[1] + axes_dim[2];
|
||||
}
|
||||
@@ -387,10 +387,10 @@ namespace Krea2 {
|
||||
this->config.mlp_multiplier,
|
||||
this->config.norm_eps);
|
||||
blocks["refiner_blocks." + std::to_string(i)] = std::make_shared<KreaTextFusionBlock>(this->config.text_dim,
|
||||
this->config.text_heads,
|
||||
this->config.text_kv_heads,
|
||||
this->config.mlp_multiplier,
|
||||
this->config.norm_eps);
|
||||
this->config.text_heads,
|
||||
this->config.text_kv_heads,
|
||||
this->config.mlp_multiplier,
|
||||
this->config.norm_eps);
|
||||
}
|
||||
blocks["projector"] = std::make_shared<Linear>(this->config.text_layers, 1, false);
|
||||
}
|
||||
@@ -613,8 +613,8 @@ namespace Krea2 {
|
||||
explicit Krea2Model(Krea2Config config)
|
||||
: config(std::move(config)) {
|
||||
blocks["first"] = std::make_shared<Linear>(this->config.patch_size * this->config.patch_size * this->config.in_channels,
|
||||
this->config.features,
|
||||
true);
|
||||
this->config.features,
|
||||
true);
|
||||
blocks["tmlp"] = std::make_shared<KreaTimeMLP>(this->config);
|
||||
blocks["txtfusion"] = std::make_shared<KreaTextFusionTransformer>(this->config);
|
||||
blocks["txtmlp"] = std::make_shared<KreaTextMLP>(this->config);
|
||||
|
||||
@@ -442,10 +442,10 @@ namespace LingBotVideo {
|
||||
: hidden_size(config.hidden_size) {
|
||||
blocks["norm1"] = std::make_shared<RMSNorm>(config.hidden_size, config.norm_eps);
|
||||
blocks["attn"] = std::make_shared<LingBotVideoAttention>(config.hidden_size,
|
||||
config.num_attention_heads,
|
||||
config.qkv_bias,
|
||||
config.out_bias,
|
||||
config.norm_eps);
|
||||
config.num_attention_heads,
|
||||
config.qkv_bias,
|
||||
config.out_bias,
|
||||
config.norm_eps);
|
||||
blocks["norm_post_attn"] = std::make_shared<RMSNorm>(config.hidden_size, config.norm_eps);
|
||||
blocks["norm2"] = std::make_shared<RMSNorm>(config.hidden_size, config.norm_eps);
|
||||
if (sparse) {
|
||||
@@ -509,14 +509,14 @@ namespace LingBotVideo {
|
||||
int64_t patch_dim = config.patch_t * config.patch_h * config.patch_w * config.in_channels;
|
||||
blocks["patch_embedder"] = std::make_shared<Linear>(patch_dim, config.hidden_size, config.patch_embed_bias);
|
||||
blocks["time_embedder"] = std::make_shared<Qwen::TimestepEmbedding>(config.freq_dim,
|
||||
config.hidden_size,
|
||||
config.hidden_size,
|
||||
0,
|
||||
config.timestep_mlp_bias);
|
||||
config.hidden_size,
|
||||
config.hidden_size,
|
||||
0,
|
||||
config.timestep_mlp_bias);
|
||||
blocks["time_modulation.1"] = std::make_shared<Linear>(config.hidden_size, 6 * config.hidden_size, true);
|
||||
blocks["text_embedder"] = std::make_shared<LingBotVideoTextEmbedder>(config.text_dim,
|
||||
config.hidden_size,
|
||||
config.norm_eps);
|
||||
config.hidden_size,
|
||||
config.norm_eps);
|
||||
for (int i = 0; i < config.depth; i++) {
|
||||
bool sparse = config.sparse_layers.find(i) != config.sparse_layers.end();
|
||||
blocks["blocks." + std::to_string(i)] = std::make_shared<LingBotVideoBlock>(config, sparse);
|
||||
@@ -524,8 +524,8 @@ namespace LingBotVideo {
|
||||
blocks["norm_out"] = std::make_shared<LayerNorm>(config.hidden_size, config.norm_eps, false);
|
||||
blocks["norm_out_modulation.1"] = std::make_shared<Linear>(config.hidden_size, 2 * config.hidden_size, true);
|
||||
blocks["proj_out"] = std::make_shared<Linear>(config.hidden_size,
|
||||
config.patch_t * config.patch_h * config.patch_w * config.out_channels,
|
||||
true);
|
||||
config.patch_t * config.patch_h * config.patch_w * config.out_channels,
|
||||
true);
|
||||
}
|
||||
|
||||
ggml_tensor* forward(GGMLRunnerContext* ctx,
|
||||
|
||||
@@ -463,7 +463,7 @@ namespace LLaDAImage {
|
||||
static_cast<int>(x->ne[0]),
|
||||
config.patch_size,
|
||||
static_cast<int>(context->ne[1]),
|
||||
semantic != nullptr ? static_cast<int>(semantic->ne[1]) : 0,
|
||||
semantic != nullptr ? static_cast<int>(semantic->ne[1]) : 0,
|
||||
ZImage::SEQ_MULTI_OF,
|
||||
config.theta,
|
||||
config.axes_dim));
|
||||
|
||||
@@ -597,9 +597,9 @@ namespace LTXV {
|
||||
: embedding_dim(embedding_dim), embedding_coefficient(embedding_coefficient) {
|
||||
blocks["emb.timestep_embedder"] = std::make_shared<TimestepEmbedder>(embedding_dim);
|
||||
blocks["linear"] = std::make_shared<Linear>(embedding_dim,
|
||||
embedding_coefficient * embedding_dim,
|
||||
true,
|
||||
true);
|
||||
embedding_coefficient * embedding_dim,
|
||||
true,
|
||||
true);
|
||||
}
|
||||
|
||||
std::pair<ggml_tensor*, ggml_tensor*> forward(GGMLRunnerContext* ctx,
|
||||
@@ -1257,7 +1257,7 @@ namespace LTXV {
|
||||
v_context,
|
||||
attn2.get(),
|
||||
v_table,
|
||||
cross_attention_adaln ? params["prompt_scale_shift_table"] : nullptr,
|
||||
cross_attention_adaln ? params["prompt_scale_shift_table"] : nullptr,
|
||||
v_timestep,
|
||||
v_prompt_timestep,
|
||||
v_dim,
|
||||
@@ -1275,7 +1275,7 @@ namespace LTXV {
|
||||
a_context,
|
||||
audio_attn2.get(),
|
||||
a_table,
|
||||
cross_attention_adaln ? params["audio_prompt_scale_shift_table"] : nullptr,
|
||||
cross_attention_adaln ? params["audio_prompt_scale_shift_table"] : nullptr,
|
||||
a_timestep,
|
||||
a_prompt_timestep,
|
||||
a_dim,
|
||||
|
||||
@@ -109,7 +109,7 @@ namespace MingImage {
|
||||
const int64_t n_txt = context->ne[1] + direct->ne[1];
|
||||
const int64_t n_img = ((x->ne[0] + config.patch_size - 1) / config.patch_size) *
|
||||
((x->ne[1] + config.patch_size - 1) / config.patch_size);
|
||||
auto padded = finish_rope_pe(Rope::gen_z_image_pe(
|
||||
auto padded = finish_rope_pe(Rope::gen_z_image_pe(
|
||||
static_cast<int>(x->ne[1]), static_cast<int>(x->ne[0]), config.patch_size, 1,
|
||||
static_cast<int>(n_txt), ZImage::SEQ_MULTI_OF, {}, Rope::RefIndexMode::FIXED,
|
||||
config.theta, config.axes_dim));
|
||||
|
||||
@@ -235,9 +235,9 @@ namespace MiniMaxH3 {
|
||||
blocks["norm1"] = std::make_shared<RMSNorm>(config.hidden_size, config.norm_eps);
|
||||
blocks["norm2"] = std::make_shared<RMSNorm>(config.hidden_size, config.norm_eps);
|
||||
blocks["attn"] = std::make_shared<Attention>(config.hidden_size,
|
||||
config.num_attention_heads,
|
||||
config.attention_head_dim,
|
||||
config.qk_norm_eps);
|
||||
config.num_attention_heads,
|
||||
config.attention_head_dim,
|
||||
config.qk_norm_eps);
|
||||
blocks["mlp"] = std::make_shared<MLP>(config.hidden_size, config.ffn_hidden_size);
|
||||
}
|
||||
|
||||
@@ -392,11 +392,11 @@ namespace MiniMaxH3 {
|
||||
blocks["norm1"] = std::make_shared<RMSNorm>(config.hidden_size, config.norm_eps);
|
||||
blocks["norm2"] = std::make_shared<RMSNorm>(config.hidden_size, config.norm_eps);
|
||||
blocks["attn"] = std::make_shared<Attention>(config.hidden_size,
|
||||
config.num_attention_heads,
|
||||
config.attention_head_dim,
|
||||
config.qk_norm_eps);
|
||||
config.num_attention_heads,
|
||||
config.attention_head_dim,
|
||||
config.qk_norm_eps);
|
||||
blocks["mlp"] = std::make_shared<MLP>(config.hidden_size,
|
||||
config.ffn_hidden_size);
|
||||
config.ffn_hidden_size);
|
||||
blocks["adaln_proj"] = std::make_shared<AdaLayerNormModulation>(config.time_embed_dim,
|
||||
config.hidden_size,
|
||||
6,
|
||||
@@ -483,8 +483,8 @@ namespace MiniMaxH3 {
|
||||
auto row = modulation_row(ctx->ggml_ctx, mods, config.hidden_size, 2, 1, segment.modulation_row);
|
||||
auto value = norm->forward(ctx, ggml_ext_slice(ctx->ggml_ctx, x, 1, segment.start, segment.end));
|
||||
return ggml_add(ctx->ggml_ctx,
|
||||
ggml_add(ctx->ggml_ctx, value, ggml_mul(ctx->ggml_ctx, value, row[1])),
|
||||
row[0]);
|
||||
ggml_add(ctx->ggml_ctx, value, ggml_mul(ctx->ggml_ctx, value, row[1])),
|
||||
row[0]);
|
||||
};
|
||||
return {video_out->forward(ctx, apply(video)),
|
||||
audio_out->forward(ctx, apply(audio))};
|
||||
@@ -847,10 +847,10 @@ namespace MiniMaxH3 {
|
||||
const auto& condition = condition_videos[index];
|
||||
auto axes = condition_spatial_axes(condition);
|
||||
int64_t count = condition.shape()[2] *
|
||||
static_cast<int64_t>(axes.first.size() * axes.second.size());
|
||||
bool is_first = keyframe_indices.empty() || keyframe_indices[static_cast<int64_t>(index)] == 0;
|
||||
float keyframe_t = is_first ? static_cast<float>(text_len)
|
||||
: static_cast<float>(text_len) + video_duration - FRAME_RESCALE;
|
||||
static_cast<int64_t>(axes.first.size() * axes.second.size());
|
||||
bool is_first = keyframe_indices.empty() || keyframe_indices[static_cast<int64_t>(index)] == 0;
|
||||
float keyframe_t = is_first ? static_cast<float>(text_len)
|
||||
: static_cast<float>(text_len) + video_duration - FRAME_RESCALE;
|
||||
for (int64_t t = 0; t < condition.shape()[2]; ++t) {
|
||||
for (float h : axes.first) {
|
||||
for (float w : axes.second) {
|
||||
@@ -904,9 +904,9 @@ namespace MiniMaxH3 {
|
||||
|
||||
if (block.kind != MiniMaxH3ReferenceKind::AUDIO) {
|
||||
GGML_ASSERT(ref_video != nullptr);
|
||||
auto axes = condition_spatial_axes(*ref_video);
|
||||
int64_t count = ref_video->shape()[2] *
|
||||
static_cast<int64_t>(axes.first.size() * axes.second.size());
|
||||
auto axes = condition_spatial_axes(*ref_video);
|
||||
int64_t count = ref_video->shape()[2] *
|
||||
static_cast<int64_t>(axes.first.size() * axes.second.size());
|
||||
float video_end = append_video_positions(*ref_video, cursor);
|
||||
layout.sequence_segments.push_back({row,
|
||||
row + count,
|
||||
|
||||
@@ -644,7 +644,7 @@ namespace Pid {
|
||||
|
||||
int64_t effective_down_factor = config.lq_latent_down_factor / unpatchify_factor;
|
||||
float z_to_patch_ratio = static_cast<float>(config.lq_sr_scale * effective_down_factor) /
|
||||
static_cast<float>(config.patch_size);
|
||||
static_cast<float>(config.patch_size);
|
||||
GGML_ASSERT(z_to_patch_ratio >= 1.0f);
|
||||
if (lq_latent->ne[0] != target_pW || lq_latent->ne[1] != target_pH) {
|
||||
lq_latent = ggml_interpolate(ctx->ggml_ctx,
|
||||
|
||||
@@ -224,9 +224,9 @@ namespace PixArt {
|
||||
PixArtModel(const PixArtConfig& config)
|
||||
: config(config) {
|
||||
blocks["x_embedder.proj"] = std::make_shared<Conv2d>(config.in_channels,
|
||||
config.hidden_size,
|
||||
std::pair<int, int>{static_cast<int>(config.patch_size), static_cast<int>(config.patch_size)},
|
||||
std::pair<int, int>{static_cast<int>(config.patch_size), static_cast<int>(config.patch_size)});
|
||||
config.hidden_size,
|
||||
std::pair<int, int>{static_cast<int>(config.patch_size), static_cast<int>(config.patch_size)},
|
||||
std::pair<int, int>{static_cast<int>(config.patch_size), static_cast<int>(config.patch_size)});
|
||||
blocks["t_embedder"] = std::make_shared<PixArtTimestepEmbedding>(ADALN_EMBED_DIM, config.hidden_size);
|
||||
blocks["t_block.1"] = std::make_shared<Linear>(config.hidden_size, 6 * config.hidden_size);
|
||||
blocks["y_embedder.y_proj.fc1"] = std::make_shared<Linear>(config.caption_channels, config.hidden_size);
|
||||
@@ -237,7 +237,7 @@ namespace PixArt {
|
||||
}
|
||||
blocks["final_layer.norm_final"] = std::make_shared<LayerNorm>(config.hidden_size, 1e-6f, false);
|
||||
blocks["final_layer.linear"] = std::make_shared<Linear>(config.hidden_size,
|
||||
config.patch_size * config.patch_size * config.out_channels);
|
||||
config.patch_size * config.patch_size * config.out_channels);
|
||||
}
|
||||
|
||||
ggml_tensor* forward(GGMLRunnerContext* ctx,
|
||||
|
||||
@@ -486,8 +486,8 @@ namespace Qwen {
|
||||
}
|
||||
QwenImage21PrefixCache cache;
|
||||
if (prefix_cache_enabled && !prefix_cache_disabled && extra != nullptr && extra->prefix_id != 0 && layout.prefix_length > 0) {
|
||||
cache.name = "qwen_image_2_1.prefix." + std::to_string(extra->prefix_id) +
|
||||
".circular." + std::to_string(circular_x_enabled) + std::to_string(circular_y_enabled);
|
||||
cache.name = "qwen_image_2_1.prefix." + std::to_string(extra->prefix_id) +
|
||||
".circular." + std::to_string(circular_x_enabled) + std::to_string(circular_y_enabled);
|
||||
cache.prefix_length = layout.prefix_length;
|
||||
if (prefix_cache_type != GGML_TYPE_COUNT) {
|
||||
cache.type = prefix_cache_type;
|
||||
@@ -536,7 +536,7 @@ namespace Qwen {
|
||||
auto build = [&]() {
|
||||
auto graph = new_graph_custom(QWEN_IMAGE_GRAPH_SIZE * 2);
|
||||
auto pe = ggml_new_tensor_4d(compute_ctx, GGML_TYPE_F32, 2, 2, config.head_dim / 2,
|
||||
layout.positions.size() - (cached ? layout.prefix_length : 0));
|
||||
layout.positions.size() - (cached ? layout.prefix_length : 0));
|
||||
set_backend_tensor_data(pe, pe_data.data());
|
||||
std::vector<ggml_tensor*> masks, ref_inputs;
|
||||
for (const auto& mask : mask_data) {
|
||||
@@ -549,7 +549,7 @@ namespace Qwen {
|
||||
}
|
||||
auto ctx = get_context(graph);
|
||||
auto out = model.forward(&ctx, make_input(x), make_input(*inputs.timesteps), cached ? nullptr : make_input(context),
|
||||
ref_inputs, pe, layout, masks, checked_cache);
|
||||
ref_inputs, pe, layout, masks, checked_cache);
|
||||
if (!flash_attn_used) {
|
||||
return static_cast<ggml_cgraph*>(nullptr);
|
||||
}
|
||||
|
||||
@@ -563,7 +563,7 @@ namespace SenseNovaU1 {
|
||||
blocks["language_model.model"] = std::make_shared<TextModel>(config);
|
||||
blocks["fm_modules.vision_model_mot_gen.embeddings"] = std::make_shared<VisionEmbeddings>(config);
|
||||
blocks["fm_modules.timestep_embedder"] = std::make_shared<TimestepEmbedder>(config.hidden_size,
|
||||
config.timestep_embedding_size);
|
||||
config.timestep_embedding_size);
|
||||
if (config.add_noise_scale_embedding) {
|
||||
blocks["fm_modules.noise_scale_embedder"] = std::make_shared<TimestepEmbedder>(config.hidden_size,
|
||||
config.timestep_embedding_size);
|
||||
|
||||
@@ -9,13 +9,13 @@ static bool build_anima(const sd::model_builders::Context& ctx, const TokenizerC
|
||||
const auto version = ctx.version;
|
||||
const auto& weight_manager = ctx.weight_manager;
|
||||
result.conditioner = std::make_shared<AnimaConditioner>(ctx.backends.runtime_backend(SDBackendModule::TE),
|
||||
tensor_storage_map,
|
||||
weight_manager,
|
||||
tokenizers);
|
||||
tensor_storage_map,
|
||||
weight_manager,
|
||||
tokenizers);
|
||||
result.diffusion = std::make_shared<Anima::AnimaRunner>(ctx.backends.runtime_backend(SDBackendModule::DIFFUSION),
|
||||
tensor_storage_map,
|
||||
"model.diffusion_model",
|
||||
weight_manager);
|
||||
tensor_storage_map,
|
||||
"model.diffusion_model",
|
||||
weight_manager);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -9,17 +9,17 @@ static bool build_boogu_image(const sd::model_builders::Context& ctx, const Toke
|
||||
const auto version = ctx.version;
|
||||
const auto& weight_manager = ctx.weight_manager;
|
||||
result.conditioner = std::make_shared<LLMEmbedder>(ctx.backends.runtime_backend(SDBackendModule::TE),
|
||||
tensor_storage_map,
|
||||
version,
|
||||
"",
|
||||
true,
|
||||
weight_manager,
|
||||
tokenizers);
|
||||
tensor_storage_map,
|
||||
version,
|
||||
"",
|
||||
true,
|
||||
weight_manager,
|
||||
tokenizers);
|
||||
result.diffusion = std::make_shared<Boogu::BooguImageRunner>(ctx.backends.runtime_backend(SDBackendModule::DIFFUSION),
|
||||
tensor_storage_map,
|
||||
"model.diffusion_model",
|
||||
version,
|
||||
weight_manager);
|
||||
tensor_storage_map,
|
||||
"model.diffusion_model",
|
||||
version,
|
||||
weight_manager);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -9,16 +9,16 @@ static bool build_ernie_image(const sd::model_builders::Context& ctx, const Toke
|
||||
const auto version = ctx.version;
|
||||
const auto& weight_manager = ctx.weight_manager;
|
||||
result.conditioner = std::make_shared<LLMEmbedder>(ctx.backends.runtime_backend(SDBackendModule::TE),
|
||||
tensor_storage_map,
|
||||
version,
|
||||
"",
|
||||
false,
|
||||
weight_manager,
|
||||
tokenizers);
|
||||
tensor_storage_map,
|
||||
version,
|
||||
"",
|
||||
false,
|
||||
weight_manager,
|
||||
tokenizers);
|
||||
result.diffusion = std::make_shared<ErnieImage::ErnieImageRunner>(ctx.backends.runtime_backend(SDBackendModule::DIFFUSION),
|
||||
tensor_storage_map,
|
||||
"model.diffusion_model",
|
||||
weight_manager);
|
||||
tensor_storage_map,
|
||||
"model.diffusion_model",
|
||||
weight_manager);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -10,9 +10,9 @@ static bool build_fibo2(const sd::model_builders::Context& ctx, const TokenizerC
|
||||
const auto version = ctx.version;
|
||||
const auto& weight_manager = ctx.weight_manager;
|
||||
result.conditioner = std::make_shared<Fibo2Conditioner>(ctx.backends.runtime_backend(SDBackendModule::TE),
|
||||
tensor_storage_map, weight_manager, tokenizers);
|
||||
tensor_storage_map, weight_manager, tokenizers);
|
||||
result.diffusion = std::make_shared<Fibo2::Fibo2Runner>(ctx.backends.runtime_backend(SDBackendModule::DIFFUSION),
|
||||
tensor_storage_map, "model.diffusion_model", weight_manager);
|
||||
tensor_storage_map, "model.diffusion_model", weight_manager);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -11,18 +11,18 @@ static bool build_flux2(const sd::model_builders::Context& ctx, const TokenizerC
|
||||
const auto& weight_manager = ctx.weight_manager;
|
||||
bool is_chroma = false;
|
||||
result.conditioner = std::make_shared<LLMEmbedder>(ctx.backends.runtime_backend(SDBackendModule::TE),
|
||||
tensor_storage_map,
|
||||
version,
|
||||
"",
|
||||
false,
|
||||
weight_manager,
|
||||
tokenizers);
|
||||
tensor_storage_map,
|
||||
version,
|
||||
"",
|
||||
false,
|
||||
weight_manager,
|
||||
tokenizers);
|
||||
result.diffusion = std::make_shared<Flux::FluxRunner>(ctx.backends.runtime_backend(SDBackendModule::DIFFUSION),
|
||||
tensor_storage_map,
|
||||
"model.diffusion_model",
|
||||
version,
|
||||
weight_manager,
|
||||
sd_ctx_params->model_args);
|
||||
tensor_storage_map,
|
||||
"model.diffusion_model",
|
||||
version,
|
||||
weight_manager,
|
||||
sd_ctx_params->model_args);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -9,9 +9,9 @@ static bool build_flux3(const sd::model_builders::Context& ctx, const TokenizerC
|
||||
const auto version = ctx.version;
|
||||
const auto& weight_manager = ctx.weight_manager;
|
||||
result.conditioner = std::make_shared<LLMEmbedder>(ctx.backends.runtime_backend(SDBackendModule::TE),
|
||||
tensor_storage_map, version, "", false, weight_manager, tokenizers);
|
||||
tensor_storage_map, version, "", false, weight_manager, tokenizers);
|
||||
result.diffusion = std::make_shared<Flux3::Flux3Runner>(ctx.backends.runtime_backend(SDBackendModule::DIFFUSION),
|
||||
tensor_storage_map, "model.diffusion_model", weight_manager);
|
||||
tensor_storage_map, "model.diffusion_model", weight_manager);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -9,13 +9,13 @@ static bool build_hidream_o1(const sd::model_builders::Context& ctx, const Token
|
||||
const auto version = ctx.version;
|
||||
const auto& weight_manager = ctx.weight_manager;
|
||||
result.conditioner = std::make_shared<HiDreamO1::HiDreamO1Conditioner>(ctx.backends.runtime_backend(SDBackendModule::TE),
|
||||
tensor_storage_map,
|
||||
weight_manager,
|
||||
tokenizers);
|
||||
tensor_storage_map,
|
||||
weight_manager,
|
||||
tokenizers);
|
||||
result.diffusion = std::make_shared<HiDreamO1::HiDreamO1Runner>(ctx.backends.runtime_backend(SDBackendModule::DIFFUSION),
|
||||
tensor_storage_map,
|
||||
"model",
|
||||
weight_manager);
|
||||
tensor_storage_map,
|
||||
"model",
|
||||
weight_manager);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -9,17 +9,17 @@ static bool build_hunyuan_video(const sd::model_builders::Context& ctx, const To
|
||||
const auto version = ctx.version;
|
||||
const auto& weight_manager = ctx.weight_manager;
|
||||
result.conditioner = std::make_shared<LLMEmbedder>(ctx.backends.runtime_backend(SDBackendModule::TE),
|
||||
tensor_storage_map,
|
||||
version,
|
||||
"",
|
||||
false,
|
||||
weight_manager,
|
||||
tokenizers);
|
||||
tensor_storage_map,
|
||||
version,
|
||||
"",
|
||||
false,
|
||||
weight_manager,
|
||||
tokenizers);
|
||||
result.diffusion = std::make_shared<Hunyuan::HunyuanVideoRunner>(ctx.backends.runtime_backend(SDBackendModule::DIFFUSION),
|
||||
tensor_storage_map,
|
||||
"model.diffusion_model",
|
||||
version,
|
||||
weight_manager);
|
||||
tensor_storage_map,
|
||||
"model.diffusion_model",
|
||||
version,
|
||||
weight_manager);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -9,16 +9,16 @@ static bool build_ideogram4(const sd::model_builders::Context& ctx, const Tokeni
|
||||
const auto version = ctx.version;
|
||||
const auto& weight_manager = ctx.weight_manager;
|
||||
result.conditioner = std::make_shared<LLMEmbedder>(ctx.backends.runtime_backend(SDBackendModule::TE),
|
||||
tensor_storage_map,
|
||||
version,
|
||||
"",
|
||||
false,
|
||||
weight_manager,
|
||||
tokenizers);
|
||||
tensor_storage_map,
|
||||
version,
|
||||
"",
|
||||
false,
|
||||
weight_manager,
|
||||
tokenizers);
|
||||
result.diffusion = std::make_shared<Ideogram4::Ideogram4Runner>(ctx.backends.runtime_backend(SDBackendModule::DIFFUSION),
|
||||
tensor_storage_map,
|
||||
"model.diffusion_model",
|
||||
weight_manager);
|
||||
tensor_storage_map,
|
||||
"model.diffusion_model",
|
||||
weight_manager);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -9,9 +9,9 @@ static bool build_iris(const sd::model_builders::Context& ctx, const TokenizerCo
|
||||
const auto version = ctx.version;
|
||||
const auto& weight_manager = ctx.weight_manager;
|
||||
result.conditioner = std::make_shared<LLMEmbedder>(ctx.backends.runtime_backend(SDBackendModule::TE),
|
||||
tensor_storage_map, version, "", false, weight_manager, tokenizers);
|
||||
tensor_storage_map, version, "", false, weight_manager, tokenizers);
|
||||
result.diffusion = std::make_shared<Iris::IrisRunner>(ctx.backends.runtime_backend(SDBackendModule::DIFFUSION),
|
||||
tensor_storage_map, "model.diffusion_model", weight_manager);
|
||||
tensor_storage_map, "model.diffusion_model", weight_manager);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -9,16 +9,16 @@ static bool build_krea2(const sd::model_builders::Context& ctx, const TokenizerC
|
||||
const auto version = ctx.version;
|
||||
const auto& weight_manager = ctx.weight_manager;
|
||||
result.conditioner = std::make_shared<LLMEmbedder>(ctx.backends.runtime_backend(SDBackendModule::TE),
|
||||
tensor_storage_map,
|
||||
version,
|
||||
"",
|
||||
true,
|
||||
weight_manager,
|
||||
tokenizers);
|
||||
tensor_storage_map,
|
||||
version,
|
||||
"",
|
||||
true,
|
||||
weight_manager,
|
||||
tokenizers);
|
||||
result.diffusion = std::make_shared<Krea2::Krea2Runner>(ctx.backends.runtime_backend(SDBackendModule::DIFFUSION),
|
||||
tensor_storage_map,
|
||||
"model.diffusion_model",
|
||||
weight_manager);
|
||||
tensor_storage_map,
|
||||
"model.diffusion_model",
|
||||
weight_manager);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -9,16 +9,16 @@ static bool build_lens(const sd::model_builders::Context& ctx, const TokenizerCo
|
||||
const auto version = ctx.version;
|
||||
const auto& weight_manager = ctx.weight_manager;
|
||||
result.conditioner = std::make_shared<LLMEmbedder>(ctx.backends.runtime_backend(SDBackendModule::TE),
|
||||
tensor_storage_map,
|
||||
version,
|
||||
"",
|
||||
false,
|
||||
weight_manager,
|
||||
tokenizers);
|
||||
tensor_storage_map,
|
||||
version,
|
||||
"",
|
||||
false,
|
||||
weight_manager,
|
||||
tokenizers);
|
||||
result.diffusion = std::make_shared<Lens::LensRunner>(ctx.backends.runtime_backend(SDBackendModule::DIFFUSION),
|
||||
tensor_storage_map,
|
||||
"model.diffusion_model",
|
||||
weight_manager);
|
||||
tensor_storage_map,
|
||||
"model.diffusion_model",
|
||||
weight_manager);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -23,10 +23,10 @@ static bool build_lingbot_video(const sd::model_builders::Context& ctx, const To
|
||||
weight_manager,
|
||||
tokenizers);
|
||||
result.diffusion = std::make_shared<LingBotVideo::LingBotVideoRunner>(ctx.backends.runtime_backend(SDBackendModule::DIFFUSION),
|
||||
tensor_storage_map,
|
||||
"model.diffusion_model",
|
||||
weight_manager,
|
||||
sd_ctx_params->model_args);
|
||||
tensor_storage_map,
|
||||
"model.diffusion_model",
|
||||
weight_manager,
|
||||
sd_ctx_params->model_args);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -9,17 +9,17 @@ static bool build_llada_image(const sd::model_builders::Context& ctx, const Toke
|
||||
const auto version = ctx.version;
|
||||
const auto& weight_manager = ctx.weight_manager;
|
||||
result.conditioner = std::make_shared<LLaDAImageEmbedder>(ctx.backends.runtime_backend(SDBackendModule::TE),
|
||||
tensor_storage_map,
|
||||
"text_encoders.llm",
|
||||
"queryformer",
|
||||
"text_projection",
|
||||
"sigvq",
|
||||
weight_manager,
|
||||
tokenizers);
|
||||
tensor_storage_map,
|
||||
"text_encoders.llm",
|
||||
"queryformer",
|
||||
"text_projection",
|
||||
"sigvq",
|
||||
weight_manager,
|
||||
tokenizers);
|
||||
result.diffusion = std::make_shared<LLaDAImage::LLaDAImageRunner>(ctx.backends.runtime_backend(SDBackendModule::DIFFUSION),
|
||||
tensor_storage_map,
|
||||
"model.diffusion_model",
|
||||
weight_manager);
|
||||
tensor_storage_map,
|
||||
"model.diffusion_model",
|
||||
weight_manager);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -9,18 +9,18 @@ static bool build_longcat(const sd::model_builders::Context& ctx, const Tokenize
|
||||
const auto version = ctx.version;
|
||||
const auto& weight_manager = ctx.weight_manager;
|
||||
result.conditioner = std::make_shared<LLMEmbedder>(ctx.backends.runtime_backend(SDBackendModule::TE),
|
||||
tensor_storage_map,
|
||||
version,
|
||||
"",
|
||||
true,
|
||||
weight_manager,
|
||||
tokenizers);
|
||||
tensor_storage_map,
|
||||
version,
|
||||
"",
|
||||
true,
|
||||
weight_manager,
|
||||
tokenizers);
|
||||
result.diffusion = std::make_shared<Flux::FluxRunner>(ctx.backends.runtime_backend(SDBackendModule::DIFFUSION),
|
||||
tensor_storage_map,
|
||||
"model.diffusion_model",
|
||||
version,
|
||||
weight_manager,
|
||||
sd_ctx_params->model_args);
|
||||
tensor_storage_map,
|
||||
"model.diffusion_model",
|
||||
version,
|
||||
weight_manager,
|
||||
sd_ctx_params->model_args);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -9,15 +9,15 @@ static bool build_ltxav(const sd::model_builders::Context& ctx, const TokenizerC
|
||||
const auto version = ctx.version;
|
||||
const auto& weight_manager = ctx.weight_manager;
|
||||
result.conditioner = std::make_shared<LTXAVEmbedder>(ctx.backends.runtime_backend(SDBackendModule::TE),
|
||||
tensor_storage_map,
|
||||
"text_encoders.llm",
|
||||
"text_embedding_projection",
|
||||
weight_manager,
|
||||
tokenizers);
|
||||
tensor_storage_map,
|
||||
"text_encoders.llm",
|
||||
"text_embedding_projection",
|
||||
weight_manager,
|
||||
tokenizers);
|
||||
result.diffusion = std::make_shared<LTXV::LTXAVRunner>(ctx.backends.runtime_backend(SDBackendModule::DIFFUSION),
|
||||
tensor_storage_map,
|
||||
"model.diffusion_model",
|
||||
weight_manager);
|
||||
tensor_storage_map,
|
||||
"model.diffusion_model",
|
||||
weight_manager);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -9,16 +9,16 @@ static bool build_mage_flow(const sd::model_builders::Context& ctx, const Tokeni
|
||||
const auto version = ctx.version;
|
||||
const auto& weight_manager = ctx.weight_manager;
|
||||
result.conditioner = std::make_shared<LLMEmbedder>(ctx.backends.runtime_backend(SDBackendModule::TE),
|
||||
tensor_storage_map,
|
||||
version,
|
||||
"",
|
||||
true,
|
||||
weight_manager,
|
||||
tokenizers);
|
||||
tensor_storage_map,
|
||||
version,
|
||||
"",
|
||||
true,
|
||||
weight_manager,
|
||||
tokenizers);
|
||||
result.diffusion = std::make_shared<MageFlow::MageFlowRunner>(ctx.backends.runtime_backend(SDBackendModule::DIFFUSION),
|
||||
tensor_storage_map,
|
||||
"model.diffusion_model",
|
||||
weight_manager);
|
||||
tensor_storage_map,
|
||||
"model.diffusion_model",
|
||||
weight_manager);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -9,9 +9,9 @@ static bool build_ming_image(const sd::model_builders::Context& ctx, const Token
|
||||
const auto version = ctx.version;
|
||||
const auto& weight_manager = ctx.weight_manager;
|
||||
result.conditioner = std::make_shared<MingImageEmbedder>(ctx.backends.runtime_backend(SDBackendModule::TE),
|
||||
tensor_storage_map, weight_manager, tokenizers);
|
||||
tensor_storage_map, weight_manager, tokenizers);
|
||||
result.diffusion = std::make_shared<MingImage::MingImageRunner>(ctx.backends.runtime_backend(SDBackendModule::DIFFUSION),
|
||||
tensor_storage_map, "model.diffusion_model", weight_manager);
|
||||
tensor_storage_map, "model.diffusion_model", weight_manager);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -9,16 +9,16 @@ static bool build_minimax_h3(const sd::model_builders::Context& ctx, const Token
|
||||
const auto version = ctx.version;
|
||||
const auto& weight_manager = ctx.weight_manager;
|
||||
result.conditioner = std::make_shared<LLMEmbedder>(ctx.backends.runtime_backend(SDBackendModule::TE),
|
||||
tensor_storage_map,
|
||||
version,
|
||||
"",
|
||||
true,
|
||||
weight_manager,
|
||||
tokenizers);
|
||||
tensor_storage_map,
|
||||
version,
|
||||
"",
|
||||
true,
|
||||
weight_manager,
|
||||
tokenizers);
|
||||
result.diffusion = std::make_shared<MiniMaxH3::MiniMaxH3Runner>(ctx.backends.runtime_backend(SDBackendModule::DIFFUSION),
|
||||
tensor_storage_map,
|
||||
"model.diffusion_model",
|
||||
weight_manager);
|
||||
tensor_storage_map,
|
||||
"model.diffusion_model",
|
||||
weight_manager);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -9,12 +9,12 @@ static bool build_minit2i(const sd::model_builders::Context& ctx, const Tokenize
|
||||
const auto version = ctx.version;
|
||||
const auto& weight_manager = ctx.weight_manager;
|
||||
result.conditioner = std::make_shared<MiniT2IConditioner>(ctx.backends.runtime_backend(SDBackendModule::TE),
|
||||
tensor_storage_map,
|
||||
weight_manager);
|
||||
tensor_storage_map,
|
||||
weight_manager);
|
||||
result.diffusion = std::make_shared<MiniT2I::MiniT2IRunner>(ctx.backends.runtime_backend(SDBackendModule::DIFFUSION),
|
||||
tensor_storage_map,
|
||||
"model.diffusion_model.model.net",
|
||||
weight_manager);
|
||||
tensor_storage_map,
|
||||
"model.diffusion_model.model.net",
|
||||
weight_manager);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ static bool build_moss_image(const sd::model_builders::Context& ctx,
|
||||
ctx.tensor_storage_map, ctx.version, "", false,
|
||||
ctx.weight_manager, tokenizers);
|
||||
runners.diffusion = std::make_shared<MOSSImage::MOSSImageRunner>(ctx.backends.runtime_backend(SDBackendModule::DIFFUSION),
|
||||
ctx.tensor_storage_map, "model.diffusion_model", ctx.weight_manager);
|
||||
ctx.tensor_storage_map, "model.diffusion_model", ctx.weight_manager);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -9,16 +9,16 @@ static bool build_pid(const sd::model_builders::Context& ctx, const TokenizerCon
|
||||
const auto version = ctx.version;
|
||||
const auto& weight_manager = ctx.weight_manager;
|
||||
result.conditioner = std::make_shared<LLMEmbedder>(ctx.backends.runtime_backend(SDBackendModule::TE),
|
||||
tensor_storage_map,
|
||||
version,
|
||||
"",
|
||||
false,
|
||||
weight_manager,
|
||||
tokenizers);
|
||||
tensor_storage_map,
|
||||
version,
|
||||
"",
|
||||
false,
|
||||
weight_manager,
|
||||
tokenizers);
|
||||
result.diffusion = std::make_shared<Pid::PiDRunner>(ctx.backends.runtime_backend(SDBackendModule::DIFFUSION),
|
||||
tensor_storage_map,
|
||||
"model.diffusion_model.net",
|
||||
weight_manager);
|
||||
tensor_storage_map,
|
||||
"model.diffusion_model.net",
|
||||
weight_manager);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -31,17 +31,17 @@ static bool build_pixart(const sd::model_builders::Context& ctx, const Tokenizer
|
||||
const auto version = ctx.version;
|
||||
const auto& weight_manager = ctx.weight_manager;
|
||||
result.conditioner = std::make_shared<T5CLIPEmbedder>(ctx.backends.runtime_backend(SDBackendModule::TE),
|
||||
tensor_storage_map,
|
||||
true,
|
||||
0,
|
||||
false,
|
||||
weight_manager,
|
||||
sd_ctx_params->model_args);
|
||||
tensor_storage_map,
|
||||
true,
|
||||
0,
|
||||
false,
|
||||
weight_manager,
|
||||
sd_ctx_params->model_args);
|
||||
result.diffusion = std::make_shared<PixArt::PixArtRunner>(ctx.backends.runtime_backend(SDBackendModule::DIFFUSION),
|
||||
tensor_storage_map,
|
||||
"model.diffusion_model",
|
||||
weight_manager,
|
||||
sd_ctx_params->model_args);
|
||||
tensor_storage_map,
|
||||
"model.diffusion_model",
|
||||
weight_manager,
|
||||
sd_ctx_params->model_args);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -11,12 +11,12 @@ static bool build_qwen_image(const sd::model_builders::Context& ctx, const Token
|
||||
const auto& weight_manager = ctx.weight_manager;
|
||||
bool enable_vision = version != VERSION_QWEN_IMAGE_LAYERED;
|
||||
result.conditioner = std::make_shared<LLMEmbedder>(ctx.backends.runtime_backend(SDBackendModule::TE),
|
||||
tensor_storage_map,
|
||||
version,
|
||||
"",
|
||||
enable_vision,
|
||||
weight_manager,
|
||||
tokenizers);
|
||||
tensor_storage_map,
|
||||
version,
|
||||
"",
|
||||
enable_vision,
|
||||
weight_manager,
|
||||
tokenizers);
|
||||
if (version == VERSION_QWEN_IMAGE_2_1) {
|
||||
result.diffusion = std::make_shared<Qwen::QwenImage21Runner>(ctx.backends.runtime_backend(SDBackendModule::DIFFUSION),
|
||||
tensor_storage_map,
|
||||
|
||||
@@ -34,10 +34,10 @@ static bool build_sd(const sd::model_builders::Context& ctx, const TokenizerConf
|
||||
weight_manager,
|
||||
tokenizers);
|
||||
result.diffusion = std::make_shared<UNetModelRunner>(ctx.backends.runtime_backend(SDBackendModule::DIFFUSION),
|
||||
tensor_storage_map,
|
||||
"model.diffusion_model",
|
||||
version,
|
||||
weight_manager);
|
||||
tensor_storage_map,
|
||||
"model.diffusion_model",
|
||||
version,
|
||||
weight_manager);
|
||||
return true;
|
||||
}
|
||||
static prediction_t detect_sdxl_prediction(const String2TensorStorage& weights) {
|
||||
|
||||
@@ -9,13 +9,13 @@ static bool build_sd3(const sd::model_builders::Context& ctx, const TokenizerCon
|
||||
const auto version = ctx.version;
|
||||
const auto& weight_manager = ctx.weight_manager;
|
||||
result.conditioner = std::make_shared<SD3CLIPEmbedder>(ctx.backends.runtime_backend(SDBackendModule::TE),
|
||||
tensor_storage_map,
|
||||
weight_manager,
|
||||
tokenizers);
|
||||
tensor_storage_map,
|
||||
weight_manager,
|
||||
tokenizers);
|
||||
result.diffusion = std::make_shared<MMDiTRunner>(ctx.backends.runtime_backend(SDBackendModule::DIFFUSION),
|
||||
tensor_storage_map,
|
||||
"model.diffusion_model",
|
||||
weight_manager);
|
||||
tensor_storage_map,
|
||||
"model.diffusion_model",
|
||||
weight_manager);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -10,9 +10,9 @@ static bool build_sensenova_u1(const sd::model_builders::Context& ctx, const Tok
|
||||
const auto& weight_manager = ctx.weight_manager;
|
||||
result.conditioner = std::make_shared<SenseNovaU1Conditioner>();
|
||||
result.diffusion = std::make_shared<SenseNovaU1::SenseNovaU1Runner>(ctx.backends.runtime_backend(SDBackendModule::DIFFUSION),
|
||||
tensor_storage_map,
|
||||
"",
|
||||
weight_manager);
|
||||
tensor_storage_map,
|
||||
"",
|
||||
weight_manager);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -10,16 +10,16 @@ static bool build_wan(const sd::model_builders::Context& ctx, const TokenizerCon
|
||||
const auto version = ctx.version;
|
||||
const auto& weight_manager = ctx.weight_manager;
|
||||
result.conditioner = std::make_shared<T5CLIPEmbedder>(ctx.backends.runtime_backend(SDBackendModule::TE),
|
||||
tensor_storage_map,
|
||||
true,
|
||||
0,
|
||||
true,
|
||||
weight_manager);
|
||||
tensor_storage_map,
|
||||
true,
|
||||
0,
|
||||
true,
|
||||
weight_manager);
|
||||
result.diffusion = std::make_shared<WAN::WanRunner>(ctx.backends.runtime_backend(SDBackendModule::DIFFUSION),
|
||||
tensor_storage_map,
|
||||
"model.diffusion_model",
|
||||
version,
|
||||
weight_manager);
|
||||
tensor_storage_map,
|
||||
"model.diffusion_model",
|
||||
version,
|
||||
weight_manager);
|
||||
if (strlen(SAFE_STR(sd_ctx_params->high_noise_diffusion_model_path)) > 0) {
|
||||
result.high_noise_diffusion = std::make_shared<WAN::WanRunner>(ctx.backends.runtime_backend(SDBackendModule::DIFFUSION),
|
||||
tensor_storage_map,
|
||||
|
||||
@@ -9,17 +9,17 @@ static bool build_z_image(const sd::model_builders::Context& ctx, const Tokenize
|
||||
const auto version = ctx.version;
|
||||
const auto& weight_manager = ctx.weight_manager;
|
||||
result.conditioner = std::make_shared<LLMEmbedder>(ctx.backends.runtime_backend(SDBackendModule::TE),
|
||||
tensor_storage_map,
|
||||
version,
|
||||
"",
|
||||
false,
|
||||
weight_manager,
|
||||
tokenizers);
|
||||
tensor_storage_map,
|
||||
version,
|
||||
"",
|
||||
false,
|
||||
weight_manager,
|
||||
tokenizers);
|
||||
result.diffusion = std::make_shared<ZImage::ZImageRunner>(ctx.backends.runtime_backend(SDBackendModule::DIFFUSION),
|
||||
tensor_storage_map,
|
||||
"model.diffusion_model",
|
||||
version,
|
||||
weight_manager);
|
||||
tensor_storage_map,
|
||||
"model.diffusion_model",
|
||||
version,
|
||||
weight_manager);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -9,16 +9,16 @@ static bool build_z_image_l2p(const sd::model_builders::Context& ctx, const Toke
|
||||
const auto version = ctx.version;
|
||||
const auto& weight_manager = ctx.weight_manager;
|
||||
result.conditioner = std::make_shared<LLMEmbedder>(ctx.backends.runtime_backend(SDBackendModule::TE),
|
||||
tensor_storage_map,
|
||||
version,
|
||||
"",
|
||||
false,
|
||||
weight_manager,
|
||||
tokenizers);
|
||||
tensor_storage_map,
|
||||
version,
|
||||
"",
|
||||
false,
|
||||
weight_manager,
|
||||
tokenizers);
|
||||
result.diffusion = std::make_shared<ZImageL2P::ZImageL2PRunner>(ctx.backends.runtime_backend(SDBackendModule::DIFFUSION),
|
||||
tensor_storage_map,
|
||||
"model.diffusion_model",
|
||||
weight_manager);
|
||||
tensor_storage_map,
|
||||
"model.diffusion_model",
|
||||
weight_manager);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -347,8 +347,8 @@ namespace LLaDAImageTE {
|
||||
blocks["visual.blocks." + std::to_string(i)] = std::make_shared<SigVQBlock>(config);
|
||||
}
|
||||
blocks["vqmodel.quant_conv"] = std::make_shared<Conv2d>(config.hidden_size,
|
||||
config.codebook_embed_dim,
|
||||
std::make_pair(1, 1));
|
||||
config.codebook_embed_dim,
|
||||
std::make_pair(1, 1));
|
||||
blocks["prior_projector.net.0.proj"] = std::make_shared<Linear>(config.semantic_embed_dim, config.semantic_embed_dim, true);
|
||||
blocks["prior_projector.net.2"] = std::make_shared<Linear>(config.semantic_embed_dim, config.semantic_embed_dim, true);
|
||||
}
|
||||
|
||||
@@ -1087,9 +1087,9 @@ namespace LTXV {
|
||||
|
||||
auto& tensor_storage_map = model_loader.get_tensor_storage_map();
|
||||
auto ltx_audio_vae = std::make_shared<LTXAudioVAERunner>(backend,
|
||||
tensor_storage_map,
|
||||
prefix,
|
||||
model_manager);
|
||||
tensor_storage_map,
|
||||
prefix,
|
||||
model_manager);
|
||||
|
||||
if (!model_manager->set_loader(std::move(model_loader)) ||
|
||||
!model_manager->register_runner_params(ModelComponent::AudioVAE,
|
||||
|
||||
+11
-11
@@ -497,12 +497,12 @@ namespace LTXVAE {
|
||||
GGML_ASSERT(out_channels % factor == 0);
|
||||
|
||||
blocks["conv"] = std::make_shared<CausalConv3d>(in_channels,
|
||||
out_channels / factor,
|
||||
3,
|
||||
std::tuple<int, int, int>{1, 1, 1},
|
||||
1,
|
||||
true,
|
||||
force_conv_prec_f32);
|
||||
out_channels / factor,
|
||||
3,
|
||||
std::tuple<int, int, int>{1, 1, 1},
|
||||
1,
|
||||
true,
|
||||
force_conv_prec_f32);
|
||||
blocks["skip_downsample"] = std::make_shared<WAN::AvgDown3D>(in_channels, out_channels, factor_t, factor_s);
|
||||
blocks["conv_downsample"] = std::make_shared<WAN::AvgDown3D>(out_channels / factor, out_channels, factor_t, factor_s);
|
||||
}
|
||||
@@ -1077,11 +1077,11 @@ namespace LTXVAE {
|
||||
patch_size);
|
||||
}
|
||||
blocks["decoder"] = std::make_shared<Decoder>(version,
|
||||
tensor_storage_map,
|
||||
prefix,
|
||||
patch_size,
|
||||
false,
|
||||
timestep_conditioning);
|
||||
tensor_storage_map,
|
||||
prefix,
|
||||
patch_size,
|
||||
false,
|
||||
timestep_conditioning);
|
||||
blocks["per_channel_statistics"] = std::make_shared<PerChannelStatistics>();
|
||||
}
|
||||
|
||||
|
||||
@@ -76,10 +76,10 @@ namespace MiniMaxH3 {
|
||||
blocks["block.2"] = std::make_shared<AudioEncoderResidualUnit>(in_channels, 9);
|
||||
blocks["block.3"] = std::make_shared<AudioSnake1D>(in_channels);
|
||||
blocks["block.4"] = std::make_shared<LTXV::Conv1D>(in_channels,
|
||||
out_channels,
|
||||
2 * stride,
|
||||
stride,
|
||||
static_cast<int>(std::ceil(stride / 2.f)));
|
||||
out_channels,
|
||||
2 * stride,
|
||||
stride,
|
||||
static_cast<int>(std::ceil(stride / 2.f)));
|
||||
}
|
||||
|
||||
ggml_tensor* forward(GGMLRunnerContext* ctx, ggml_tensor* x) {
|
||||
@@ -300,12 +300,12 @@ namespace MiniMaxH3 {
|
||||
}
|
||||
blocks["activation_post"] = std::make_shared<LTXV::Activation1D>(channels);
|
||||
blocks["conv_post"] = std::make_shared<LTXV::Conv1D>(channels,
|
||||
1,
|
||||
7,
|
||||
1,
|
||||
3,
|
||||
1,
|
||||
false);
|
||||
1,
|
||||
7,
|
||||
1,
|
||||
3,
|
||||
1,
|
||||
false);
|
||||
}
|
||||
|
||||
ggml_tensor* forward(GGMLRunnerContext* ctx, ggml_tensor* x) {
|
||||
|
||||
@@ -449,8 +449,8 @@ namespace MiniMaxH3VAE {
|
||||
MiniMaxH3VideoVAE() {
|
||||
blocks["encoder"] = std::make_shared<Encoder>();
|
||||
blocks["quant_conv"] = std::make_shared<Conv3d>(48,
|
||||
48,
|
||||
std::tuple{1, 1, 1});
|
||||
48,
|
||||
std::tuple{1, 1, 1});
|
||||
blocks["post_quant_conv"] = std::make_shared<Conv3d>(24,
|
||||
24,
|
||||
std::tuple{1, 1, 1});
|
||||
|
||||
Reference in new issue
Block a user