oimoyu commited on
Commit
5a985c2
·
verified ·
1 Parent(s): d206a05

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +51 -40
app.py CHANGED
@@ -20,7 +20,7 @@ import spaces
20
 
21
  token = os.environ.get("HF_TOKEN")
22
 
23
- hf_hub_download(repo_id="oimoyu/model", filename="chkp1.safetensors", local_dir="models/checkpoints")
24
  hf_hub_download(repo_id="oimoyu/model", filename="lora1.safetensors", local_dir="models/loras")
25
  hf_hub_download(repo_id="oimoyu/model", filename="lora2.safetensors", local_dir="models/loras")
26
  hf_hub_download(repo_id="oimoyu/model", filename="lora3.safetensors", local_dir="models/loras")
@@ -602,7 +602,7 @@ saveimage = NODE_CLASS_MAPPINGS["SaveImage"]()
602
 
603
  checkpointloadersimple = NODE_CLASS_MAPPINGS["CheckpointLoaderSimple"]()
604
  checkpointloadersimple_4 = checkpointloadersimple.load_checkpoint(
605
- ckpt_name="chkp1.safetensors"
606
  )
607
  emptylatentimage = NODE_CLASS_MAPPINGS["EmptyLatentImage"]()
608
  clipsetlastlayer = NODE_CLASS_MAPPINGS["CLIPSetLastLayer"]()
@@ -610,39 +610,48 @@ clipsetlastlayer_14 = clipsetlastlayer.set_last_layer(
610
  stop_at_clip_layer=-2, clip=get_value_at_index(checkpointloadersimple_4, 1)
611
  )
612
 
613
- loraloader = NODE_CLASS_MAPPINGS["LoraLoader"]()
614
- loraloader_11 = loraloader.load_lora(
615
- lora_name="lora1.safetensors",
616
- strength_model=0.3,
617
- strength_clip=0.3,
618
- model=get_value_at_index(checkpointloadersimple_4, 0),
619
- clip=get_value_at_index(clipsetlastlayer_14, 0),
620
- )
621
-
622
- loraloader_12 = loraloader.load_lora(
623
- lora_name="lora2.safetensors",
624
- strength_model=0.5,
625
- strength_clip=0.5,
626
- model=get_value_at_index(loraloader_11, 0),
627
- clip=get_value_at_index(loraloader_11, 1),
628
- )
629
-
630
- loraloader_12_5 = loraloader.load_lora(
631
- lora_name="lora4.safetensors",
632
- strength_model=0.25,
633
- strength_clip=0.25,
634
- model=get_value_at_index(loraloader_12, 0),
635
- clip=get_value_at_index(loraloader_12, 1),
636
- )
637
-
638
- loraloader_13 = loraloader.load_lora(
639
- lora_name="lora3.safetensors",
640
- strength_model=0.5,
641
- strength_clip=0.5,
642
- model=get_value_at_index(loraloader_12_5, 0),
643
- clip=get_value_at_index(loraloader_12_5, 1),
644
- )
645
-
 
 
 
 
 
 
 
 
 
646
 
