ArtVentureX / sd-webui-agent-scheduler

605 stars 61 forks source link

Failed to load task result: 'Seed' #168

Open Oninaig opened 8 months ago

Oninaig commented 8 months ago

Whenever I click on one of the rows from the finished task list, the preview fails to load and this is show in the text box below where the preview usually goes:

Failed to load task result: 'Seed'

Looks like Seed isn't in the collection when looping through infotexts in the infotexts_to_geninfo method

Wrapping the for infotext in infotexts line within the infotexts_to_geninfo method with a try/catch seems to be a temporary workaround, although at the moment I am not sure what else that could potentially break:

def infotexts_to_geninfo(infotexts: List[str]):
    all_promts = []
    all_seeds = []

    geninfo = {"infotexts": infotexts, "all_prompts": all_promts, "all_seeds": all_seeds, "index_of_first_image": 0}

    try:
        for infotext in infotexts:
            params = parse_generation_parameters(infotext)
            for x in params:
                print(x + " " + str(params[x]))        
            if "prompt" not in params:
                geninfo["prompt"] = params["Prompt"]
                geninfo["negative_prompt"] = params["Negative prompt"]
                geninfo["seed"] = params["Seed"]
                geninfo["sampler_name"] = params["Sampler"]
                geninfo["cfg_scale"] = params["CFG scale"]
                geninfo["steps"] = params["Steps"]
                geninfo["width"] = params["Size-1"]
                geninfo["height"] = params["Size-2"]

            all_promts.append(params["Prompt"])
            all_seeds.append(params["Seed"])
    except Exception as e:
        log.error(f"[AgentScheduler] Failed to parse infotexts")
        log.error(e)
    return geninfo

I added those lines that print the params as a sanity check for myself, and the output for that (for me at least) looks like this:

Negative prompt
Clip skip 1
Hires resize-1 0
Hires resize-2 0
Hires sampler Use same sampler
Hires checkpoint Use same checkpoint
Hires prompt
Hires negative prompt
RNG GPU
Schedule type Automatic
Schedule max sigma 0
Schedule min sigma 0
Schedule rho 0
VAE Encoder Full
VAE Decoder Full
ERROR:sd:[AgentScheduler] Failed to parse infotexts
ERROR:sd:'Seed'
artventuredev commented 8 months ago

Hi @Oninaig, are you using dynamic prompt like #167?

artventuredev commented 8 months ago

I just added a fix for this, please update to the latest commit.