primerz commited on
Commit
2da2ac4
·
verified ·
1 Parent(s): d432eb2

Update config.py

Browse files
Files changed (1) hide show
  1. config.py +50 -4
config.py CHANGED
@@ -1,5 +1,6 @@
1
  """
2
  Configuration file for Pixagram AI Pixel Art Generator
 
3
  """
4
  import os
5
  import torch
@@ -22,11 +23,20 @@ MODEL_FILES = {
22
  # LORA configuration
23
  TRIGGER_WORD = "p1x3l4rt, pixel art"
24
 
25
- # Face detection configuration
 
 
 
 
 
 
 
 
26
  FACE_DETECTION_CONFIG = {
27
  "model_name": "antelopev2",
28
  "det_size": (640, 640),
29
- "ctx_id": 0
 
30
  }
31
 
32
  # Recommended resolutions
@@ -187,8 +197,44 @@ CLIP_SKIP = 2
187
  # Identity boost multiplier
188
  IDENTITY_BOOST_MULTIPLIER = 1.15
189
 
190
- print(f"[CONFIG] Loaded configuration")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
191
  print(f" Device: {device}")
192
  print(f" Dtype: {dtype}")
193
  print(f" Model Repo: {MODEL_REPO}")
194
- print(f" HuggingFace Token: {'Set' if HUGGINGFACE_TOKEN else 'Not set (using IP-based access)'}")
 
 
1
  """
2
  Configuration file for Pixagram AI Pixel Art Generator
3
+ UPDATED VERSION with InstantID configuration
4
  """
5
  import os
6
  import torch
 
23
  # LORA configuration
24
  TRIGGER_WORD = "p1x3l4rt, pixel art"
25
 
26
+ # InstantID configuration (NEW)
27
+ INSTANTID_CONFIG = {
28
+ "repo": "InstantX/InstantID",
29
+ "controlnet_subfolder": "ControlNetModel",
30
+ "ip_adapter_file": "ip-adapter.bin",
31
+ "default_ip_scale": 0.8
32
+ }
33
+
34
+ # Face detection configuration (UPDATED)
35
  FACE_DETECTION_CONFIG = {
36
  "model_name": "antelopev2",
37
  "det_size": (640, 640),
38
+ "ctx_id": 0,
39
+ "root": "./models/insightface"
40
  }
41
 
42
  # Recommended resolutions
 
197
  # Identity boost multiplier
198
  IDENTITY_BOOST_MULTIPLIER = 1.15
199
 
200
+
201
+ def validate_presets():
202
+ """Validate all preset configurations"""
203
+ errors = []
204
+
205
+ valid_ranges = {
206
+ 'strength': (0.0, 1.0),
207
+ 'guidance_scale': (0.5, 2.0),
208
+ 'identity_preservation': (0.0, 2.5),
209
+ 'lora_scale': (0.0, 2.0),
210
+ 'depth_control_scale': (0.0, 1.5),
211
+ 'identity_control_scale': (0.0, 1.5)
212
+ }
213
+
214
+ for preset_name, preset in PRESETS.items():
215
+ for param, (min_val, max_val) in valid_ranges.items():
216
+ if param in preset:
217
+ value = preset[param]
218
+ if not (min_val <= value <= max_val):
219
+ errors.append(
220
+ f"[ERROR] {preset_name}.{param} = {value} "
221
+ f"(valid: {min_val}-{max_val})"
222
+ )
223
+
224
+ if errors:
225
+ for error in errors:
226
+ print(error)
227
+ raise ValueError("Invalid preset configuration(s)")
228
+
229
+ print("[OK] All presets validated")
230
+
231
+
232
+ # Run validation on import
233
+ validate_presets()
234
+
235
+ print(f"[CONFIG] Loaded configuration with InstantID support")
236
  print(f" Device: {device}")
237
  print(f" Dtype: {dtype}")
238
  print(f" Model Repo: {MODEL_REPO}")
239
+ print(f" InstantID Repo: {INSTANTID_CONFIG['repo']}")
240
+ print(f" HuggingFace Token: {'Set' if HUGGINGFACE_TOKEN else 'Not set (using IP-based access)'}")