Skip to content

Commit

Permalink
Add comfyui_puild_flux support (#159)
Browse files Browse the repository at this point in the history
* Add comfyui_puild_flux support

* refine

* refine

* Add examples/bizyair_flux_pulid.json

* refine

* fix examples/bizyair_flux_pulid.json
  • Loading branch information
ccssu authored Oct 11, 2024
1 parent efa2a63 commit e4c4fb4
Show file tree
Hide file tree
Showing 11 changed files with 1,302 additions and 50 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# BizyAir

- [2024/10/11] 🌩️ BizyAir supports PuLID for Flux. [FLUX PuLID workflow](./examples/bizyair_flux_pulid.json)
- [2024/09/29] 🌩️ BizyAir has support to share your custom LoRAs. [Share Your LoRAs](http://bizyair.siliconflow.cn/model-host/sharemodel.html)
- [2024/09/19] 🌩️ BizyAir has updated the model upload feature, allowing the upload process to display a progress bar, and the size of the models uploaded is no longer restricted by ComfyUI. (https://siliconflow.github.io/BizyAir/model-host/introduce.html)
- [2024/09/06] 🌩️ BizyAir supports InstantID for SDXL now. [SDXL InstantID workflow](./examples/bizyair_sdxl_InstantID_basic.json)
Expand Down
3 changes: 2 additions & 1 deletion bizyair_example_menu.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
"FLUX-schnell Text to Image(4 steps)": "bizyair_flux_schnell_workflow.json",
"FLUX-dev Text to Image": "bizyair_flux_dev_workflow.json",
"FLUX-dev Image to Image": "bizyair_flux_img2img_workflow.json",
"FLUX Simple Lora ": "bizyair_flux_simple_lora_workflow.json"
"FLUX Simple Lora ": "bizyair_flux_simple_lora_workflow.json",
"FLUX PuLID": "bizyair_flux_pulid.json"
},
"ControlNet Union": {
"Generate an image from a line drawing": "bizyair_showcase_interior_design.json",
Expand Down
2 changes: 2 additions & 0 deletions bizyair_extras/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
from .nodes_comfyui_instantid import *
from .nodes_comfyui_pulid_flux import *
from .nodes_controlnet import *
from .nodes_flux import *
from .nodes_image_utils import *
from .nodes_ipadapter_plus.nodes_ipadapter_plus import *
from .nodes_kolors_mz import *
Expand Down
88 changes: 88 additions & 0 deletions bizyair_extras/nodes_comfyui_pulid_flux.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
from bizyair import BizyAirBaseNode, data_types
from bizyair.path_utils import path_manager as folder_paths

# PuLID Flux datatypes
PULIDFLUX = "BIZYAIR_PULIDFLUX"
EVA_CLIP = "BIZYAIR_EVA_CLIP"
FACEANALYSIS = "BIZYAIR_FACEANALYSIS"


class PulidFluxModelLoader(BizyAirBaseNode):
@classmethod
def INPUT_TYPES(s):
return {"required": {"pulid_file": (folder_paths.get_filename_list("pulid"),)}}

RETURN_TYPES = (PULIDFLUX,)
RETURN_NAMES = ("pulid_flux",)
# FUNCTION = "load_model"
CATEGORY = "pulid"
NODE_DISPLAY_NAME = "Load PuLID Flux Model"


class PulidFluxInsightFaceLoader(BizyAirBaseNode):
@classmethod
def INPUT_TYPES(s):
return {
"required": {
"provider": (
[
"CUDA",
],
),
},
}

RETURN_TYPES = (FACEANALYSIS,)
RETURN_NAMES = ("face_analysis",)
# FUNCTION = "load_insightface"
CATEGORY = "pulid"
NODE_DISPLAY_NAME = "Load InsightFace (PuLID Flux)"


class PulidFluxEvaClipLoader(BizyAirBaseNode):
@classmethod
def INPUT_TYPES(s):
return {
"required": {},
}

RETURN_TYPES = (EVA_CLIP,)
RETURN_NAMES = ("eva_clip",)
# FUNCTION = "load_eva_clip"
CATEGORY = "pulid"
NODE_DISPLAY_NAME = "Load Eva Clip (PuLID Flux)"


class ApplyPulidFlux(BizyAirBaseNode):
@classmethod
def INPUT_TYPES(s):
return {
"required": {
"model": (data_types.MODEL,),
"pulid_flux": (PULIDFLUX,),
"eva_clip": (EVA_CLIP,),
"face_analysis": (FACEANALYSIS,),
"image": ("IMAGE",),
"weight": (
"FLOAT",
{"default": 1.0, "min": -1.0, "max": 5.0, "step": 0.05},
),
"start_at": (
"FLOAT",
{"default": 0.0, "min": 0.0, "max": 1.0, "step": 0.001},
),
"end_at": (
"FLOAT",
{"default": 1.0, "min": 0.0, "max": 1.0, "step": 0.001},
),
},
"optional": {
"attn_mask": ("MASK",),
},
"hidden": {"unique_id": "UNIQUE_ID"},
}

RETURN_TYPES = (data_types.MODEL,)
# FUNCTION = "apply_pulid_flux"
CATEGORY = "pulid"
NODE_DISPLAY_NAME = "Apply PuLID Flux"
69 changes: 69 additions & 0 deletions bizyair_extras/nodes_flux.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
from bizyair import BizyAirBaseNode, data_types
from bizyair.nodes_io import BizyAirNodeIO


class CLIPTextEncodeFlux(BizyAirBaseNode):
@classmethod
def INPUT_TYPES(s):
return {
"required": {
"clip": (data_types.CLIP,),
"clip_l": ("STRING", {"multiline": True, "dynamicPrompts": True}),
"t5xxl": ("STRING", {"multiline": True, "dynamicPrompts": True}),
"guidance": (
"FLOAT",
{"default": 3.5, "min": 0.0, "max": 100.0, "step": 0.1},
),
}
}

RETURN_TYPES = (data_types.CONDITIONING,)
RETURN_NAMES = ("conditioning",)
# FUNCTION = "encode"

CATEGORY = "advanced/conditioning/flux"

# def encode(self, clip: BizyAirNodeIO, clip_l: str, t5xxl: str, guidance: float):
# new_clip = clip.copy(self.assigned_id)
# new_clip.add_node_data(
# class_type="CLIPTextEncodeFlux",
# inputs={
# "clip": clip,
# "clip_l": clip_l,
# "t5xxl": t5xxl,
# "guidance": guidance,
# },
# outputs={"slot_index": 0},
# )
# return (new_clip,)


class FluxGuidance(BizyAirBaseNode):
@classmethod
def INPUT_TYPES(s):
return {
"required": {
"conditioning": (data_types.CONDITIONING,),
"guidance": (
"FLOAT",
{"default": 3.5, "min": 0.0, "max": 100.0, "step": 0.1},
),
}
}

RETURN_TYPES = (data_types.CONDITIONING,)
FUNCTION = "append"

CATEGORY = "advanced/conditioning/flux"

def append(self, conditioning: BizyAirNodeIO, guidance):
new_conditioning = conditioning.copy(self.assigned_id)
new_conditioning.add_node_data(
class_type="FluxGuidance",
inputs={
"conditioning": conditioning,
"guidance": guidance,
},
outputs={"slot_index": 0},
)
return (new_conditioning,)
Loading

0 comments on commit e4c4fb4

Please sign in to comment.