ComfyUI Extension: ComfyUI OneReward Node

Authored by HM-RunningHub

Created

Updated

3 stars

A custom node for ComfyUI that integrates OneReward model for high-quality image inpainting, outpainting, and object removal.

Custom Nodes (0)

    README

    ComfyUI OneReward Node

    A custom node for ComfyUI that integrates OneReward model for high-quality image inpainting, outpainting, and object removal.

    ✨ Features

    • šŸŽØ Intelligent Image Inpainting: Powered by OneReward model based on FLUX architecture
    • šŸ–¼ļø Image Restoration: Smart fill of blank areas with prompt-guided content
    • 🧽 Object Removal: Automatically remove unwanted elements from images
    • šŸ”„ CFG Support: Built-in Classifier-Free Guidance for enhanced generation quality
    • āš™ļø Memory Optimization: Quantization and CPU offload support for consumer-grade GPUs (~16GB VRAM)
    • šŸš€ Flexible Control: True CFG parameter control for fine-tuning results

    šŸ”§ Node List

    Core Nodes

    • RH_OneReward_Loader: Load and initialize OneReward models with optimization options
    • RH_OneReward_Sampler: Prompt-guided image inpainting and restoration generator
    • RH_OneReward_Eraser: Intelligent object removal tool

    šŸš€ Quick Installation

    Step 1: Install the Node

    # Navigate to ComfyUI custom_nodes directory
    cd ComfyUI/custom_nodes
    
    # Clone the repository
    git clone https://github.com/HM-RunningHub/ComfyUI_RH_OneReward
    
    # Install dependencies
    cd ComfyUI_RH_OneReward
    pip install -r requirements.txt
    

    Step 2: Download Required Models

    # Download FLUX.1-Fill-dev model (Required base model)
    huggingface-cli download black-forest-labs/FLUX.1-Fill-dev --local-dir models/black-forest-labs/FLUX.1-Fill-dev
    
    # Download OneReward models
    # Download standard OneReward model
    huggingface-cli download black-forest-labs/flux.1-fill-dev-OneReward-transformer --local-dir models/OneReward/flux.1-fill-dev-OneReward-transformer
    
    # Download dynamic OneReward model (optional)
    huggingface-cli download black-forest-labs/flux.1-fill-dev-OneRewardDynamic-transformer --local-dir models/OneReward/flux.1-fill-dev-OneRewardDynamic-transformer
    
    # Final model structure should look like:
    models/
    ā”œā”€ā”€ black-forest-labs/
    │   └── FLUX.1-Fill-dev/
    │       ā”œā”€ā”€ text_encoder/
    │       ā”œā”€ā”€ text_encoder_2/
    │       ā”œā”€ā”€ tokenizer/
    │       ā”œā”€ā”€ tokenizer_2/
    │       ā”œā”€ā”€ transformer/
    │       ā”œā”€ā”€ vae/
    │       └── scheduler/
    └── OneReward/
        ā”œā”€ā”€ flux.1-fill-dev-OneReward-transformer/
        └── flux.1-fill-dev-OneRewardDynamic-transformer/
        
    # Restart ComfyUI
    

    šŸ“– Usage

    Basic Workflow

    [RH_OneReward_Loader] → [RH_OneReward_Sampler] → [Save Image]
    

    Generation Types

    Image Inpainting

    • Load image that needs filling
    • Provide mask layer marking areas to be filled
    • Input text prompt describing the fill content
    • Generate intelligently filled images

    Image Restoration

    • Load damaged or incomplete images
    • Use mask to mark areas needing repair
    • Input prompt describing restoration content
    • Generate naturally restored images

    Object Removal

    • Use RH_OneReward_Eraser node
    • Load image containing unwanted elements
    • Provide mask marking areas to remove
    • Automatically remove and fill background

    šŸ› ļø Technical Requirements

    • GPU: 16GB+ VRAM (with quantization optimization)
    • RAM: 32GB+ recommended
    • Storage: ~30GB for all models
      • FLUX.1-Fill-dev: ~24GB
      • OneReward models: ~6GB
    • CUDA: Required for optimal performance

    āš ļø Important Notes

    • Model Paths: Models must be placed in specific directories:
      • FLUX.1-Fill-dev → models/black-forest-labs/FLUX.1-Fill-dev/
      • OneReward models → models/OneReward/
    • Low-memory GPUs automatically enable quantization and CPU offload optimization
    • All model files must be downloaded before first use
    • Supports true_cfg parameter for quality control

    šŸ“„ License

    This project is licensed under Apache 2.0 License.

    šŸ”— References

    šŸ¤ Contributing

    Contributions are welcome! Please feel free to submit issues and pull requests.

    ⭐ Citation

    If you find this project useful, please consider citing the related papers:

    @article{onereward2024,
        title={OneReward: Unified Image Inpainting and Outpainting},
        author={OneReward Team},
        year={2024},
        journal={arXiv preprint},
    }