Apply for community grant: Academic project (gpu)

#1
by Chaerin5 - opened

We propose a large generative model for hands. This includes generating hand images given hand poses and fixing malformed AI generated hands, and even more. But we would need gpu to host this service. More information can be found at our paper https://arxiv.org/abs/2412.02690 and website https://ivl.cs.brown.edu/research/foundhand.html Thank you!

Hi @Chaerin5 , we've assigned ZeroGPU to this Space. Please check the compatibility and usage sections of this page so your Space can run on ZeroGPU.

@hysts Thank you so much for the ZeroGPU! We are trying to setup the space with ZeroGPU, but it gives me this error.
GPU task aborted
We already tried duration=120 and did .to("cuda"), but didn't work. Could you please help me with this?🥺

@Chaerin5 The error is raised when the function decorated with @spaces.GPU takes longer than the specified duration. What's the expected execution time? Is it longer than 120 seconds?

Looks like the error is raised after 10 seconds or something when clicking the crop button in 1. As this Space is using private models, I can't check it on my end, but you might want to check where exactly the error is raised first.

@hysts Thanks for your comments! I fixed the GPU task aborted error. It looks like the Mediapipe was not compatible with the ZeroGPU.

But I got another problem at this line of my code:
If I do image.to("cuda"), it give the following error
      CUDA must not be initialized in the main process on Spaces with Stateless GPU environment
However, if I don't do image.to("cuda"), it gives me the error below.
      Input type (torch.FloatTensor) and weight type (torch.cuda.FloatTensor) should be the same or input should be a MKLDNN tensor and weight is a dense tensor

What is the best practice of moving the input tensors to the cuda device? Could you please help me with this?

@Chaerin5
Nice! Thanks for looking into it.

As for the new error, I'm not 100% sure, but I think that's because you are decorating a function defined inside another function.
Can you try moving https://huggingface.co/spaces/Chaerin5/FoundHand/blob/32ecde5ddd92139a4c9c08320874c9866dd075be/app.py#L325-L332 outside of https://huggingface.co/spaces/Chaerin5/FoundHand/blob/32ecde5ddd92139a4c9c08320874c9866dd075be/app.py#L259 ?

It works right now. Thank you so much for your support!

Chaerin5 changed discussion status to closed

Sign up or log in to comment