Skip to content

Commit 1b56d19

Browse files
committed
Fix base rope offset for ref images
1 parent 7c8f0dc commit 1b56d19

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

rope.hpp

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ namespace Rope {
9191
return txt_ids;
9292
}
9393

94-
__STATIC_INLINE__ std::vector<std::vector<float>> gen_flux_img_ids(int h,
94+
__STATIC_INLINE__ std::vector<std::vector<float>> gen_flux_img_ids(int h,
9595
int w,
9696
int patch_size,
9797
int bs,
@@ -105,7 +105,6 @@ namespace Rope {
105105

106106
std::vector<float> row_ids = linspace<float>(h_offset, h_len - 1 + h_offset, h_len);
107107
std::vector<float> col_ids = linspace<float>(w_offset, w_len - 1 + w_offset, w_len);
108-
109108
for (int i = 0; i < h_len; ++i) {
110109
for (int j = 0; j < w_len; ++j) {
111110
img_ids[i * w_len + j][0] = index;
@@ -179,10 +178,10 @@ namespace Rope {
179178
const std::vector<ggml_tensor*>& ref_latents,
180179
bool increase_ref_index,
181180
float ref_index_scale,
182-
int base_offset = 0) {
181+
int base_offset = 0) {
183182
std::vector<std::vector<float>> ids;
184-
uint64_t curr_h_offset = base_offset;
185-
uint64_t curr_w_offset = base_offset;
183+
uint64_t curr_h_offset = 0;
184+
uint64_t curr_w_offset = 0;
186185
int index = start_index;
187186
for (ggml_tensor* ref : ref_latents) {
188187
uint64_t h_offset = 0;
@@ -201,8 +200,8 @@ namespace Rope {
201200
bs,
202201
axes_dim_num,
203202
static_cast<int>(index * ref_index_scale),
204-
h_offset,
205-
w_offset);
203+
h_offset + base_offset,
204+
w_offset + base_offset);
206205
ids = concat_ids(ids, ref_ids, bs);
207206

208207
if (increase_ref_index) {

0 commit comments

Comments
 (0)