Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dynamic prompt updates in screen example #167

Open
jcelerier opened this issue Jul 31, 2024 · 4 comments
Open

Dynamic prompt updates in screen example #167

jcelerier opened this issue Jul 31, 2024 · 4 comments

Comments

@jcelerier
Copy link

I'm trying to make the prompt in the screen example evolve over time.
However, if I move

        stream.prepare(
            prompt=prompt,
            negative_prompt=negative_prompt,
            num_inference_steps=50,
            guidance_scale=guidance_scale,
            delta=delta,
        )

from before the main loop to within it, just before the call to

        output_images = stream.stream(
            input_batch.to(device=stream.device, dtype=stream.dtype)
        ).cpu()

then my output becomes pretty much some random uniform color.

If I add a timer to call stream.prepare for instance once every second, then once every second I get some grey / blank frame in the middle of the stream. How can I make this more fluid and continuous ?

@olegchomp
Copy link

There is function for updating prompt only without preparing the whole stream

def update_prompt(self, prompt: str) -> None:
encoder_output = self.pipe.encode_prompt(
prompt=prompt,
device=self.device,
num_images_per_prompt=1,
do_classifier_free_guidance=False,
)
self.prompt_embeds = encoder_output[0].repeat(self.batch_size, 1, 1)

@jcelerier
Copy link
Author

hmm does not seem to work very well here if I replace my call to prepare:

[E] 3: [executionContext.cpp::validateInputBindings::2046] Error Code 3: API Usage Error (Parameter check failed at: runtime/api/executionContext.cpp::validateInputBindings::2046, condition: profileMinDims.d[i] <= dimensions.d[i]. Supplied binding dimension [2,77,1024] for bindings[2] exceed min ~ max range at index 0, maximum dimension in profile is 4, minimum dimension in profile is 4, but supplied dimension is 2.

this gives me a lot of visual artifacts too

@olegchomp
Copy link

i mean, you need to prepare stream anyway, but after you can change prompt with function above.

@jcelerier
Copy link
Author

I do, I first have a call to prepare() unchanged from screen.py, and then I call stream.update_prompt("blah") whenever I get a new prompt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants