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