@@ -63,23 +63,24 @@ struct FrozenCLIPEmbedderWithCustomWords : public Conditioner {
63
63
PMVersion pv = PM_VERSION_1,
64
64
int clip_skip = -1 )
65
65
: version(version), pm_version(pv), tokenizer(sd_version_is_sd2(version) ? 0 : 49407 ), embd_dir(embd_dir) {
66
- if (clip_skip <= 0 ) {
67
- clip_skip = 1 ;
68
- if (sd_version_is_sd2 (version) || sd_version_is_sdxl (version)) {
69
- clip_skip = 2 ;
70
- }
71
- }
72
66
if (sd_version_is_sd1 (version)) {
73
- text_model = std::make_shared<CLIPTextModelRunner>(backend, tensor_types, " cond_stage_model.transformer.text_model" , OPENAI_CLIP_VIT_L_14, clip_skip );
67
+ text_model = std::make_shared<CLIPTextModelRunner>(backend, tensor_types, " cond_stage_model.transformer.text_model" , OPENAI_CLIP_VIT_L_14);
74
68
} else if (sd_version_is_sd2 (version)) {
75
- text_model = std::make_shared<CLIPTextModelRunner>(backend, tensor_types, " cond_stage_model.transformer.text_model" , OPEN_CLIP_VIT_H_14, clip_skip );
69
+ text_model = std::make_shared<CLIPTextModelRunner>(backend, tensor_types, " cond_stage_model.transformer.text_model" , OPEN_CLIP_VIT_H_14);
76
70
} else if (sd_version_is_sdxl (version)) {
77
- text_model = std::make_shared<CLIPTextModelRunner>(backend, tensor_types, " cond_stage_model.transformer.text_model" , OPENAI_CLIP_VIT_L_14, clip_skip, false );
78
- text_model2 = std::make_shared<CLIPTextModelRunner>(backend, tensor_types, " cond_stage_model.1.transformer.text_model" , OPEN_CLIP_VIT_BIGG_14, clip_skip, false );
71
+ text_model = std::make_shared<CLIPTextModelRunner>(backend, tensor_types, " cond_stage_model.transformer.text_model" , OPENAI_CLIP_VIT_L_14, false );
72
+ text_model2 = std::make_shared<CLIPTextModelRunner>(backend, tensor_types, " cond_stage_model.1.transformer.text_model" , OPEN_CLIP_VIT_BIGG_14, false );
79
73
}
74
+ set_clip_skip (clip_skip);
80
75
}
81
76
82
77
void set_clip_skip (int clip_skip) {
78
+ if (clip_skip <= 0 ) {
79
+ clip_skip = 1 ;
80
+ if (sd_version_is_sd2 (version) || sd_version_is_sdxl (version)) {
81
+ clip_skip = 2 ;
82
+ }
83
+ }
83
84
text_model->set_clip_skip (clip_skip);
84
85
if (sd_version_is_sdxl (version)) {
85
86
text_model2->set_clip_skip (clip_skip);
@@ -665,15 +666,16 @@ struct SD3CLIPEmbedder : public Conditioner {
665
666
std::map<std::string, enum ggml_type>& tensor_types,
666
667
int clip_skip = -1 )
667
668
: clip_g_tokenizer(0 ) {
668
- if (clip_skip <= 0 ) {
669
- clip_skip = 2 ;
670
- }
671
- clip_l = std::make_shared<CLIPTextModelRunner>(backend, tensor_types, " text_encoders.clip_l.transformer.text_model" , OPENAI_CLIP_VIT_L_14, clip_skip, false );
672
- clip_g = std::make_shared<CLIPTextModelRunner>(backend, tensor_types, " text_encoders.clip_g.transformer.text_model" , OPEN_CLIP_VIT_BIGG_14, clip_skip, false );
669
+ clip_l = std::make_shared<CLIPTextModelRunner>(backend, tensor_types, " text_encoders.clip_l.transformer.text_model" , OPENAI_CLIP_VIT_L_14, false );
670
+ clip_g = std::make_shared<CLIPTextModelRunner>(backend, tensor_types, " text_encoders.clip_g.transformer.text_model" , OPEN_CLIP_VIT_BIGG_14, false );
673
671
t5 = std::make_shared<T5Runner>(backend, tensor_types, " text_encoders.t5xxl.transformer" );
672
+ set_clip_skip (clip_skip);
674
673
}
675
674
676
675
void set_clip_skip (int clip_skip) {
676
+ if (clip_skip <= 0 ) {
677
+ clip_skip = 2 ;
678
+ }
677
679
clip_l->set_clip_skip (clip_skip);
678
680
clip_g->set_clip_skip (clip_skip);
679
681
}
@@ -1008,14 +1010,15 @@ struct FluxCLIPEmbedder : public Conditioner {
1008
1010
FluxCLIPEmbedder (ggml_backend_t backend,
1009
1011
std::map<std::string, enum ggml_type>& tensor_types,
1010
1012
int clip_skip = -1 ) {
1011
- if (clip_skip <= 0 ) {
1012
- clip_skip = 2 ;
1013
- }
1014
- clip_l = std::make_shared<CLIPTextModelRunner>(backend, tensor_types, " text_encoders.clip_l.transformer.text_model" , OPENAI_CLIP_VIT_L_14, clip_skip, true );
1013
+ clip_l = std::make_shared<CLIPTextModelRunner>(backend, tensor_types, " text_encoders.clip_l.transformer.text_model" , OPENAI_CLIP_VIT_L_14, true );
1015
1014
t5 = std::make_shared<T5Runner>(backend, tensor_types, " text_encoders.t5xxl.transformer" );
1015
+ set_clip_skip (clip_skip);
1016
1016
}
1017
1017
1018
1018
void set_clip_skip (int clip_skip) {
1019
+ if (clip_skip <= 0 ) {
1020
+ clip_skip = 2 ;
1021
+ }
1019
1022
clip_l->set_clip_skip (clip_skip);
1020
1023
}
1021
1024
@@ -1218,4 +1221,4 @@ struct FluxCLIPEmbedder : public Conditioner {
1218
1221
}
1219
1222
};
1220
1223
1221
- #endif
1224
+ #endif
0 commit comments