@@ -166,19 +166,29 @@ def INPUT_TYPES(cls):
166
166
def get_float (self , float ):
167
167
return (float ,)
168
168
169
+ class CheckpointLoaderWithName :
170
+ RETURN_TYPES = ("MODEL" , "CLIP" , "VAE" , "STRING" ,)
171
+ RETURN_NAMES = ("MODEL" , "CLIP" , "VAE" , "modelname" )
172
+ FUNCTION = "load_checkpoint"
169
173
170
- class CheckpointSelector :
171
- CATEGORY = 'ImageSaver/utils'
172
- RETURN_TYPES = (folder_paths .get_filename_list ("checkpoints" ),)
173
- RETURN_NAMES = ("ckpt_name" ,)
174
- FUNCTION = "get_names"
174
+ CATEGORY = "ImageSaver/utils"
175
175
176
176
@classmethod
177
177
def INPUT_TYPES (cls ):
178
178
return {"required" : {"ckpt_name" : (folder_paths .get_filename_list ("checkpoints" ), ),}}
179
179
180
- def get_names (self , ckpt_name ):
181
- return (ckpt_name ,)
180
+ def load_checkpoint (self , ckpt_name , output_vae = True , output_clip = True ):
181
+ ckpt_path = folder_paths .get_full_path ("checkpoints" , ckpt_name )
182
+ ckpt_filename = self .get_ckpt_name_string (ckpt_name )
183
+ out = comfy .sd .load_checkpoint_guess_config (ckpt_path , output_vae = True , output_clip = True , embedding_directory = folder_paths .get_folder_paths ("embeddings" ))
184
+
185
+ # add checkpoint filename to the output tuple (without the ClipVisionModel)
186
+ out = (* out [:3 ], ckpt_filename )
187
+ return out
188
+
189
+ def get_ckpt_name_string (self , ckpt_name ):
190
+ filename = os .path .basename (ckpt_name )
191
+ return filename
182
192
183
193
184
194
class SamplerSelector :
@@ -258,7 +268,7 @@ def INPUT_TYPES(cls):
258
268
"extension" : (['png' , 'jpeg' , 'webp' ],),
259
269
"steps" : ("INT" , {"default" : 20 , "min" : 1 , "max" : 10000 }),
260
270
"cfg" : ("FLOAT" , {"default" : 8.0 , "min" : 0.0 , "max" : 100.0 }),
261
- "modelname" : (folder_paths . get_filename_list ( "checkpoints" ), ),
271
+ "modelname" : ("STRING" , { "default" : '' , "multiline" : False } ),
262
272
"sampler_name" : (comfy .samplers .KSampler .SAMPLERS ,),
263
273
"scheduler" : (comfy .samplers .KSampler .SCHEDULERS ,),
264
274
},
@@ -400,7 +410,7 @@ def save_images(self, images, output_path, filename_prefix, comment, extension,
400
410
401
411
402
412
NODE_CLASS_MAPPINGS = {
403
- "Checkpoint Selector (Image Saver)" : CheckpointSelector ,
413
+ "Checkpoint Loader with Name (Image Saver)" : CheckpointLoaderWithName ,
404
414
"Image Saver" : ImageSaver ,
405
415
"Sampler Selector (Image Saver)" : SamplerSelector ,
406
416
"Scheduler Selector (Image Saver)" : SchedulerSelector ,
0 commit comments