comfyui-stylegan-dfl 1.0.1
Source contains low-bit mask syntaxtqdm progress library import
SHA-2562db8668df3f83f74caa79d64ecf2c97135dc3117c7cb41d8e6f847eeaaad4011
Evidence
1import os
2import sys
3import json
4import inspect
5import numpy as np
6import pickle
7import torch
8import torch.nn.functional as F
9from torch.utils.weak import WeakTensorKeyDictionary
10from tqdm import trange
11from safetensors import safe_open
12from PIL import Image
13from PIL.PngImagePlugin import PngInfo
14
15from .slerp import slerp
16from .str_utils import str2num, tensor2str, str2tensor
17
18from . import dnnlib
19from . import torch_utils
20# from . import legacy
21sys.modules["dnnlib"] = dnnlib
22sys.modules["torch_utils"] = torch_utils
23# sys.modules["legacy"] = legacy
24
25from .convert_to_safetensors import save_stylegan_safetensors
26
27import folder_paths
28from comfy.utils import PROGRESS_BAR_ENABLED, ProgressBar
29from comfy.model_management import get_torch_device
30
31# set the models directory
32if "stylegan" not in folder_paths.folder_names_and_paths:
33 current_paths = [os.path.join(folder_paths.models_dir, "stylegan")]
34else:
35 current_paths, _ = folder_paths.folder_names_an …
66:20… ign: a strong-ref registry would pin GPU memory for whatever
67# images happened to still be in it, fighting ComfyUI's own execution cache
68# (which is what actually decides how long a tensor needs to stay alive).
69_latent_registry = WeakTensorKeyDictionary()
70
71def _register_latent_for_images(image_tensor, latent_tensor, model_file=None):
72 _latent_registry[image_tensor] = (latent_ten …
77:15… ent_in_png(path, latent, model_file, compress_level):
78 img = Image.open(path)
79 metadata = PngInfo()
80 for k, v in img.info.items():
81 if isinstance(v, str):
82 metadata.add_text(k, …
86:52… =compress_level)
87
88def _patch_core_save_nodes():
89 import nodes as comfy_core_nodes
90 from comfy.cli_args import args as comfy_args
91
92 if getattr(comfy_core_nodes.SaveImage, "_stylegan_latent_patched", False):
93 return # already patched (e.g. module re-imported unde …
104:54… mages", [])
105 type_to_dir = {
106 "output": folder_paths.get_output_directory(),
107 "temp": folder_paths.get_temp_directory(),
108 "input": folder_paths.get_input_di …
Showing the top 5 files — 7 more files (77 regions) not shown.
No evidence locations were recorded for this file. Raw result