"Expected all tensors to be on the same device, but found at least two devices, cuda:0 and cpu!" on longer prompts only
#23
by
perk11
- opened
My code is available here: https://github.com/perk11/viktor89/blob/main/inference-servers/auraflow/main.py
It works fine with shorter prompts, but when I try longer prompts like
A hyper-detailed, close-up view inside a magical snow globe. The word "Snow" is intricately formed from miniature snowflakes and frost patterns, suspended in the center of the globe. Surrounding the word, a miniature winter wonderland unfolds in exquisite detail. Tiny evergreen trees, their branches laden with snow, create a dense forest. A frozen lake reflects the scene like a mirror, with microscopic ice skaters etching patterns on its surface. A miniature log cabin nestles in the trees, warm light spilling from its windows and smoke curling from the chimney. Tiny deer and rabbits leave intricate tracks in the snow. Countless snowflakes of varying sizes and intricate designs swirl around the scene, some caught in mid-fall, others settled on surfaces. The globe's glass is visible at the edges, slightly distorting the view and adding to the magical atmosphere. The lighting suggests a setting sun, casting long shadows and bathing the scene in a warm, golden glow that contrasts with the cool blues and whites of the snow. Every element is rendered in minute detail, inviting the viewer to explore the miniature world within the snow globe.
I get the following error:
[2024-07-23 02:54:04,544] ERROR in app: Exception on /sdapi/v1/txt2img [POST]
Traceback (most recent call last):
File "/home/perk11/.conda/envs/auraflow/lib/python3.11/site-packages/flask/app.py", line 1473, in wsgi_app
response = self.full_dispatch_request()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/perk11/.conda/envs/auraflow/lib/python3.11/site-packages/flask/app.py", line 882, in full_dispatch_request
rv = self.handle_user_exception(e)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/perk11/.conda/envs/auraflow/lib/python3.11/site-packages/flask/app.py", line 880, in full_dispatch_request
rv = self.dispatch_request()
^^^^^^^^^^^^^^^^^^^^^^^
File "/home/perk11/.conda/envs/auraflow/lib/python3.11/site-packages/flask/app.py", line 865, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args) # type: ignore[no-any-return]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/perk11/LLM/viktor89/inference-servers/auraflow/main.py", line 37, in generate_image
image = pipeline(
^^^^^^^^^
File "/home/perk11/.conda/envs/auraflow/lib/python3.11/site-packages/torch/utils/_contextlib.py", line 115, in decorate_context
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/home/perk11/.conda/envs/auraflow/lib/python3.11/site-packages/diffusers/pipelines/aura_flow/pipeline_aura_flow.py", line 507, in __call__
) = self.encode_prompt(
^^^^^^^^^^^^^^^^^^^
File "/home/perk11/.conda/envs/auraflow/lib/python3.11/site-packages/diffusers/pipelines/aura_flow/pipeline_aura_flow.py", line 267, in encode_prompt
if untruncated_ids.shape[-1] >= text_input_ids.shape[-1] and not torch.equal(
^^^^^^^^^^^^
RuntimeError: Expected all tensors to be on the same device, but found at least two devices, cuda:0 and cpu! (when checking argument for argument other in method wrapper_CUDA__equal)