For duplicated private space "Sign in with Hugging Face" doesn't work. This prevents use of private custom LoRAs.

#5
by ikolomiets - opened

In the latest versions, after space duplication, the "Sign in with Hugging Face" no longer works. As result, it not possible to add private custom LoRA.
Upon clicking on "Sign in with Hugging Face" nothing happens, the Logs has this output:

Attempted to select a non-interactive or hidden tab.
Attempted to select a non-interactive or hidden tab.
Attempted to select a non-interactive or hidden tab.
Attempted to select a non-interactive or hidden tab.
/usr/local/lib/python3.10/site-packages/gradio/components/login_button.py:75: UserWarning: LoginButton created outside of a Blocks context. May not work unless you call its `activate()` method manually.
  warnings.warn(
Attempted to select a non-interactive or hidden tab.
Attempted to select a non-interactive or hidden tab.
Attempted to select a non-interactive or hidden tab.
Attempted to select a non-interactive or hidden tab.

Attempt to add private custom LoRA displays error and has this logs:

New LoRA: {'image': 'https://huggingface.co/xxxxxxxxx/xxxxxxxx/resolve/main/samples/xxxxxxxx.jpg', 'title': 'xxxxx', 'repo': 'xxxxxxxxxxxxx', 'weights': 'xxxxxxxxx.safetensors', 'trigger_word': 'xxxxxxxxx'}
Finished adding custom LoRA
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/gradio/queueing.py", line 622, in process_events
    response = await route_utils.call_process_api(
  File "/usr/local/lib/python3.10/site-packages/gradio/route_utils.py", line 323, in call_process_api
    output = await app.get_blocks().process_api(
  File "/usr/local/lib/python3.10/site-packages/gradio/blocks.py", line 2026, in process_api
    data = await self.postprocess_data(block_fn, result["prediction"], state)
  File "/usr/local/lib/python3.10/site-packages/gradio/blocks.py", line 1834, in postprocess_data
    outputs_cached = await processing_utils.async_move_files_to_cache(
  File "/usr/local/lib/python3.10/site-packages/gradio/processing_utils.py", line 703, in async_move_files_to_cache
    return await client_utils.async_traverse(
  File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 1019, in async_traverse
    return await func(json_obj)
  File "/usr/local/lib/python3.10/site-packages/gradio/processing_utils.py", line 676, in _move_to_cache
    temp_file_path = await block.async_move_resource_to_block_cache(
  File "/usr/local/lib/python3.10/site-packages/gradio/blocks.py", line 303, in async_move_resource_to_block_cache
    temp_file_path = await processing_utils.async_ssrf_protected_download(
  File "/usr/local/lib/python3.10/site-packages/gradio/processing_utils.py", line 432, in async_ssrf_protected_download
    raise Exception(f"Failed to download file. Status code: {response.status_code}")
Exception: Failed to download file. Status code: 401

Screenshot 2024-10-15 at 18.01.21.png

Owner
โ€ข
edited Oct 15

Thanks for the report. I'll look into it.
Also, that sign-in button warning is a mystery to me, although I see it all the time. Despite the warning, it actually works for quota mitigation.

Edit:
Maybe I misunderstood the issue. I didn't originally put the ability to use a private repo custom LoRA in this space.
That sign-in button is for Quota mitigation in the Zero GPU space, and it doesn't even require a read token, so it can't be done. If you want to do it, you need to mod it first.

Thanks for prompt reply! Then, the problem is not related to login button. Still, in older versions of this space, I would just create and specify HF read token to access my private lora models. But now it doesn't work...

Still, in older versions of this space, I would just create and specify HF read token to access my private lora models. But now it doesn't work...

I see. Older versions may have supported HF_TOKEN because that feature was my own creation.๐Ÿค”
The current version has replaced it with a feature that was officially supported in the original space, so it may have disappeared in the process.
I'll take another look at it from that perspective.

I've made a few changes.

Unfortunately, same error.

Looks like the changes were deeper than I thought. I made a few more changes.

same...

This issue may not be simple.
The short answer is that HF may be buggy.
There may be a function that is not correctly recognizing private repo...๐Ÿ˜ฑ

As it turns out, it was Gradio that was buggy. I think I was able to work around it, but not solve it.

It works now! The only issue, is that it doesn't show model's sample image in the grid, instead its square has "Custom model" text.
Thanks for your ongoing support!

it doesn't show model's sample image in the grid, instead its square has "Custom model" text.

Glad it works.
This problem is nothing that can't be fixed, but it's like a compatibility issue between Gradio and HF's private repo. I may fix it eventually. Maybe not. I'll take a closer look and if it looks easy, I'll fix it.

I maybe filed it.

It's fixed!

Sign up or log in to comment