RioShiina commited on
Commit
cef5c70
·
verified ·
1 Parent(s): d9a62bd

Upload folder using huggingface_hub

Browse files
core/pipelines/pipeline_input_processor.py CHANGED
@@ -5,7 +5,7 @@ import gradio as gr
5
  from PIL import Image, ImageChops
6
  from typing import Dict, Any, List
7
 
8
- from core.settings import INPUT_DIR
9
  from utils.app_utils import (
10
  sanitize_filename,
11
  get_lora_path,
@@ -21,6 +21,33 @@ def process_pipeline_inputs(ui_inputs: Dict[str, Any], progress: gr.Progress, wo
21
  task_type = ui_inputs['task_type']
22
  temp_files_to_clean = []
23
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
24
  lora_data = ui_inputs.get('lora_data', [])
25
  active_loras_for_gpu, active_loras_for_meta = [], []
26
  if lora_data:
@@ -270,7 +297,7 @@ def process_pipeline_inputs(ui_inputs: Dict[str, Any], progress: gr.Progress, wo
270
  active_styles.append({
271
  "image": os.path.basename(temp_path), "strength": st_strengths[i]
272
  })
273
-
274
  reference_latent_data = ui_inputs.get('reference_latent_data', [])
275
  active_reference_latents = []
276
  if reference_latent_data:
@@ -292,7 +319,7 @@ def process_pipeline_inputs(ui_inputs: Dict[str, Any], progress: gr.Progress, wo
292
  img.save(temp_path, "PNG")
293
  temp_files_to_clean.append(temp_path)
294
  active_hidream_o1_reference.append(os.path.basename(temp_path))
295
-
296
  vae_source = ui_inputs.get('vae_source')
297
  vae_id = ui_inputs.get('vae_id')
298
  vae_name_override = None
 
5
  from PIL import Image, ImageChops
6
  from typing import Dict, Any, List
7
 
8
+ from core.settings import INPUT_DIR, MULTIPLIERS_MAP
9
  from utils.app_utils import (
10
  sanitize_filename,
11
  get_lora_path,
 
21
  task_type = ui_inputs['task_type']
22
  temp_files_to_clean = []
23
 
24
+ multiplier = MULTIPLIERS_MAP.get(workflow_model_type, 8)
25
+ img_w, img_h = 0, 0
26
+ if task_type == 'txt2img':
27
+ img_w = int(ui_inputs.get('width', 0))
28
+ img_h = int(ui_inputs.get('height', 0))
29
+ elif task_type == 'img2img':
30
+ input_image_pil = ui_inputs.get('img2img_image')
31
+ if input_image_pil:
32
+ img_w, img_h = input_image_pil.width, input_image_pil.height
33
+ elif task_type == 'inpaint':
34
+ inpaint_dict = ui_inputs.get('inpaint_image_dict')
35
+ if inpaint_dict and inpaint_dict.get('background'):
36
+ img_w, img_h = inpaint_dict['background'].width, inpaint_dict['background'].height
37
+ elif task_type == 'outpaint':
38
+ input_image_pil = ui_inputs.get('outpaint_image')
39
+ if input_image_pil:
40
+ img_w, img_h = input_image_pil.width, input_image_pil.height
41
+ elif task_type == 'hires_fix':
42
+ input_image_pil = ui_inputs.get('hires_image')
43
+ if input_image_pil:
44
+ img_w, img_h = input_image_pil.width, input_image_pil.height
45
+
46
+ if img_w > 0 and img_h > 0:
47
+ if (img_w % multiplier != 0) or (img_h % multiplier != 0):
48
+ warning_msg = f"Width and height must be multiples of {multiplier} for this model."
49
+ raise gr.Error(warning_msg)
50
+
51
  lora_data = ui_inputs.get('lora_data', [])
52
  active_loras_for_gpu, active_loras_for_meta = [], []
53
  if lora_data:
 
297
  active_styles.append({
298
  "image": os.path.basename(temp_path), "strength": st_strengths[i]
299
  })
300
+
301
  reference_latent_data = ui_inputs.get('reference_latent_data', [])
302
  active_reference_latents = []
303
  if reference_latent_data:
 
319
  img.save(temp_path, "PNG")
320
  temp_files_to_clean.append(temp_path)
321
  active_hidream_o1_reference.append(os.path.basename(temp_path))
322
+
323
  vae_source = ui_inputs.get('vae_source')
324
  vae_id = ui_inputs.get('vae_id')
325
  vae_name_override = None
core/settings.py CHANGED
@@ -192,6 +192,7 @@ try:
192
  MAX_IPADAPTERS = _constants.get('MAX_IPADAPTERS', 5)
193
  LORA_SOURCE_CHOICES = _constants.get('LORA_SOURCE_CHOICES', ["Civitai", "File"])
194
  RESOLUTION_MAP = _constants.get('RESOLUTION_MAP', {})
 
195
  ARCHITECTURES_CONFIG = load_architectures_config()
196
  FEATURES_CONFIG = load_features_config()
197
  MODEL_DEFAULTS_CONFIG = load_model_defaults()
@@ -200,6 +201,7 @@ except Exception as e:
200
  MAX_LORAS, MAX_EMBEDDINGS, MAX_CONDITIONINGS, MAX_CONTROLNETS, MAX_IPADAPTERS = 5, 5, 10, 5, 5
201
  LORA_SOURCE_CHOICES = ["Civitai", "File"]
202
  RESOLUTION_MAP = {}
 
203
  ARCHITECTURES_CONFIG = {}
204
  FEATURES_CONFIG = {}
205
  MODEL_DEFAULTS_CONFIG = {}
 
192
  MAX_IPADAPTERS = _constants.get('MAX_IPADAPTERS', 5)
193
  LORA_SOURCE_CHOICES = _constants.get('LORA_SOURCE_CHOICES', ["Civitai", "File"])
194
  RESOLUTION_MAP = _constants.get('RESOLUTION_MAP', {})
195
+ MULTIPLIERS_MAP = _constants.get('MULTIPLIERS_MAP', {})
196
  ARCHITECTURES_CONFIG = load_architectures_config()
197
  FEATURES_CONFIG = load_features_config()
198
  MODEL_DEFAULTS_CONFIG = load_model_defaults()
 
201
  MAX_LORAS, MAX_EMBEDDINGS, MAX_CONDITIONINGS, MAX_CONTROLNETS, MAX_IPADAPTERS = 5, 5, 10, 5, 5
202
  LORA_SOURCE_CHOICES = ["Civitai", "File"]
203
  RESOLUTION_MAP = {}
204
+ MULTIPLIERS_MAP = {}
205
  ARCHITECTURES_CONFIG = {}
206
  FEATURES_CONFIG = {}
207
  MODEL_DEFAULTS_CONFIG = {}
requirements.txt CHANGED
@@ -1,5 +1,5 @@
1
  comfyui-frontend-package==1.45.20
2
- comfyui-workflow-templates==0.10.7
3
  comfyui-embedded-docs==0.5.6
4
  torch
5
  torchsde
@@ -22,7 +22,7 @@ alembic
22
  SQLAlchemy>=2.0.0
23
  filelock
24
  av>=16.0.0
25
- comfy-kitchen==0.2.15
26
  comfy-aimdo==0.4.10
27
  requests
28
  simpleeval>=1.0.0
 
1
  comfyui-frontend-package==1.45.20
2
+ comfyui-workflow-templates==0.11.1
3
  comfyui-embedded-docs==0.5.6
4
  torch
5
  torchsde
 
22
  SQLAlchemy>=2.0.0
23
  filelock
24
  av>=16.0.0
25
+ comfy-kitchen==0.2.16
26
  comfy-aimdo==0.4.10
27
  requests
28
  simpleeval>=1.0.0
utils/app_utils.py CHANGED
@@ -185,8 +185,8 @@ def get_lora_path(source: str, id_or_url: str, civitai_key: str, progress) -> tu
185
  file_info = get_civitai_file_info(version_id)
186
  if file_info:
187
  model_type = file_info.get('model_type')
188
- if not model_type or model_type.lower() not in ['lora', 'lycoris', 'dora']:
189
- return None, f"Invalid Civitai model type '{model_type}' for LoRA. Allowed types: LoRA, LyCORIS, DoRA."
190
 
191
  filename = sanitize_filename(f"civitai_{version_id}.safetensors")
192
  local_path = os.path.join(LORA_DIR, filename)
@@ -244,8 +244,8 @@ def get_embedding_path(source: str, id_or_url: str, civitai_key: str, progress)
244
  file_info = get_civitai_file_info(version_id)
245
  if file_info:
246
  model_type = file_info.get('model_type')
247
- if not model_type or model_type.lower() not in ['embedding', 'textualinversion']:
248
- return None, f"Invalid Civitai model type '{model_type}' for Embedding. Allowed types: Embedding."
249
 
250
  file_ext = ".safetensors"
251
  if file_info and file_info.get('name') and file_info['name'].lower().endswith(('.pt', '.bin')):
@@ -306,8 +306,8 @@ def get_vae_path(source: str, id_or_url: str, civitai_key: str, progress) -> tup
306
  file_info = get_civitai_file_info(version_id)
307
  if file_info:
308
  model_type = file_info.get('model_type')
309
- if not model_type or model_type.lower() != 'vae':
310
- return None, f"Invalid Civitai model type '{model_type}' for VAE. Allowed types: VAE."
311
 
312
  file_ext = ".safetensors"
313
  if file_info and file_info.get('name') and file_info['name'].lower().endswith(('.pt', '.bin')):
 
185
  file_info = get_civitai_file_info(version_id)
186
  if file_info:
187
  model_type = file_info.get('model_type')
188
+ if model_type and model_type.lower() == 'checkpoint':
189
+ return None, f"Invalid Civitai model type '{model_type}' for LoRA. Checkpoint models are not allowed."
190
 
191
  filename = sanitize_filename(f"civitai_{version_id}.safetensors")
192
  local_path = os.path.join(LORA_DIR, filename)
 
244
  file_info = get_civitai_file_info(version_id)
245
  if file_info:
246
  model_type = file_info.get('model_type')
247
+ if model_type and model_type.lower() == 'checkpoint':
248
+ return None, f"Invalid Civitai model type '{model_type}' for Embedding. Checkpoint models are not allowed."
249
 
250
  file_ext = ".safetensors"
251
  if file_info and file_info.get('name') and file_info['name'].lower().endswith(('.pt', '.bin')):
 
306
  file_info = get_civitai_file_info(version_id)
307
  if file_info:
308
  model_type = file_info.get('model_type')
309
+ if model_type and model_type.lower() == 'checkpoint':
310
+ return None, f"Invalid Civitai model type '{model_type}' for VAE. Checkpoint models are not allowed."
311
 
312
  file_ext = ".safetensors"
313
  if file_info and file_info.get('name') and file_info['name'].lower().endswith(('.pt', '.bin')):
yaml/constants.yaml CHANGED
@@ -222,4 +222,33 @@ RESOLUTION_MAP:
222
  "4:3 (Classic Landscape)": [683, 512]
223
  "3:4 (Classic Portrait)": [512, 683]
224
  "3:2 (Landscape)": [768, 512]
225
- "2:3 (Portrait)": [512, 768]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
222
  "4:3 (Classic Landscape)": [683, 512]
223
  "3:4 (Classic Portrait)": [512, 683]
224
  "3:2 (Landscape)": [768, 512]
225
+ "2:3 (Portrait)": [512, 768]
226
+
227
+ MULTIPLIERS_MAP:
228
+ krea-2: 1
229
+ boogu-image: 1
230
+ pixeldit: 1
231
+ ideogram-4: 1
232
+ lens: 1
233
+ flux2-kv: 1
234
+ flux2: 1
235
+ ernie-image: 1
236
+ z-image: 1
237
+ qwen-image: 1
238
+ longcat-image: 1
239
+ cosmos-predict2: 1
240
+ anima: 1
241
+ newbie-image: 1
242
+ kandinsky-5: 32
243
+ ovis-image: 1
244
+ hunyuanimage: 1
245
+ chroma1-radiance: 64
246
+ chroma1: 1
247
+ omnigen2: 1
248
+ lumina: 1
249
+ hidream-o1: 32
250
+ hidream-i1:
251
+ flux1: 1
252
+ sd35: 1
253
+ sdxl: 1
254
+ sd15: 1