Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent gradio_client from sending out of range value for gr.Slider #3878

Open
1 task done
hysts opened this issue Apr 16, 2023 · 2 comments
Open
1 task done

Prevent gradio_client from sending out of range value for gr.Slider #3878

hysts opened this issue Apr 16, 2023 · 2 comments
Labels
enhancement New feature or request

Comments

@hysts
Copy link
Collaborator

hysts commented Apr 16, 2023

  • I have searched to see if a similar issue already exists.

When using gr.Slider, users can restrict the possible input values with minimum, maximum, step. For example, we can limit the value to multiples of 5 from 0 to 100 by doing gr.Slider(minimum=0, maximum=100, step=5, value=0), but currently Client can send arbitrary values, like 1000000 or 1.23, ignoring this restriction.
This is problematic, for example, when the batch size is set with gr.Slider. Client can send a value like 100, which would probably cause GPU OOM and crash the Space. Once GPU OOM occurs, a Space will stop working properly until manually restarted.
I guess Space developers can add some logic in their functions to reject unacceptable values, but it will increase their work. So, it would be nice if it was taken care of on gradio side.

@abidlabs abidlabs added the enhancement New feature or request label Apr 16, 2023
@abidlabs abidlabs mentioned this issue May 2, 2023
7 tasks
@freddyaboulton
Copy link
Collaborator

I don't think the best fix is at the client level. Even if you set steps in the app, the front-end won't prevent you from typing a value for the slider that's out of range or incorrect precision.

image

I think the better approach is to tackle #2718 and then if the client sends a request with an invalid value it will automatically fail.

@abidlabs abidlabs added the gradio_client Related to the one of the gradio client libraries label Feb 11, 2024
@hannahblair hannahblair removed the gradio_client Related to the one of the gradio client libraries label May 23, 2024
@hannahblair
Copy link
Collaborator

Removing the gradio_client tag in light of @freddyaboulton's comment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants