Upload Salia_Save_Checkpoint_And_Upload.py
Browse files
Salia_Save_Checkpoint_And_Upload.py
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
"""
|
| 2 |
|
| 3 |
INSTALL
|
| 4 |
Put this file directly in ComfyUI/custom_nodes/ and restart ComfyUI.
|
|
@@ -18,9 +18,20 @@ NODES
|
|
| 18 |
Civitai base-model label yourself. Auto cannot identify SDXL derivatives.
|
| 19 |
Add examples, review metadata/license, and publish through Civitai's UI.
|
| 20 |
|
| 21 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
the merged model/CLIP, VAE, tensor dtypes and core metadata follow core Save
|
| 23 |
-
Checkpoint behavior.
|
|
|
|
|
|
|
|
|
|
| 24 |
before core converts them to checkpoint keys, avoiding its dynamic-VRAM
|
| 25 |
FakeDevice allocation error. This uses additional system RAM for CLIP weights;
|
| 26 |
the UNet still follows core's normal export path. No core files are modified.
|
|
@@ -810,12 +821,72 @@ class Salia_Save_Checkpoint_And_Upload_civitai(_CheckpointUploadNode):
|
|
| 810 |
return _status(path, receipt["url"], detail)
|
| 811 |
|
| 812 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 813 |
NODE_CLASS_MAPPINGS = {
|
| 814 |
"Salia_Save_Checkpoint_And_Upload_HF": Salia_Save_Checkpoint_And_Upload_HF,
|
| 815 |
"Salia_Save_Checkpoint_And_Upload_civitai": Salia_Save_Checkpoint_And_Upload_civitai,
|
|
|
|
|
|
|
| 816 |
}
|
| 817 |
|
| 818 |
NODE_DISPLAY_NAME_MAPPINGS = {
|
| 819 |
"Salia_Save_Checkpoint_And_Upload_HF": "Salia_Save_Checkpoint_And_Upload_HF",
|
| 820 |
"Salia_Save_Checkpoint_And_Upload_civitai": "Salia_Save_Checkpoint_And_Upload_civitai",
|
|
|
|
|
|
|
| 821 |
}
|
|
|
|
| 1 |
+
"""Four ComfyUI output nodes: export a checkpoint or model, then upload it.
|
| 2 |
|
| 3 |
INSTALL
|
| 4 |
Put this file directly in ComfyUI/custom_nodes/ and restart ComfyUI.
|
|
|
|
| 18 |
Civitai base-model label yourself. Auto cannot identify SDXL derivatives.
|
| 19 |
Add examples, review metadata/license, and publish through Civitai's UI.
|
| 20 |
|
| 21 |
+
Salia_Save_Model_And_Upload_HF
|
| 22 |
+
MODEL + filename_prefix + HF_Key. No CLIP or VAE inputs or weights.
|
| 23 |
+
Uploads the numbered .safetensors to the ROOT of saliacoel/x, branch main.
|
| 24 |
+
|
| 25 |
+
Salia_Save_Model_And_Upload_civitai
|
| 26 |
+
MODEL + filename_prefix + CivitAI_Key. No CLIP or VAE inputs or weights.
|
| 27 |
+
Uses the same Civitai draft/existing-version options as the checkpoint node.
|
| 28 |
+
|
| 29 |
+
All call the installed ComfyUI core checkpoint exporter. Numbered filenames,
|
| 30 |
the merged model/CLIP, VAE, tensor dtypes and core metadata follow core Save
|
| 31 |
+
Checkpoint behavior. Model-only nodes pass no text encoder or VAE to the
|
| 32 |
+
exporter, so their files contain only the model weights and core metadata.
|
| 33 |
+
Their default local destination is output/diffusion_models/ComfyUI_00001_.safetensors.
|
| 34 |
+
ComfyUI's deferred CLIP weights are materialized on CPU
|
| 35 |
before core converts them to checkpoint keys, avoiding its dynamic-VRAM
|
| 36 |
FakeDevice allocation error. This uses additional system RAM for CLIP weights;
|
| 37 |
the UNet still follows core's normal export path. No core files are modified.
|
|
|
|
| 821 |
return _status(path, receipt["url"], detail)
|
| 822 |
|
| 823 |
|
| 824 |
+
def _model_only_inputs(inputs):
|
| 825 |
+
"""Keep each uploader's options while exposing only the MODEL component."""
|
| 826 |
+
required = inputs["required"]
|
| 827 |
+
required.pop("clip", None)
|
| 828 |
+
required.pop("vae", None)
|
| 829 |
+
required["filename_prefix"] = ("STRING", {"default": "diffusion_models/ComfyUI"})
|
| 830 |
+
return inputs
|
| 831 |
+
|
| 832 |
+
|
| 833 |
+
class Salia_Save_Model_And_Upload_HF(Salia_Save_Checkpoint_And_Upload_HF):
|
| 834 |
+
DESCRIPTION = (
|
| 835 |
+
"Save only the diffusion model to .safetensors, then upload to saliacoel/x "
|
| 836 |
+
"on Hugging Face. The exported file contains no CLIP or VAE weights."
|
| 837 |
+
)
|
| 838 |
+
|
| 839 |
+
@classmethod
|
| 840 |
+
def INPUT_TYPES(cls):
|
| 841 |
+
return _model_only_inputs(super().INPUT_TYPES())
|
| 842 |
+
|
| 843 |
+
def save(self, model, filename_prefix, HF_Key="", prompt=None, extra_pnginfo=None):
|
| 844 |
+
# Core accepts absent components and exports the connected MODEL only.
|
| 845 |
+
return super().save(
|
| 846 |
+
model=model, clip=None, vae=None, filename_prefix=filename_prefix,
|
| 847 |
+
HF_Key=HF_Key, prompt=prompt, extra_pnginfo=extra_pnginfo,
|
| 848 |
+
)
|
| 849 |
+
|
| 850 |
+
|
| 851 |
+
class Salia_Save_Model_And_Upload_civitai(Salia_Save_Checkpoint_And_Upload_civitai):
|
| 852 |
+
DESCRIPTION = (
|
| 853 |
+
"Save only the diffusion model to .safetensors and upload to a Civitai draft "
|
| 854 |
+
"or an existing version. The exported file contains no CLIP or VAE weights. "
|
| 855 |
+
"New drafts are uploaded but not automatically published."
|
| 856 |
+
)
|
| 857 |
+
|
| 858 |
+
@classmethod
|
| 859 |
+
def INPUT_TYPES(cls):
|
| 860 |
+
inputs = _model_only_inputs(super().INPUT_TYPES())
|
| 861 |
+
inputs["optional"]["Civitai_Model_Name"][1]["tooltip"] = (
|
| 862 |
+
"New draft name. Empty uses the model filename. Ignored for an existing version."
|
| 863 |
+
)
|
| 864 |
+
return inputs
|
| 865 |
+
|
| 866 |
+
def save(
|
| 867 |
+
self, model, filename_prefix, CivitAI_Key="",
|
| 868 |
+
Civitai_Model_Version_ID=0, Civitai_Base_Model="Auto", Civitai_Model_Name="",
|
| 869 |
+
prompt=None, extra_pnginfo=None,
|
| 870 |
+
):
|
| 871 |
+
return super().save(
|
| 872 |
+
model=model, clip=None, vae=None, filename_prefix=filename_prefix,
|
| 873 |
+
CivitAI_Key=CivitAI_Key,
|
| 874 |
+
Civitai_Model_Version_ID=Civitai_Model_Version_ID,
|
| 875 |
+
Civitai_Base_Model=Civitai_Base_Model, Civitai_Model_Name=Civitai_Model_Name,
|
| 876 |
+
prompt=prompt, extra_pnginfo=extra_pnginfo,
|
| 877 |
+
)
|
| 878 |
+
|
| 879 |
+
|
| 880 |
NODE_CLASS_MAPPINGS = {
|
| 881 |
"Salia_Save_Checkpoint_And_Upload_HF": Salia_Save_Checkpoint_And_Upload_HF,
|
| 882 |
"Salia_Save_Checkpoint_And_Upload_civitai": Salia_Save_Checkpoint_And_Upload_civitai,
|
| 883 |
+
"Salia_Save_Model_And_Upload_HF": Salia_Save_Model_And_Upload_HF,
|
| 884 |
+
"Salia_Save_Model_And_Upload_civitai": Salia_Save_Model_And_Upload_civitai,
|
| 885 |
}
|
| 886 |
|
| 887 |
NODE_DISPLAY_NAME_MAPPINGS = {
|
| 888 |
"Salia_Save_Checkpoint_And_Upload_HF": "Salia_Save_Checkpoint_And_Upload_HF",
|
| 889 |
"Salia_Save_Checkpoint_And_Upload_civitai": "Salia_Save_Checkpoint_And_Upload_civitai",
|
| 890 |
+
"Salia_Save_Model_And_Upload_HF": "Salia_Save_Model_And_Upload_HF",
|
| 891 |
+
"Salia_Save_Model_And_Upload_civitai": "Salia_Save_Model_And_Upload_civitai",
|
| 892 |
}
|