Skip to content

Commit

Permalink
add examples/bizyair-flux1-upscale.json
Browse files Browse the repository at this point in the history
  • Loading branch information
ccssu committed Dec 17, 2024
1 parent 89fde48 commit 6a073db
Show file tree
Hide file tree
Showing 6 changed files with 707 additions and 97 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# BizyAir

- [2024/12/17] 🌩️ BizyAir supports Flux Upscale Model. [FLUX Upscale](./examples/bizyair-flux1-upscale.json)
- [2024/11/27] 🌩️ BizyAir supports Stable Diffusion 3.5 Large ControlNet Canny, Depth, and Blur. [ControlNet Canny](./examples/bizyair_sd3_5_canny.json) [ControlNet Depth](./examples/bizyair_sd3_5_depth.json) [ControlNet Blur](./examples/bizyair_sd3_5_blur.json)
- [2024/11/22] 🌩️ BizyAir supports FLUX Fill, ControlNet and Redux modes. [canny](./examples/bizyair-flux1-tools-canny.json) [depth](./examples/bizyair-flux1-tools-depth.json) [fill](./examples/bizyair-flux-fill1-inpaint.json) [redux](./examples/bizyair-flux1-tools-redux.json)
- [2024/11/06] 🌩️ BizyAir PixelWave Flux.1-dev Text to Image node is released. [PixelWave Flux.1-dev Text to Image](./examples/bizyair_flux_pixelwave_txt2img.json)
Expand Down
6 changes: 2 additions & 4 deletions bizyair_example_menu.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,14 @@
"FLUX ControlNet Depth": "bizyair-flux1-tools-depth.json",
"FLUX Redux": "bizyair-flux1-tools-redux.json",
"FLUX Fill": "bizyair-flux-fill1-inpaint.json",
"FLUX Detail Daemon Sampler": "bizyair_flux_detail_daemon_sampler.json"
"FLUX Detail Daemon Sampler": "bizyair_flux_detail_daemon_sampler.json",
"FLUX Upscale": "bizyair-flux1-upscale.json"
},
"ControlNet Union": {
"Generate an image from a line drawing": "bizyair_showcase_interior_design.json",
"Design a submarine like a great white shark": "bizyair_showcase_shark_submarine.json",
"All types of ControlNet preprocessors": "bizyair_controlnet_preprocessor_workflow.json"
},
"SD15": {
"UltimateSDUpscale": "bizyair_ultimate_sd_upscale.json"
},
"SDXL": {
"Text to Image by BizyAir KSampler": "bizyair_showcase_ksampler_txt2img.json",
"Image to Image by BizyAir KSampler": "bizyair_showcase_ksampler_img2img.json",
Expand Down
92 changes: 1 addition & 91 deletions bizyair_extras/nodes_upscale_model.py
Original file line number Diff line number Diff line change
@@ -1,88 +1,3 @@
# import os
# import logging
# from spandrel import ModelLoader, ImageModelDescriptor
# from comfy import model_management
# import torch
# import comfy.utils
# import folder_paths

# try:
# from spandrel_extra_arches import EXTRA_REGISTRY
# from spandrel import MAIN_REGISTRY
# MAIN_REGISTRY.add(*EXTRA_REGISTRY)
# logging.info("Successfully imported spandrel_extra_arches: support for non commercial upscale models.")
# except:
# pass

# class UpscaleModelLoader:
# @classmethod
# def INPUT_TYPES(s):
# return {"required": { "model_name": (folder_paths.get_filename_list("upscale_models"), ),
# }}
# RETURN_TYPES = ("UPSCALE_MODEL",)
# FUNCTION = "load_model"

# CATEGORY = "loaders"

# def load_model(self, model_name):
# model_path = folder_paths.get_full_path("upscale_models", model_name)
# sd = comfy.utils.load_torch_file(model_path, safe_load=True)
# if "module.layers.0.residual_group.blocks.0.norm1.weight" in sd:
# sd = comfy.utils.state_dict_prefix_replace(sd, {"module.":""})
# out = ModelLoader().load_from_state_dict(sd).eval()

# if not isinstance(out, ImageModelDescriptor):
# raise Exception("Upscale model must be a single-image model.")

# return (out, )


# class ImageUpscaleWithModel:
# @classmethod
# def INPUT_TYPES(s):
# return {"required": { "upscale_model": ("UPSCALE_MODEL",),
# "image": ("IMAGE",),
# }}
# RETURN_TYPES = ("IMAGE",)
# FUNCTION = "upscale"

# CATEGORY = "image/upscaling"

# def upscale(self, upscale_model, image):
# device = model_management.get_torch_device()

# memory_required = model_management.module_size(upscale_model.model)
# memory_required += (512 * 512 * 3) * image.element_size() * max(upscale_model.scale, 1.0) * 384.0 #The 384.0 is an estimate of how much some of these models take, TODO: make it more accurate
# memory_required += image.nelement() * image.element_size()
# model_management.free_memory(memory_required, device)

# upscale_model.to(device)
# in_img = image.movedim(-1,-3).to(device)

# tile = 512
# overlap = 32

# oom = True
# while oom:
# try:
# steps = in_img.shape[0] * comfy.utils.get_tiled_scale_steps(in_img.shape[3], in_img.shape[2], tile_x=tile, tile_y=tile, overlap=overlap)
# pbar = comfy.utils.ProgressBar(steps)
# s = comfy.utils.tiled_scale(in_img, lambda a: upscale_model(a), tile_x=tile, tile_y=tile, overlap=overlap, upscale_amount=upscale_model.scale, pbar=pbar)
# oom = False
# except model_management.OOM_EXCEPTION as e:
# tile //= 2
# if tile < 128:
# raise e

# upscale_model.to("cpu")
# s = torch.clamp(s.movedim(-3,-1), min=0, max=1.0)
# return (s,)

# NODE_CLASS_MAPPINGS = {
# "UpscaleModelLoader": UpscaleModelLoader,
# "ImageUpscaleWithModel": ImageUpscaleWithModel
# }

import bizyair.path_utils as folder_paths
from bizyair import BizyAirBaseNode, BizyAirNodeIO
from bizyair.data_types import UPSCALE_MODEL
Expand All @@ -98,14 +13,9 @@ def INPUT_TYPES(s):
}

RETURN_TYPES = (UPSCALE_MODEL,)
FUNCTION = "load_model"
# FUNCTION = "load_model"
CATEGORY = "loaders"

def load_model(self, **kwargs):
model = BizyAirNodeIO(self.assigned_id)
model.add_node_data(class_type="UpscaleModelLoader", inputs=kwargs)
return (model,)


class ImageUpscaleWithModel(BizyAirBaseNode):
@classmethod
Expand Down
Loading

0 comments on commit 6a073db

Please sign in to comment.