@@ -896,7 +896,7 @@ struct SD3CLIPEmbedder : public Conditioner {
896896 }
897897
898898 if (chunk_idx == 0 ) {
899- auto it = std::find (chunk_tokens.begin (), chunk_tokens.end (), clip_l_tokenizer.EOS_TOKEN_ID );
899+ auto it = std::find (chunk_tokens.begin (), chunk_tokens.end (), clip_l_tokenizer.EOS_TOKEN_ID );
900900 max_token_idx = std::min<size_t >(std::distance (chunk_tokens.begin (), it), chunk_tokens.size () - 1 );
901901 clip_l->compute (n_threads,
902902 input_ids,
@@ -907,13 +907,6 @@ struct SD3CLIPEmbedder : public Conditioner {
907907 &pooled_l,
908908 work_ctx);
909909 }
910- } else {
911- chunk_hidden_states_l = ggml_new_tensor_2d (work_ctx, GGML_TYPE_F32, 768 , chunk_len);
912- ggml_set_f32 (chunk_hidden_states_l, 0 .f );
913- if (chunk_idx == 0 ) {
914- pooled_l = ggml_new_tensor_1d (work_ctx, GGML_TYPE_F32, 768 );
915- ggml_set_f32 (pooled_l, 0 .f );
916- }
917910 }
918911
919912 // clip_g
@@ -952,7 +945,7 @@ struct SD3CLIPEmbedder : public Conditioner {
952945 }
953946
954947 if (chunk_idx == 0 ) {
955- auto it = std::find (chunk_tokens.begin (), chunk_tokens.end (), clip_g_tokenizer.EOS_TOKEN_ID );
948+ auto it = std::find (chunk_tokens.begin (), chunk_tokens.end (), clip_g_tokenizer.EOS_TOKEN_ID );
956949 max_token_idx = std::min<size_t >(std::distance (chunk_tokens.begin (), it), chunk_tokens.size () - 1 );
957950 clip_g->compute (n_threads,
958951 input_ids,
@@ -963,13 +956,6 @@ struct SD3CLIPEmbedder : public Conditioner {
963956 &pooled_g,
964957 work_ctx);
965958 }
966- } else {
967- chunk_hidden_states_g = ggml_new_tensor_2d (work_ctx, GGML_TYPE_F32, 1280 , chunk_len);
968- ggml_set_f32 (chunk_hidden_states_g, 0 .f );
969- if (chunk_idx == 0 ) {
970- pooled_g = ggml_new_tensor_1d (work_ctx, GGML_TYPE_F32, 1280 );
971- ggml_set_f32 (pooled_g, 0 .f );
972- }
973959 }
974960
975961 // t5
@@ -1264,18 +1250,18 @@ struct FluxCLIPEmbedder : public Conditioner {
12641250 auto input_ids = vector_to_ggml_tensor_i32 (work_ctx, chunk_tokens);
12651251 size_t max_token_idx = 0 ;
12661252
1267- auto it = std::find (chunk_tokens.begin (), chunk_tokens.end (), clip_l_tokenizer.EOS_TOKEN_ID );
1268- max_token_idx = std::min<size_t >(std::distance (chunk_tokens.begin (), it), chunk_tokens.size () - 1 );
1253+ auto it = std::find (chunk_tokens.begin (), chunk_tokens.end (), clip_l_tokenizer.EOS_TOKEN_ID );
1254+ max_token_idx = std::min<size_t >(std::distance (chunk_tokens.begin (), it), chunk_tokens.size () - 1 );
1255+
1256+ clip_l->compute (n_threads,
1257+ input_ids,
1258+ 0 ,
1259+ NULL ,
1260+ max_token_idx,
1261+ true ,
1262+ &pooled,
1263+ work_ctx);
12691264
1270- clip_l->compute (n_threads,
1271- input_ids,
1272- 0 ,
1273- NULL ,
1274- max_token_idx,
1275- true ,
1276- &pooled,
1277- work_ctx);
1278- }
12791265 }
12801266
12811267 // t5
0 commit comments