AUTOMATIC1111 / stable-diffusion-webui

Stable Diffusion web UI
GNU Affero General Public License v3.0
139.41k stars 26.43k forks source link

[Issue]: RuntimeError: Expected all tensors to be on the same device, but found at least two devices, cpu and cuda:0! (when checking argument for argument index in method wrapper_CUDA__index_select) #16263

Open EnergyKrolik opened 1 month ago

EnergyKrolik commented 1 month ago

Checklist

What happened?

after installing lastest VAE from huggingface i got this issue when try to generate txt2img. When i change VAE at setting, it writes "0 setting changed" Should i even use this now? 1.9.4 version. зображення_2024-07-26_060525858 зображення_2024-07-26_060540930

Steps to reproduce the problem

Using an auto vae

What should have happened?

Rendering as normal, but slowly as MSE/EMA

What browsers do you use to access the UI ?

Other

Sysinfo

sysinfo-2024-07-26-03-10.json

Console logs

*** Error completing request
*** Arguments: ('task(2bhxfbj4cmau461)', <gradio.routes.Request object at 0x000001B7C262F950>, '', '', [], 1, 1, 7, 720, 550, False, 0.7, 2, 'Latent', 0, 0, 0, 'Use same checkpoint', 'Use same sampler', 'Use same scheduler', '', '', [], 0, 25, 'DPM++ 2M', 'Automatic', False, '', 0.8, -1, False, -1, 0, 0, 0, False, False, 'positive', 'comma', 0, False, False, 'start', '', 1, '', [], 0, '', [], 0, '', [], True, False, False, False, False, False, False, 0, False) {}
    Traceback (most recent call last):
      File "E:\Нейронка та порнуха (SD)\PADLA ROGATAYA\stable-diffusion-webui\modules\call_queue.py", line 57, in f
        res = list(func(*args, **kwargs))
                   ^^^^^^^^^^^^^^^^^^^^^
      File "E:\Нейронка та порнуха (SD)\PADLA ROGATAYA\stable-diffusion-webui\modules\call_queue.py", line 36, in f
        res = func(*args, **kwargs)
              ^^^^^^^^^^^^^^^^^^^^^
      File "E:\Нейронка та порнуха (SD)\PADLA ROGATAYA\stable-diffusion-webui\modules\txt2img.py", line 109, in txt2img
        processed = processing.process_images(p)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "E:\Нейронка та порнуха (SD)\PADLA ROGATAYA\stable-diffusion-webui\modules\processing.py", line 845, in process_images
        res = process_images_inner(p)
              ^^^^^^^^^^^^^^^^^^^^^^^
      File "E:\Нейронка та порнуха (SD)\PADLA ROGATAYA\stable-diffusion-webui\modules\processing.py", line 959, in process_images_inner
        p.setup_conds()
      File "E:\Нейронка та порнуха (SD)\PADLA ROGATAYA\stable-diffusion-webui\modules\processing.py", line 1495, in setup_conds
        super().setup_conds()
      File "E:\Нейронка та порнуха (SD)\PADLA ROGATAYA\stable-diffusion-webui\modules\processing.py", line 506, in setup_conds
        self.uc = self.get_conds_with_caching(prompt_parser.get_learned_conditioning, negative_prompts, total_steps, [self.cached_uc], self.extra_network_data)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "E:\Нейронка та порнуха (SD)\PADLA ROGATAYA\stable-diffusion-webui\modules\processing.py", line 492, in get_conds_with_caching
        cache[1] = function(shared.sd_model, required_prompts, steps, hires_steps, shared.opts.use_old_scheduling)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "E:\Нейронка та порнуха (SD)\PADLA ROGATAYA\stable-diffusion-webui\modules\prompt_parser.py", line 188, in get_learned_conditioning
        conds = model.get_learned_conditioning(texts)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "E:\Нейронка та порнуха (SD)\PADLA ROGATAYA\stable-diffusion-webui\modules\sd_models_xl.py", line 32, in get_learned_conditioning
        c = self.conditioner(sdxl_conds, force_zero_embeddings=['txt'] if force_zero_negative_prompt else [])
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "E:\Нейронка та порнуха (SD)\PADLA ROGATAYA\stable-diffusion-webui\venv\Lib\site-packages\torch\nn\modules\module.py", line 1518, in _wrapped_call_impl
        return self._call_impl(*args, **kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "E:\Нейронка та порнуха (SD)\PADLA ROGATAYA\stable-diffusion-webui\venv\Lib\site-packages\torch\nn\modules\module.py", line 1527, in _call_impl
        return forward_call(*args, **kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "E:\Нейронка та порнуха (SD)\PADLA ROGATAYA\stable-diffusion-webui\repositories\generative-models\sgm\modules\encoders\modules.py", line 141, in forward
        emb_out = embedder(batch[embedder.input_key])
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "E:\Нейронка та порнуха (SD)\PADLA ROGATAYA\stable-diffusion-webui\venv\Lib\site-packages\torch\nn\modules\module.py", line 1518, in _wrapped_call_impl
        return self._call_impl(*args, **kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "E:\Нейронка та порнуха (SD)\PADLA ROGATAYA\stable-diffusion-webui\venv\Lib\site-packages\torch\nn\modules\module.py", line 1527, in _call_impl
        return forward_call(*args, **kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "E:\Нейронка та порнуха (SD)\PADLA ROGATAYA\stable-diffusion-webui\repositories\generative-models\sgm\util.py", line 59, in do_autocast
        return f(*args, **kwargs)
               ^^^^^^^^^^^^^^^^^^
      File "E:\Нейронка та порнуха (SD)\PADLA ROGATAYA\stable-diffusion-webui\repositories\generative-models\sgm\modules\encoders\modules.py", line 391, in forward
        outputs = self.transformer(
                  ^^^^^^^^^^^^^^^^^
      File "E:\Нейронка та порнуха (SD)\PADLA ROGATAYA\stable-diffusion-webui\venv\Lib\site-packages\torch\nn\modules\module.py", line 1518, in _wrapped_call_impl
        return self._call_impl(*args, **kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "E:\Нейронка та порнуха (SD)\PADLA ROGATAYA\stable-diffusion-webui\venv\Lib\site-packages\torch\nn\modules\module.py", line 1527, in _call_impl
        return forward_call(*args, **kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "E:\Нейронка та порнуха (SD)\PADLA ROGATAYA\stable-diffusion-webui\venv\Lib\site-packages\transformers\models\clip\modeling_clip.py", line 822, in forward
        return self.text_model(
               ^^^^^^^^^^^^^^^^
      File "E:\Нейронка та порнуха (SD)\PADLA ROGATAYA\stable-diffusion-webui\venv\Lib\site-packages\torch\nn\modules\module.py", line 1518, in _wrapped_call_impl
        return self._call_impl(*args, **kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "E:\Нейронка та порнуха (SD)\PADLA ROGATAYA\stable-diffusion-webui\venv\Lib\site-packages\torch\nn\modules\module.py", line 1527, in _call_impl
        return forward_call(*args, **kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "E:\Нейронка та порнуха (SD)\PADLA ROGATAYA\stable-diffusion-webui\venv\Lib\site-packages\transformers\models\clip\modeling_clip.py", line 730, in forward
        hidden_states = self.embeddings(input_ids=input_ids, position_ids=position_ids)
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "E:\Нейронка та порнуха (SD)\PADLA ROGATAYA\stable-diffusion-webui\venv\Lib\site-packages\torch\nn\modules\module.py", line 1518, in _wrapped_call_impl
        return self._call_impl(*args, **kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "E:\Нейронка та порнуха (SD)\PADLA ROGATAYA\stable-diffusion-webui\venv\Lib\site-packages\torch\nn\modules\module.py", line 1527, in _call_impl
        return forward_call(*args, **kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "E:\Нейронка та порнуха (SD)\PADLA ROGATAYA\stable-diffusion-webui\venv\Lib\site-packages\transformers\models\clip\modeling_clip.py", line 227, in forward
        inputs_embeds = self.token_embedding(input_ids)
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "E:\Нейронка та порнуха (SD)\PADLA ROGATAYA\stable-diffusion-webui\venv\Lib\site-packages\torch\nn\modules\module.py", line 1518, in _wrapped_call_impl
        return self._call_impl(*args, **kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "E:\Нейронка та порнуха (SD)\PADLA ROGATAYA\stable-diffusion-webui\venv\Lib\site-packages\torch\nn\modules\module.py", line 1527, in _call_impl
        return forward_call(*args, **kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "E:\Нейронка та порнуха (SD)\PADLA ROGATAYA\stable-diffusion-webui\venv\Lib\site-packages\torch\nn\modules\sparse.py", line 162, in forward
        return F.embedding(
               ^^^^^^^^^^^^
      File "E:\Нейронка та порнуха (SD)\PADLA ROGATAYA\stable-diffusion-webui\venv\Lib\site-packages\torch\nn\functional.py", line 2233, in embedding
        return torch.embedding(weight, input, padding_idx, scale_grad_by_freq, sparse)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    RuntimeError: Expected all tensors to be on the same device, but found at least two devices, cpu and cuda:0! (when checking argument for argument index in method wrapper_CUDA__index_select)

Additional information

No response

w-e-w commented 1 month ago

the vae model you're trying to use is for diffusers we don't support diffusers model format, that model can't be used

EnergyKrolik commented 1 month ago

the vae model you're trying to use is for diffusers we don't support diffusers model format, that model can't be used so which vae i should to use?

w-e-w commented 1 month ago

just set it to automatic checkpoints should already have a VAE included inside that option is optional, is there so that you can use one that is not bundled with the checkpoints

EnergyKrolik commented 1 month ago

just set it to automatic checkpoints should already have a VAE included inside that option is optional, is there so that you can use one that is not bundled with the checkpoints

ok, ty. Another question if we are already met here. How i should to fix poor drawled eyes even i use same negative prompts?

vis223 commented 1 month ago

After trying a ton of solutions that all failed. Nearly drove me mad. I found I could simply add

--device-id 0

to web-ui.bat. Worked like a charm for me.

yx99 commented 1 week ago

same problem