647
  applyfbcacheonmodel_16 = applyfbcacheonmodel.patch(
648
  object_to_patch="diffusion_model",
@@ -650,7 +659,7 @@ applyfbcacheonmodel_16 = applyfbcacheonmodel.patch(
650
  start=0.7,
651
  end=1,
652
  max_consecutive_cache_hits=-1,
653
- model=get_value_at_index(loraloader_13, 0),
654
  )
655
 
656
  wd14taggerpysssss = NODE_CLASS_MAPPINGS["WD14Tagger|pysssss"]()
@@ -665,8 +674,10 @@ model_management.load_models_gpu([
665
  ])
666
 
667
 
668
- LOADED_MODEL = get_value_at_index(loraloader_13, 0)
669
- LOADED_CLIP = get_value_at_index(loraloader_13, 1)
 
 
670
  LOADED_VAE = get_value_at_index(checkpointloadersimple_4, 2)
671
  LOADED_WAVESPEED_MODEL = get_value_at_index(applyfbcacheonmodel_16, 0)
672
 
@@ -736,7 +747,7 @@ if __name__ == "__main__":
736
 
737
  with gr.Column():
738
  # 输出图像
739
- output_image = gr.Image(label="Generated Image", show_label=False, format="JPEG")
740
 
741
  # 当点击按钮时,它将触发"generate_image"函数,该函数带有相应的输入
742
  # 并且输出是一张图像
@@ -800,7 +811,7 @@ if __name__ == "__main__":
800
 
801
  with gr.Column():
802
  # 输出图像
803
- i2i_output_image = gr.Image(label="Generated Image", show_label=False, format="JPEG")
804
 
805
  i2i_generate_btn.click(
806
  fn=infer_i2i,
 
20
 
21
  token = os.environ.get("HF_TOKEN")
22
 
23
+ hf_hub_download(repo_id="oimoyu/model", filename="chkp_test.safetensors", local_dir="models/checkpoints")
24
  hf_hub_download(repo_id="oimoyu/model", filename="lora1.safetensors", local_dir="models/loras")
25
  hf_hub_download(repo_id="oimoyu/model", filename="lora2.safetensors", local_dir="models/loras")
26
  hf_hub_download(repo_id="oimoyu/model", filename="lora3.safetensors", local_dir="models/loras")
 
602
 
603
  checkpointloadersimple = NODE_CLASS_MAPPINGS["CheckpointLoaderSimple"]()
604
  checkpointloadersimple_4 = checkpointloadersimple.load_checkpoint(
605
+ ckpt_name="chkp_test.safetensors"
606
  )
607
  emptylatentimage = NODE_CLASS_MAPPINGS["EmptyLatentImage"]()
608
  clipsetlastlayer = NODE_CLASS_MAPPINGS["CLIPSetLastLayer"]()
 
610
  stop_at_clip_layer=-2, clip=get_value_at_index(checkpointloadersimple_4, 1)
611
  )
612
 
613
+ # loraloader = NODE_CLASS_MAPPINGS["LoraLoader"]()
614
+ # loraloader_11 = loraloader.load_lora(
615
+ # lora_name="lora1.safetensors",
616
+ # strength_model=0.3,
617
+ # strength_clip=0.3,
618
+ # model=get_value_at_index(checkpointloadersimple_4, 0),
619
+ # clip=get_value_at_index(clipsetlastlayer_14, 0),
620
+ # )
621
+
622
+ # loraloader_12 = loraloader.load_lora(
623
+ # lora_name="lora2.safetensors",
624
+ # strength_model=0.5,
625
+ # strength_clip=0.5,
626
+ # model=get_value_at_index(loraloader_11, 0),
627
+ # clip=get_value_at_index(loraloader_11, 1),
628
+ # )
629
+
630
+ # loraloader_12_5 = loraloader.load_lora(
631
+ # lora_name="lora4.safetensors",
632
+ # strength_model=0.25,
633
+ # strength_clip=0.25,
634
+ # model=get_value_at_index(loraloader_12, 0),
635
+ # clip=get_value_at_index(loraloader_12, 1),
636
+ # )
637
+
638
+ # loraloader_13 = loraloader.load_lora(
639
+ # lora_name="lora3.safetensors",
640
+ # strength_model=0.5,
641
+ # strength_clip=0.5,
642
+ # model=get_value_at_index(loraloader_12_5, 0),
643
+ # clip=get_value_at_index(loraloader_12_5, 1),
644
+ # )
645
+
646
+
647
+ # applyfbcacheonmodel_16 = applyfbcacheonmodel.patch(
648
+ # object_to_patch="diffusion_model",
649
+ # residual_diff_threshold=0.2,
650
+ # start=0.7,
651
+ # end=1,
652
+ # max_consecutive_cache_hits=-1,
653
+ # model=get_value_at_index(loraloader_13, 0),
654
+ # )
655
 
656
  applyfbcacheonmodel_16 = applyfbcacheonmodel.patch(
657
  object_to_patch="diffusion_model",
 
659
  start=0.7,
660
  end=1,
661
  max_consecutive_cache_hits=-1,
662
+ model=get_value_at_index(checkpointloadersimple_4, 0),
663
  )
664
 
665
  wd14taggerpysssss = NODE_CLASS_MAPPINGS["WD14Tagger|pysssss"]()
 
674
  ])
675
 
676
 
677
+ # LOADED_MODEL = get_value_at_index(loraloader_13, 0)
678
+ # LOADED_CLIP = get_value_at_index(loraloader_13, 1)
679
+ LOADED_MODEL = get_value_at_index(checkpointloadersimple_4, 0)
680
+ LOADED_CLIP = get_value_at_index(checkpointloadersimple_4, 1)
681
  LOADED_VAE = get_value_at_index(checkpointloadersimple_4, 2)
682
  LOADED_WAVESPEED_MODEL = get_value_at_index(applyfbcacheonmodel_16, 0)
683
 
 
747
 
748
  with gr.Column():
749
  # 输出图像
750
+ output_image = gr.Image(label="Generated Image", show_label=False, format="png")
751
 
752
  # 当点击按钮时,它将触发"generate_image"函数,该函数带有相应的输入
753
  # 并且输出是一张图像
 
811
 
812
  with gr.Column():
813
  # 输出图像
814
+ i2i_output_image = gr.Image(label="Generated Image", show_label=False, format="png")
815
 
816
  i2i_generate_btn.click(
817
  fn=infer_i2i,