@@ -2076,12 +2076,41 @@ void setConvertImatrixCollector(void* collector) {
2076
2076
imatrix_collector = ((IMatrixCollector*)collector);
2077
2077
}
2078
2078
2079
- bool convert (const char * input_path , const char * vae_path, const char * output_path, sd_type_t output_type) {
2079
+ bool convert (const char * model_path, const char * clip_l_path, const char * clip_g_path, const char * t5xxl_path, const char * diffusion_model_path , const char * vae_path, const char * output_path, sd_type_t output_type) {
2080
2080
ModelLoader model_loader;
2081
2081
2082
- if (!model_loader.init_from_file (input_path)) {
2083
- LOG_ERROR (" init model loader from file failed: '%s'" , input_path);
2084
- return false ;
2082
+ if (model_path != NULL && strlen (model_path) > 0 ) {
2083
+ if (!model_loader.init_from_file (model_path)) {
2084
+ LOG_ERROR (" init model loader from file failed: '%s'" , model_path);
2085
+ return false ;
2086
+ }
2087
+ }
2088
+
2089
+ if (clip_l_path != NULL && strlen (clip_l_path) > 0 ) {
2090
+ if (!model_loader.init_from_file (clip_l_path, " text_encoders.clip_l.transformer." )) {
2091
+ LOG_ERROR (" init model loader from file failed: '%s'" , clip_l_path);
2092
+ return false ;
2093
+ }
2094
+ }
2095
+
2096
+ if (clip_g_path != NULL && strlen (clip_g_path) > 0 ) {
2097
+ if (!model_loader.init_from_file (clip_g_path, " text_encoders.clip_g.transformer." )) {
2098
+ LOG_ERROR (" init model loader from file failed: '%s'" , clip_g_path);
2099
+ return false ;
2100
+ }
2101
+ }
2102
+ if (t5xxl_path != NULL && strlen (t5xxl_path) > 0 ) {
2103
+ if (!model_loader.init_from_file (t5xxl_path, " text_encoders.t5xxl.transformer." )) {
2104
+ LOG_ERROR (" init model loader from file failed: '%s'" , t5xxl_path);
2105
+ return false ;
2106
+ }
2107
+ }
2108
+
2109
+ if (diffusion_model_path != NULL && strlen (diffusion_model_path) > 0 ) {
2110
+ if (!model_loader.init_from_file (diffusion_model_path, " model.diffusion_model." )) {
2111
+ LOG_ERROR (" init model loader from file failed: '%s'" , diffusion_model_path);
2112
+ return false ;
2113
+ }
2085
2114
}
2086
2115
2087
2116
if (vae_path != NULL && strlen (vae_path) > 0 ) {
0 commit comments