ComfyUI  >  Nodes  >  ComfyUI Impact Pack >  HF Transformers Classifier Provider

ComfyUI Node: HF Transformers Classifier Provider

Class Name

ImpactHFTransformersClassifierProvider

Category
ImpactPack/HuggingFace
Author
Dr.Lt.Data (Account age: 458 days)
Extension
ComfyUI Impact Pack
Latest Updated
6/19/2024
Github Stars
1.4K

How to Install ComfyUI Impact Pack

Install this extension via the ComfyUI Manager by searching for  ComfyUI Impact Pack
  • 1. Click the Manager button in the main menu
  • 2. Select Custom Nodes Manager button
  • 3. Enter ComfyUI Impact Pack in the search bar
After installation, click the  Restart button to restart ComfyUI. Then, manually refresh your browser to clear the cache and access the updated list of nodes.

Visit ComfyUI Cloud for ready-to-use ComfyUI environment

  • Free trial available
  • High-speed GPU machines
  • 200+ preloaded models/nodes
  • Freedom to upload custom models/nodes
  • 50+ ready-to-run workflows
  • 100% private workspace with up to 200GB storage
  • Dedicated Support

Run ComfyUI Online

HF Transformers Classifier Provider Description

Facilitates image classification using Hugging Face Transformers models, with preset or custom model selection and device optimization.

HF Transformers Classifier Provider:

The ImpactHFTransformersClassifierProvider node is designed to facilitate image classification using pre-trained models from the Hugging Face Transformers library. This node allows you to select from a list of preset models or specify a custom model repository ID, making it highly flexible for various classification tasks. By leveraging the power of Hugging Face's extensive model repository, this node can classify images into different categories based on the chosen model. It also provides options to run the classification on different devices, such as GPU or CPU, optimizing performance based on your hardware capabilities. This node is particularly useful for AI artists who want to incorporate advanced image classification into their workflows without delving into the complexities of model training and deployment.

HF Transformers Classifier Provider Input Parameters:

preset_repo_id

This parameter allows you to select a pre-trained model from a list of preset repository IDs or specify a custom repository ID manually. The preset options include models like rizvandwiki/gender-classification-2, NTQAI/pedestrian_gender_recognition, and others. If you choose Manual repo id, you will need to provide the custom repository ID in the manual_repo_id parameter. This flexibility enables you to use a wide range of models for different classification tasks.

manual_repo_id

This parameter is used to specify a custom model repository ID when Manual repo id is selected in the preset_repo_id parameter. It accepts a string input and does not support multiline entries. This allows you to use any model available on Hugging Face's model hub by providing its repository ID directly.

device_mode

This parameter determines the device on which the classification will be performed. The available options are AUTO, Prefer GPU, and CPU. AUTO will automatically select the best available device, Prefer GPU will prioritize using a GPU if available, and CPU will force the classification to run on the CPU. This flexibility ensures that you can optimize the performance based on your hardware setup.

HF Transformers Classifier Provider Output Parameters:

TRANSFORMERS_CLASSIFIER

This output parameter provides the configured image classifier pipeline. The classifier can be used to perform image classification tasks, returning the predicted labels and their associated scores. This output is essential for integrating the classification results into your AI art projects, enabling automated categorization and analysis of images.

HF Transformers Classifier Provider Usage Tips:

  • When selecting a model from the preset_repo_id list, consider the specific classification task you need to perform. Different models are trained for different purposes, such as gender classification or pedestrian recognition.
  • If you have a custom model that is not listed in the presets, use the manual_repo_id parameter to specify its repository ID. This allows you to leverage specialized models tailored to your unique requirements.
  • For optimal performance, set the device_mode to Prefer GPU if you have a compatible GPU. This can significantly speed up the classification process compared to running on a CPU.

HF Transformers Classifier Provider Common Errors and Solutions:

Error: Model not found

  • Explanation: This error occurs when the specified model repository ID in manual_repo_id does not exist or is incorrect.
  • Solution: Double-check the repository ID for any typos and ensure that the model exists on Hugging Face's model hub. You can verify the ID by visiting the Hugging Face website.

Error: Device not available

  • Explanation: This error occurs when the selected device mode (e.g., GPU) is not available on your system.
  • Solution: Change the device_mode to AUTO or CPU to ensure compatibility with your hardware. If you intended to use a GPU, make sure that your system has a compatible GPU installed and properly configured.

Error: Invalid input type

  • Explanation: This error occurs when the input parameters do not match the expected types, such as providing a multiline string for manual_repo_id.
  • Solution: Ensure that all input parameters are provided in the correct format. For manual_repo_id, make sure it is a single-line string without any line breaks.

HF Transformers Classifier Provider Related Nodes

Go back to the extension to check out more related nodes.
ComfyUI Impact Pack
RunComfy

© Copyright 2024 RunComfy. All Rights Reserved.

RunComfy is the premier ComfyUI platform, offering ComfyUI online environment and services, along with ComfyUI workflows featuring stunning visuals.