RioShiina commited on
Commit
b9a570e
·
verified ·
1 Parent(s): add7fe2

Fix PiD Injector.

Browse files
chain_injectors/pid_injector.py CHANGED
@@ -121,8 +121,13 @@ def inject(assembler, chain_definition, chain_items):
121
  if active_model_file:
122
  try:
123
  model_config = load_model_config()
124
- checkpoints = model_config.get("Checkpoints", {})
 
 
 
125
  for arch_name, arch_data in checkpoints.items():
 
 
126
  models_list = arch_data.get("models", [])
127
  for model_entry in models_list:
128
  if model_entry.get('path') == active_model_file:
@@ -138,7 +143,16 @@ def inject(assembler, chain_definition, chain_items):
138
  print(f"Error looking up model architecture in PiD injector: {e}")
139
 
140
  if architecture:
141
- architecture = architecture.lower().replace(" ", "-").replace(".", "")
 
 
 
 
 
 
 
 
 
142
  else:
143
  file_lower = active_model_file.lower().replace("-", "").replace("_", "").replace(".", "")
144
  for arch in sorted(architectures_settings.keys(), key=len, reverse=True):
@@ -149,7 +163,13 @@ def inject(assembler, chain_definition, chain_items):
149
  candidates.append(arch.replace("-i1", ""))
150
  if "-kv" in arch:
151
  candidates.append(arch.replace("-kv", ""))
152
-
 
 
 
 
 
 
153
  matched = False
154
  for cand in candidates:
155
  if cand.replace("-", "").replace(".", "") in file_lower:
 
121
  if active_model_file:
122
  try:
123
  model_config = load_model_config()
124
+ checkpoints = {}
125
+ for k, v in model_config.items():
126
+ if isinstance(v, dict):
127
+ checkpoints.update(v)
128
  for arch_name, arch_data in checkpoints.items():
129
+ if not isinstance(arch_data, dict):
130
+ continue
131
  models_list = arch_data.get("models", [])
132
  for model_entry in models_list:
133
  if model_entry.get('path') == active_model_file:
 
143
  print(f"Error looking up model architecture in PiD injector: {e}")
144
 
145
  if architecture:
146
+ try:
147
+ from core.settings import ARCHITECTURES_CONFIG
148
+ arch_info = ARCHITECTURES_CONFIG.get('architectures', {}).get(architecture, {})
149
+ mapped_arch = arch_info.get("model_type")
150
+ if mapped_arch:
151
+ architecture = mapped_arch
152
+ else:
153
+ architecture = architecture.lower().replace(" ", "-").replace(".", "")
154
+ except Exception:
155
+ architecture = architecture.lower().replace(" ", "-").replace(".", "")
156
  else:
157
  file_lower = active_model_file.lower().replace("-", "").replace("_", "").replace(".", "")
158
  for arch in sorted(architectures_settings.keys(), key=len, reverse=True):
 
163
  candidates.append(arch.replace("-i1", ""))
164
  if "-kv" in arch:
165
  candidates.append(arch.replace("-kv", ""))
166
+ if arch == "sdxl":
167
+ candidates.append("xl")
168
+ if arch == "sd35":
169
+ candidates.append("sd3")
170
+ if arch == "flux1":
171
+ candidates.append("flux")
172
+
173
  matched = False
174
  for cand in candidates:
175
  if cand.replace("-", "").replace(".", "") in file_lower:
core/pipelines/sd_image_pipeline.py CHANGED
@@ -80,7 +80,7 @@ class SdImagePipeline(BasePipeline):
80
  if is_pid_enabled:
81
  import yaml
82
  pid_config_path = os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))), 'yaml', 'pid.yaml')
83
- pid_unet_name = "pid_flux1_1024_to_4096_4step_mxfp8.safetensors"
84
  try:
85
  with open(pid_config_path, 'r', encoding='utf-8') as f:
86
  pid_config = yaml.safe_load(f) or {}
 
80
  if is_pid_enabled:
81
  import yaml
82
  pid_config_path = os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))), 'yaml', 'pid.yaml')
83
+ pid_unet_name = "pid_1.5_flux1_1024_to_4096_4step_int8_convrot.safetensors"
84
  try:
85
  with open(pid_config_path, 'r', encoding='utf-8') as f:
86
  pid_config = yaml.safe_load(f) or {}