Skip to content

Commit 33d0ecc

Browse files
committed
fix startup issue, fix benchmark error, fix logging error
1 parent 422926a commit 33d0ecc

File tree

3 files changed

+16
-4
lines changed

3 files changed

+16
-4
lines changed

scripts/spartan/Worker.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -366,9 +366,13 @@ def request(self, payload: dict, option_payload: dict, sync_options: bool):
366366
response_queue = queue.Queue()
367367

368368
def preemptible_request(response_queue):
369-
if payload['sampler_index'] is None:
370-
logger.debug("had to substitute sampler index with name")
371-
payload['sampler_index'] = payload['sampler_name']
369+
# TODO shouldn't be this way
370+
sampler_index = payload.get('sampler_index', None)
371+
sampler_name = payload.get('sampler_name', None)
372+
if sampler_index is None:
373+
if sampler_name is not None:
374+
logger.debug("had to substitute sampler index with name")
375+
payload['sampler_index'] = sampler_name
372376

373377
try:
374378
response = self.session.post(

scripts/spartan/World.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -534,6 +534,13 @@ def load_config(self):
534534
config_raw = self.config()
535535
if config_raw is None:
536536
logger.debug("cannot parse null config (present but empty config file?)")
537+
why ={"prompt": "A herd of cows grazing at the bottom of a sunny valley",
538+
"negative_prompt": "",
539+
"steps": 20,
540+
"width": 512,
541+
"height": 512,
542+
"batch_size": 1}
543+
sh.benchmark_payload = Benchmark_Payload(**why)
537544
return
538545

539546
config = Config_Model(**config_raw)

scripts/spartan/shared.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,9 @@
2121

2222

2323
class Benchmark_Payload(BaseModel):
24+
validate_assignment = True
2425
prompt: str = Field(default="A herd of cows grazing at the bottom of a sunny valley")
25-
negative_prompt: str
26+
negative_prompt: str = Field(default="")
2627
steps: int = Field(default=20)
2728
width: int = Field(default=512)
2829
height: int = Field(default=512)

0 commit comments

Comments
 (0)