fix the processing of vace_context

This commit is contained in:
leejet 2025-09-12 00:32:16 +08:00
parent 64c5d8ea8f
commit e751ae6d6f
3 changed files with 17 additions and 4 deletions

2
ggml

@ -1 +1 @@
Subproject commit c46da318b9b6730806196ef7fff67c8160a74c8e Subproject commit 5fdc78fff274094e2a1b155928131983362d8a71

View File

@ -255,6 +255,21 @@ __STATIC_INLINE__ void ggml_tensor_iter(
} }
} }
__STATIC_INLINE__ void ggml_tensor_diff(
ggml_tensor* a,
ggml_tensor* b,
float gap = 0.1f) {
GGML_ASSERT(ggml_nelements(a) == ggml_nelements(b));
ggml_tensor_iter(a, [&] (ggml_tensor* a, int64_t i0, int64_t i1, int64_t i2, int64_t i3) {
float a_value = ggml_tensor_get_f32(a, i0, i1, i2, i3);
float b_value = ggml_tensor_get_f32(b, i0, i1, i2, i3);
if (abs(a_value - b_value) > gap) {
LOG_WARN("[%ld, %ld, %ld, %ld] %f %f", i3, i2, i1, i0, a_value, b_value);
}
});
}
__STATIC_INLINE__ ggml_tensor* load_tensor_from_file(ggml_context* ctx, const std::string& file_path) { __STATIC_INLINE__ ggml_tensor* load_tensor_from_file(ggml_context* ctx, const std::string& file_path) {
std::ifstream file(file_path, std::ios::binary); std::ifstream file(file_path, std::ios::binary);
if (!file.is_open()) { if (!file.is_open()) {

View File

@ -2579,7 +2579,7 @@ SD_API sd_image_t* generate_video(sd_ctx_t* sd_ctx, const sd_vid_gen_params_t* s
if (i3 < 16) { if (i3 < 16) {
value = ggml_tensor_get_f32(inactive, i0, i1, i2 - ref_image_num, i3); value = ggml_tensor_get_f32(inactive, i0, i1, i2 - ref_image_num, i3);
} else { } else {
value = ggml_tensor_get_f32(reactive, i0, i1, i2 - ref_image_num, i3); value = ggml_tensor_get_f32(reactive, i0, i1, i2 - ref_image_num, i3 - 16);
} }
} }
} else { // mask } else { // mask
@ -2598,8 +2598,6 @@ SD_API sd_image_t* generate_video(sd_ctx_t* sd_ctx, const sd_vid_gen_params_t* s
LOG_INFO("encode_first_stage completed, taking %" PRId64 " ms", t2 - t1); LOG_INFO("encode_first_stage completed, taking %" PRId64 " ms", t2 - t1);
} }
print_ggml_tensor(vace_context);
if (init_latent == NULL) { if (init_latent == NULL) {
init_latent = generate_init_latent(sd_ctx, work_ctx, width, height, frames, true); init_latent = generate_init_latent(sd_ctx, work_ctx, width, height, frames, true);
} }