TencentARC / PhotoMaker

PhotoMaker [CVPR 2024]
https://photo-maker.github.io/
Other
9.4k stars 749 forks source link

CUDA error: device-side assert triggered when prompt contains `'img'` #63

Open yorickvP opened 8 months ago

yorickvP commented 8 months ago

When the text prompt contains 'img', without a space, this passes the gradio "Cannot find the trigger word" check, but then crashes the delayed conditioning step. After the crash, the CUDA context is corrupted and we have to restart the process.

prompt_text_only = prompt.replace(" "+self.trigger_word, "") doesn't find the trigger word since it doesn't start with a space, and then encode_prompt crashes because the text still contains the trigger token.

Suggested solution: tokenize the entire prompt, remove the trigger word token and re-encode into text.

Paper99 commented 8 months ago

We're checking this PR. Thank you for your contribution!