From efa381365abe8b02e640cd231cbf8e8cc2af5f74 Mon Sep 17 00:00:00 2001 From: AIExplorer Date: Tue, 25 Mar 2025 16:55:36 +0530 Subject: [PATCH] Add files via upload --- __init__.py | 3 +++ nodes.py | 36 ++++++++++++++++++++++++++++++++++++ requirements.txt | 2 ++ 3 files changed, 41 insertions(+) create mode 100644 __init__.py create mode 100644 nodes.py create mode 100644 requirements.txt diff --git a/__init__.py b/__init__.py new file mode 100644 index 0000000..2e96bd6 --- /dev/null +++ b/__init__.py @@ -0,0 +1,3 @@ +from .nodes import NODE_CLASS_MAPPINGS, NODE_DISPLAY_NAME_MAPPINGS + +__all__ = ["NODE_CLASS_MAPPINGS", "NODE_DISPLAY_NAME_MAPPINGS"] \ No newline at end of file diff --git a/nodes.py b/nodes.py new file mode 100644 index 0000000..618da48 --- /dev/null +++ b/nodes.py @@ -0,0 +1,36 @@ +import os +from huggingface_hub import hf_hub_download +import hf_transfer + + +class AutoDownloadModels: + @classmethod + def INPUT_TYPES(s): + return { + "required": { + "repo_id": ("STRING", {"tooltip": "Enter hugging face repo id"}), + "model_name": ("STRING", {"tooltip": "Enter hugging face model name to download"}), + "path_to_download": ("STRING", {"tooltip": "Enter to download the model to"}), + }, + } + RETURN_TYPES = ("STRING",) + RETURN_NAMES = ("path",) + FUNCTION = "DownloadModel" + CATEGORY = "DownloadModel" + DESCRIPTION = "This node downloads models from huggingface models" + + def DownloadModel(self, repo_id, model_name, path_to_download): + model_path = hf_hub_download(repo_id=repo_id, filename=model_name, local_dir=path_to_download) + + return model_path + + + + +NODE_CLASS_MAPPINGS = { + "AutoDownloadModels": AutoDownloadModels, + + } +NODE_DISPLAY_NAME_MAPPINGS = { + "AutoDownloadModels": "Auto Download Models", + } diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..3651e79 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,2 @@ +huggingface_hub[hf_transfer] +hf_transfer \ No newline at end of file