Hugging Face Download🤗:
The IF_HFDownloadNode, also known as the "Hugging Face Download🤗" node, is designed to facilitate the seamless downloading of resources from Hugging Face repositories. This node is particularly beneficial for AI artists and developers who need to access models, datasets, or other resources hosted on Hugging Face. By leveraging this node, you can automate the process of fetching files from various types of repositories, such as models, spaces, and collections, directly into your local environment. The node is equipped to handle authentication via Hugging Face tokens, ensuring secure access to private resources. Its primary goal is to streamline the integration of Hugging Face assets into your projects, saving you time and effort by managing the complexities of file downloads and directory management.
Hugging Face Download🤗 Input Parameters:
repo_id
The repo_id parameter specifies the unique identifier of the Hugging Face repository from which you wish to download resources. This identifier is crucial as it directs the node to the correct repository, ensuring that the desired files are fetched. The repo_id should be a string, and it typically follows the format of username/repository_name. There is no explicit minimum or maximum value, but it must be a valid repository identifier on Hugging Face.
resource_type
The resource_type parameter defines the type of resource you are downloading from Hugging Face. It can be one of three options: "model", "space", or "collection". This parameter helps the node determine the appropriate method for accessing and downloading the files. The default value is "model", which is suitable for most use cases involving AI models.
file_paths
The file_paths parameter allows you to specify a comma-separated list of file paths within the repository that you wish to download. This parameter is useful when you only need specific files rather than the entire repository. If left empty, the node will attempt to download all files, depending on the mode setting. The default value is an empty string, indicating no specific files are targeted.
folder_path
The folder_path parameter determines the local directory where the downloaded files will be stored. You can specify a custom path to organize your downloads according to your project structure. If not provided, the node uses a default path within the "models" directory of your ComfyUI setup. The default value is "/path/to/download/folder".
comfy_paths
The comfy_paths parameter offers predefined paths within your ComfyUI environment where the files can be downloaded. It provides a convenient way to manage file locations without manually specifying paths. The options include "none" and other paths defined in your environment. The default value is "none", which means no specific path is selected.
exclude_files
The exclude_files parameter allows you to list files that should be excluded from the download process. This is useful when you want to avoid downloading certain files that are not needed for your current task. The parameter accepts a comma-separated list of file names. The default value is an empty string, indicating no files are excluded.
mode
The mode parameter is a boolean that determines whether to download all files from the repository or only the specified ones. When set to true, the node downloads all files, while false limits the download to the files listed in file_paths. The default value is false, labeled as "Individual Files".
provided_token
The provided_token parameter is an optional string that allows you to supply a Hugging Face authentication token directly. This token is necessary for accessing private repositories or when your environment does not have the token set as an environment variable. There is no default value, and it must be provided if required for authentication.
Hugging Face Download🤗 Output Parameters:
STRING
The output parameter is a string that provides a summary of the download operation. It includes details such as the files downloaded, the source repository, and the local directory where the files were saved. This output is essential for verifying the success of the download process and for logging purposes.
Hugging Face Download🤗 Usage Tips:
- Ensure that your Hugging Face token is correctly set in your environment or provided directly to the node to avoid authentication issues.
- Use the
exclude_filesparameter to prevent unnecessary files from being downloaded, saving time and storage space. - When downloading from a large repository, consider using the
modeparameter to limit downloads to specific files, reducing the load on your network and system.
Hugging Face Download🤗 Common Errors and Solutions:
HF_TOKEN not found. Please set it in your .env file, as an environment variable, or provide it in the node input.
- Explanation: This error occurs when the node cannot find a valid Hugging Face token for authentication.
- Solution: Ensure that your Hugging Face token is set as an environment variable (
HF_TOKEN,HF_API_KEY, orHUGGINGFACE_API_KEY) or provide it directly in theprovided_tokeninput parameter.
Error downloading <file_path>: <error_message>
- Explanation: This error indicates that a specific file could not be downloaded due to an issue such as network problems or incorrect file paths.
- Solution: Verify the file paths in the
file_pathsparameter and ensure your network connection is stable. Check if the file exists in the repository and that you have the necessary permissions to access it.
