Spaces:
Runtime error
Runtime error
anbucur
commited on
Commit
·
9cd6532
1
Parent(s):
7ccbf05
Enhance seed handling and logging in ProductionDesignModel class
Browse files- Improved seed parameter handling to use a default value if not provided.
- Added logging for the base seed and validated parameters (num_steps, guidance_scale, strength) for better traceability.
- prod_model.py +8 -1
prod_model.py
CHANGED
|
@@ -103,13 +103,20 @@ class ProductionDesignModel(DesignModel):
|
|
| 103 |
num_steps = int(kwargs.get('num_steps', 50))
|
| 104 |
guidance_scale = float(kwargs.get('guidance_scale', 7.5))
|
| 105 |
strength = float(kwargs.get('strength', 0.75))
|
| 106 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 107 |
|
| 108 |
# Parameter validation
|
| 109 |
num_steps = max(20, min(100, num_steps))
|
| 110 |
guidance_scale = max(1, min(20, guidance_scale))
|
| 111 |
strength = max(0.1, min(1.0, strength))
|
| 112 |
|
|
|
|
|
|
|
|
|
|
| 113 |
# Prepare the prompt
|
| 114 |
full_prompt = self._prepare_prompt(prompt)
|
| 115 |
|
|
|
|
| 103 |
num_steps = int(kwargs.get('num_steps', 50))
|
| 104 |
guidance_scale = float(kwargs.get('guidance_scale', 7.5))
|
| 105 |
strength = float(kwargs.get('strength', 0.75))
|
| 106 |
+
|
| 107 |
+
# Handle seed properly
|
| 108 |
+
seed_param = kwargs.get('seed')
|
| 109 |
+
base_seed = int(time.time()) if seed_param is None else seed_param
|
| 110 |
+
logging.info(f"Using base seed: {base_seed}")
|
| 111 |
|
| 112 |
# Parameter validation
|
| 113 |
num_steps = max(20, min(100, num_steps))
|
| 114 |
guidance_scale = max(1, min(20, guidance_scale))
|
| 115 |
strength = max(0.1, min(1.0, strength))
|
| 116 |
|
| 117 |
+
# Log validated parameters
|
| 118 |
+
logging.info(f"Validated parameters: steps={num_steps}, guidance={guidance_scale}, strength={strength}")
|
| 119 |
+
|
| 120 |
# Prepare the prompt
|
| 121 |
full_prompt = self._prepare_prompt(prompt)
|
| 122 |
|