-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add comfyui_puild_flux support (#159)
* Add comfyui_puild_flux support * refine * refine * Add examples/bizyair_flux_pulid.json * refine * fix examples/bizyair_flux_pulid.json
- Loading branch information
Showing
11 changed files
with
1,302 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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,) |
Oops, something went wrong.