0% 0/28 [00:07<?, ?it/s] Traceback (most recent call last): File…
- User
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
0%| | 0/28 [00:07<?, ?it/s] Traceback (most recent call last): File "/path/lib/python3.11/site-packages/gradio/queueing.py", line 407, in call_prediction output = await route_utils.call_process_api( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/path/lib/python3.11/site-packages/gradio/route_utils.py", line 226, in call_process_api output = await app.get_blocks().process_api( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/path/lib/python3.11/site-packages/gradio/blocks.py", line 1550, in process_api result = await self.call_function( ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/path/lib/python3.11/site-packages/gradio/blocks.py", line 1185, in call_function prediction = await anyio.to_thread.run_sync( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/path/lib/python3.11/site-packages/anyio/to_thread.py", line 56, in run_sync return await get_async_backend().run_sync_in_worker_thread( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/path/lib/python3.11/site-packages/anyio/_backends/_asyncio.py", line 2470, in run_sync_in_worker_thread return await future ^^^^^^^^^^^^ File "/path/lib/python3.11/site-packages/anyio/_backends/_asyncio.py", line 967, in run result = context.run(func, *args) ^^^^^^^^^^^^^^^^^^^^^^^^ File "/path/lib/python3.11/site-packages/gradio/utils.py", line 661, in wrapper response = f(*args, **kwargs) ^^^^^^^^^^^^^^^^^^ File "/home/uwuntu/code/projects/rm_obj_video/Omnieraser/ControlNet_version/gradio_controlnet_lora_flux.py", line 158, in infer return predict(input_image, ^^^^^^^^^^^^^^^^^^^^ File "/home/uwuntu/code/projects/rm_obj_video/Omnieraser/ControlNet_version/gradio_controlnet_lora_flux.py", line 112, in predict result = pipe( ^^^^^ File "/path/lib/python3.11/site-packages/torch/utils/_contextlib.py", line 116, in decorate_context return func(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^ File "/home/uwuntu/code/projects/rm_obj_video/Omnieraser/ControlNet_version/pipeline_flux_controlnet_removal.py", line 958, in call ) = self.controlnet( ^^^^^^^^^^^^^^^^ File "/path/lib/python3.11/site-packages/torch/nn/modules/module.py", line 1739, in _wrapped_call_impl return self._call_impl(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/path/lib/python3.11/site-packages/torch/nn/modules/module.py", line 1750, in _call_impl return forward_call(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/path/lib/python3.11/site-packages/accelerate/hooks.py", line 170, in new_forward output = module._old_forward(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/uwuntu/code/projects/rm_obj_video/Omnieraser/ControlNet_version/controlnet_flux.py", line 332, in forward encoder_hidden_states, hidden_states = block( ^^^^^^ File "/path/lib/python3.11/site-packages/torch/nn/modules/module.py", line 1739, in _wrapped_call_impl return self._call_impl(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/path/lib/python3.11/site-packages/torch/nn/modules/module.py", line 1750, in _call_impl return forward_call(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/uwuntu/code/projects/rm_obj_video/Omnieraser/ControlNet_version/transformer_flux.py", line 213, in forward attn_output, context_attn_output = self.attn( ^^^^^^^^^^ File "/path/lib/python3.11/site-packages/torch/nn/modules/module.py", line 1739, in _wrapped_call_impl return self._call_impl(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/path/lib/python3.11/site-packages/torch/nn/modules/module.py", line 1750, in _call_impl return forward_call(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/path/src/diffusers/src/diffusers/models/attention_processor.py", line 605, in forward return self.processor( ^^^^^^^^^^^^^^^ File "/path/src/diffusers/src/diffusers/models/attention_processor.py", line 2339, in call query = apply_rotary_emb(query, image_rotary_emb) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/path/src/diffusers/src/diffusers/models/embeddings.py", line 1197, in apply_rotary_emb cos, sin = freqs_cis # [S, D] ^^^^^^^^ ValueError: not enough values to unpack (expected 2, got 1)
controlnet = FluxControlNetModel.from_pretrained(controlnet_path, torch_dtype=torch_dtype)
gr.Info(str(f"Model loading: {int((20 / 100) * 100)}%"))
transformer = FluxTransformer2DModel.from_pretrained(base_model_path, subfolder='transformer', torch_dtype=torch_dtype)
gr.Info(str(f"Model loading: {int((40 / 100) * 100)}%"))
pipe = FluxControlNetInpaintingPipeline.from_pretrained(
pretrained_model_name_or_path=base_model_path,
controlnet=controlnet,
transformer=transformer,
torch_dtype=torch_dtype
)
pipe.transformer.to(torch_dtype)
pipe.controlnet.to(torch_dtype)
gr.Info(str(f"Model loading: {int((80 / 100) * 100)}%"))
gr.Info(str(f"Inject LoRA: {lora_path}"))
pipe.load_lora_weights(lora_path, weight_name="controlnet_flux_pytorch_lora_weights.safetensors")
gr.Info(str(f"Model loading: {int((100 / 100) * 100)}%"))
i tried installing diffusers 0.25.1 got the error: ImportError: cannot import name 'cached_download' from 'huggingface_hub' (/path/lib/python3.11/site-packages/huggingface_hub/init.py) had 0.34.dev0 before (pip install -e git+https://github.com/huggingface/diffusers.git in their requirements) and did had this error but had previous
It appears you're encountering two distinct issues related to the Hugging Face libraries:
ImportError: cannot import name 'cached_download' from 'huggingface_hub'
This error arises because the cached_download function was removed in version 0.26.0 of the huggingface_hub library. To resolve this, you have two options:
Downgrade huggingface_hub to a version prior to 0.26.0, such as 0.25.2:
pip install huggingface_hub==0.25.2
This approach reinstates the cached_download function, allowing your existing code to function without modification[1].
Update your code to use the hf_hub_download function, which replaces cached_download in newer versions:
from huggingface_hub import hf_hub_download
# Example usage
file_path = hf_hub_download(repo_id="repo_name", filename="file_name")
This method aligns your code with the latest library updates and is recommended for long-term compatibility.
ValueError: not enough values to unpack (expected 2, got 1)
This error occurs during the unpacking of freqs_cis in the apply_rotary_emb function. It suggests that the function is receiving an unexpected input, possibly due to changes in the diffusers library or its dependencies.
To address this:
Ensure all related libraries are compatible: Conflicts between library versions can lead to such errors. Verify that the versions of diffusers, huggingface_hub, and other dependencies are compatible. You might need to adjust versions to achieve compatibility.
Review recent changes in the diffusers library: If you've updated to a development version (e.g., 0.34.dev0), it's possible that recent changes have introduced this issue. Consider reverting to a stable release or checking the library's issue tracker for similar reports and potential fixes.
Inspect the apply_rotary_emb function: Examine how freqs_cis is generated and ensure it produces the expected output. If necessary, adjust the function to handle different input shapes or values.
By addressing these issues, you should be able to resolve the errors and ensure your code runs smoothly.
I tried: from diffusers.models.embeddings import apply_rotary_emb import torch
query = torch.randn(1, 2304, 128) # Example tensor, adjust shape based on your model
freqs_cis = torch.randn(2304, 128, 2) # Simulated freqs_cis (cos, sin)
try: result = apply_rotary_emb(query, freqs_cis) print("Success: apply_rotary_emb works!") except Exception as e: print(f"Error: {e}")
And it still does not work
torch: 2.6.0+cu124 diffusers: 0.30.2 transformers: 4.42.0
I understand you're encountering a ValueError related to the apply_rotary_emb function in the diffusers library, even after testing with dummy inputs. This issue may stem from compatibility problems between different versions of the libraries you're using. Here's how you can address this:
1. Library Version Compatibility:
diffusers Library: The apply_rotary_emb function has undergone changes in recent versions of the diffusers library. To ensure compatibility, consider using a stable release that aligns with your project's requirements.
huggingface_hub Library: The cached_download function was removed in version 0.26.0. If your code relies on this function, you have two options:
Downgrade huggingface_hub: Install version 0.25.2 to restore the cached_download function:
pip install huggingface_hub==0.25.2
Update Your Code: Modify your code to use the hf_hub_download function, which replaces cached_download in newer versions:
from huggingface_hub import hf_hub_download
# Example usage
file_path = hf_hub_download(repo_id="repo_name", filename="file_name")
2. Addressing the ValueError in apply_rotary_emb:
Check Input Shapes: Ensure that the inputs to apply_rotary_emb have the correct shapes. The function expects freqs_cis to be a tuple containing two tensors (cosine and sine components). If freqs_cis is not structured correctly, it can lead to unpacking errors.
Review Recent Changes: If you've updated to a development version of diffusers (e.g., 0.34.dev0), recent changes might have introduced this issue. Consider reverting to a stable release or checking the library's issue tracker for similar reports and potential fixes.
3. Community Insights:
ValueError during the attention mechanism. The discussion suggests that certain attention processors may return only one value, leading to unpacking errors. Reviewing this thread might provide additional insights[1]:By ensuring compatibility between your libraries and verifying the input structures, you should be able to resolve the errors and ensure your code runs smoothly.