@@ -552,6 +552,9 @@ def load_lora_model(self, model, lora, strength_model):
552
552
553
553
554
554
class SaveLoRA :
555
+ def __init__ (self ):
556
+ self .output_dir = folder_paths .get_output_directory ()
557
+
555
558
@classmethod
556
559
def INPUT_TYPES (s ):
557
560
return {
@@ -565,7 +568,7 @@ def INPUT_TYPES(s):
565
568
"prefix" : (
566
569
"STRING" ,
567
570
{
568
- "default" : "trained_lora " ,
571
+ "default" : "loras/ComfyUI_trained_lora " ,
569
572
"tooltip" : "The prefix to use for the saved LoRA file." ,
570
573
},
571
574
),
@@ -588,12 +591,13 @@ def INPUT_TYPES(s):
588
591
OUTPUT_NODE = True
589
592
590
593
def save (self , lora , prefix , steps = None ):
591
- date = datetime . datetime . now (). strftime ( "%Y%m%d_%H%M%S" )
594
+ full_output_folder , filename , counter , subfolder , filename_prefix = folder_paths . get_save_image_path ( prefix , self . output_dir )
592
595
if steps is None :
593
- output_file = f"models/loras/ { prefix } _{ date } _lora .safetensors"
596
+ output_checkpoint = f"{ filename } _{ counter :05 } _ .safetensors"
594
597
else :
595
- output_file = f"models/loras/{ prefix } _{ steps } _steps_{ date } _lora.safetensors"
596
- safetensors .torch .save_file (lora , output_file )
598
+ output_checkpoint = f"{ filename } _{ steps } _steps_{ counter :05} _.safetensors"
599
+ output_checkpoint = os .path .join (full_output_folder , output_checkpoint )
600
+ safetensors .torch .save_file (lora , output_checkpoint )
597
601
return {}
598
602
599
603
0 commit comments