xhinker/sd_embed

Not able to run the flux example: "Couldn't swap QLinear.weight"

MisterTea opened this issue · 1 comments

From running the example in the readme:

Traceback (most recent call last):
  File "btl/flux2.py", line 42, in <module>
    prompt_embeds, pooled_prompt_embeds = get_weighted_text_embeddings_flux1(
                                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "venv/lib/python3.11/site-packages/sd_embed/embedding_funcs.py", line 1400, in get_weighted_text_embeddings_flux1
    prompt_embeds_1 = pipe.text_encoder(
                      ^^^^^^^^^^^^^^^^^^
  File "venv/lib/python3.11/site-packages/torch/nn/modules/module.py", line 1553, in _wrapped_call_impl
    return self._call_impl(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "venv/lib/python3.11/site-packages/torch/nn/modules/module.py", line 1562, in _call_impl
    return forward_call(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "venv/lib/python3.11/site-packages/accelerate/hooks.py", line 164, in new_forward
    args, kwargs = module._hf_hook.pre_forward(module, *args, **kwargs)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "venv/lib/python3.11/site-packages/accelerate/hooks.py", line 698, in pre_forward
    module.to(self.execution_device)
  File "venv/lib/python3.11/site-packages/transformers/modeling_utils.py", line 2883, in to
    return super().to(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "venv/lib/python3.11/site-packages/torch/nn/modules/module.py", line 1174, in to
    return self._apply(convert)
           ^^^^^^^^^^^^^^^^^^^^
  File "venv/lib/python3.11/site-packages/torch/nn/modules/module.py", line 780, in _apply
    module._apply(fn)
  File "venv/lib/python3.11/site-packages/torch/nn/modules/module.py", line 780, in _apply
    module._apply(fn)
  File "venv/lib/python3.11/site-packages/torch/nn/modules/module.py", line 780, in _apply
    module._apply(fn)
  [Previous line repeated 3 more times]
  File "venv/lib/python3.11/site-packages/torch/nn/modules/module.py", line 823, in _apply
    raise RuntimeError(f"_apply(): Couldn't swap {self._get_name()}.{key}") from e
RuntimeError: _apply(): Couldn't swap QLinear.weight

Thank you, fixed