ZeroGPU quota issue

#38
by hysts HF staff - opened

Hi @lllyasviel ,
Would it be possible to upgrade the SDK version of this Space to the latest gradio==5.13.1?

In gradio<5.12.0, there was an issue where the ZeroGPU quota was not handled correctly. Though logged-in users have a 5-minute GPU quota, and PRO users have a 25-minute quota, when a function directly called by an event trigger in Gradio is not decorated with @spaces.GPU, all users are treated as non-logged-in users, resulting in only a 3-minute quota for everyone.

This issue was addressed in gradio==5.12.0, so upgrading to the latest version would improve the user experience of your Space.

Since the code is hidden, I'm not sure if your code is compatible with gradio 5.x, but if there's a compatibility issue, you can resolve the ZeroGPU quota issue by adding the attribute .zerogpu = True to the function called by the event trigger instead.

For example, this code doesn't work with gradio<5.12.0,

import gradio as gr
import spaces


@spaces.GPU(duration=181)
def inner_fn():
    return "test"


def wrapper_fn():
    return inner_fn()


with gr.Blocks() as demo:
    btn = gr.Button()
    out = gr.Textbox()
    btn.click(fn=wrapper_fn, outputs=out)
demo.launch()

but you can fix it by adding wrapper_fn.zerogpu = True like this:

import gradio as gr
import spaces


@spaces.GPU(duration=181)
def inner_fn():
    return "test"


def wrapper_fn():
    return inner_fn()


wrapper_fn.zerogpu = True


with gr.Blocks() as demo:
    btn = gr.Button()
    out = gr.Textbox()
    btn.click(fn=wrapper_fn, outputs=out)
demo.launch()

i see. will try to take some actions

I got limited quota plzz I need to do more images it very good

I'm also having those issues with limited quota. I also tried to duplicate the repo, but no success in applying the secrets variables.

I also have the same zero GPU quota issue. Kindly solve this ASAP

I also have the same zero GPU quota issue. Kindly solve this ASAP

I love your working brother ๐Ÿซ‚ please ๐Ÿฅบ fix the GPU stuffs we love you so much ๐Ÿ’‹โค๏ธ

i added a line of code like "wrapper_fn.zerogpu = True" if that also works with gradio 4 then it should work. or i am not sure

i somewhat generated 10 images in about 5 minutes so it should be okay now but idk if there is other problems

okay i think i get it right
image.png
i can see it record my usage correctly and apparently it is more than 5 mins

Awesome! Thanks for the update!

hysts changed discussion status to closed

Sign up or log in to comment