You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
---------------------------------------------------------------------------
RuntimeError Traceback (most recent call last)
Cell In[5], line 1
----> 1 pipeline.load_lora_weights("alimama-creative/FLUX.1-Turbo-Alpha", adapter_name=f"lora_")
File ~/.pyenv/versions/3.10.0/envs/jupyter/lib/python3.10/site-packages/diffusers/loaders/lora_pipeline.py:1550, in FluxLoraLoaderMixin.load_lora_weights(self, pretrained_model_name_or_path_or_dict, adapter_name, **kwargs)
1543 transformer_norm_state_dict = {
1544 k: state_dict.pop(k)
1545 forkinlist(state_dict.keys())
1546 if"transformer."in k and any(norm_key in k fornorm_keyin self._control_lora_supported_norm_keys)
1547 }
1549 transformer = getattr(self, self.transformer_name) if not hasattr(self, "transformer") else self.transformer
-> 1550 has_param_with_expanded_shape = self._maybe_expand_transformer_param_shape_or_error_(
1551 transformer, transformer_lora_state_dict, transformer_norm_state_dict
1552 )
1554 if has_param_with_expanded_shape:
1555 logger.info(
1556 "The LoRA weights contain parameters that have different shapes that expected by the transformer. "
1557 "As a result, the state_dict of the transformer has been expanded to match the LoRA parameter shapes. "
1558 "To get a comprehensive list of parameter names that were modified, enable debug logging."
1559 )
File ~/.pyenv/versions/3.10.0/envs/jupyter/lib/python3.10/site-packages/diffusers/loaders/lora_pipeline.py:2020, in FluxLoraLoaderMixin._maybe_expand_transformer_param_shape_or_error_(cls, transformer, lora_state_dict, norm_state_dict, prefix)
2017 parent_module = transformer.get_submodule(parent_module_name)
2019 with torch.device("meta"):
-> 2020 expanded_module = torch.nn.Linear(
2021 in_features, out_features, bias=bias, dtype=module_weight.dtype
2022 )
2023 # Only weights are expanded and biases are not. This is because only the input dimensions
2024 # are changed while the output dimensions remain the same. The shape of the weight tensor
2025 # is (out_features, in_features), while the shape of bias tensor is (out_features,), which
2026 # explains the reason why only weights are expanded.
2027 new_weight = torch.zeros_like(
2028 expanded_module.weight.data, device=module_weight.device, dtype=module_weight.dtype
2029 )
File ~/.pyenv/versions/3.10.0/envs/jupyter/lib/python3.10/site-packages/torch/nn/modules/linear.py:105, in Linear.__init__(self, in_features, out_features, bias, device, dtype)
103 self.in_features = in_features
104 self.out_features = out_features
--> 105 self.weight = Parameter(
106 torch.empty((out_features, in_features),**factory_kwargs)107 )108 if bias:109 self.bias = Parameter(torch.empty(out_features, **factory_kwargs))
File ~/.pyenv/versions/3.10.0/envs/jupyter/lib/python3.10/site-packages/torch/nn/parameter.py:46, in Parameter.__new__(cls, data, requires_grad)
42 data = torch.empty(0)
43 if type(data) is torch.Tensor or type(data) is Parameter:
44 # For ease of BC maintenance, keep this path for standard Tensor.
45 # Eventually (tm), we should change the behavior for standard Tensor to match.
---> 46 return torch.Tensor._make_subclass(cls, data, requires_grad)
48 # Path for custom tensors: set a flag on the instance to indicate parameter-ness.
49 t = data.detach().requires_grad_(requires_grad)
RuntimeError: Only Tensors of floating point and complex dtype can require gradients
System Info
Copy-and-paste the text below in your GitHub issue and FILL OUT the two last points.
hamzaakyildiz
changed the title
Loading A LoRa into NF4 Quantized Flux Fill model Gives an Error
Loading A LoRa into NF4 Quantized Flux Fill Pipeline Gives an Error
Jan 20, 2025
Describe the bug
When i try to load a lora, such as
alimama-creative/FLUX.1-Turbo-Alpha
, into nf4 quantized flux fill pipeline it gives an errorReproduction
Logs
System Info
Copy-and-paste the text below in your GitHub issue and FILL OUT the two last points.
Who can help?
@sayakpaul
The text was updated successfully, but these errors were encountered: