ComfyUI-FluxTrainer
Run ComfyUI Easily with InstaSD
Skip the complex setup. InstaSD helps creative professionals build workflows and deploy them to the world:
- One-click deployment
- Any model, any node
- Powerful GPUs for rapid iteration
Available Nodes
UploadToHuggingFace
UploadToHuggingFace Node Documentation
Overview
The UploadToHuggingFace node allows users to upload models or datasets from their local training environment to the Hugging Face Hub. This node is part of the ComfyUI-FluxTrainer extension, which integrates with Hugging Face, a popular platform for sharing and collaborating on machine learning models.
Functionality
-
Upload to Hub: The primary purpose of this node is to facilitate the upload of models or datasets to the Hugging Face Hub, allowing for easy sharing and access.
-
Metadata Handling: The node saves metadata associated with the trained model, enhancing the information available about the model on the Hugging Face Hub.
-
Repository Management: It checks for the existence of a repository on Hugging Face and creates one if it doesn't exist, ensuring a seamless upload process.
Input Parameters
-
Network Trainer: This is the trainer object for the model that contains the metadata to be saved on Hugging Face. It is crucial to ensure that the trainer has all the necessary information before performing the upload.
-
Source Path: The path to the model or dataset file that will be uploaded. The path can refer to a file or directory, providing flexibility for what you wish to upload.
-
Repo ID: The identifier for the repository on Hugging Face where the model or dataset will be uploaded. This is necessary for directing the upload to the correct location on Hugging Face.
-
Revision: The specific revision of the repository to target for the upload. This allows for precise version control on Hugging Face.
-
Private: A boolean option that, if set to true, keeps the repository private upon creation. This ensures that sensitive or unfinished work is not publicly visible until you choose to make it so.
-
Token: An optional parameter where you can input your Hugging Face token. If not provided, the node will attempt to use a locally stored token from
hf_token.json.
Output
-
Network Trainer: This output provides the updated network trainer object. It remains unchanged other than possibly having additional metadata.
-
Status: A status message indicating whether the upload was successful or if there were any issues.
Usage in ComfyUI Workflows
In typical ComfyUI workflows, data scientists or engineers could connect this node to the end of a training pipeline where they wish to automatically upload the results of their training to Hugging Face. For example, once a model is trained and validated, it can be uploaded immediately, sharing the model with peers or the broader community.
Special Features and Considerations
-
Token Management: While you can input your token directly into the node, for security reasons, it's better to manage tokens through a local file (
hf_token.json). This prevents accidental exposure of sensitive credentials in workflows or logs. -
Automatic Repository Creation: If the specified repository does not exist on Hugging Face, the node will attempt to create it. This simplifies the process, reducing the need for manual setup steps on Hugging Face before using the node.
-
Metadata Handling: The node saves metadata about the model or dataset being uploaded, which can be incredibly useful for version tracking and providing context on the Hugging Face platform.
Keeping these considerations in mind will help users effectively employ the UploadToHuggingFace node in their comprehensive machine learning workflows within ComfyUI.