Apply for community grant: Academic project (gpu)

#1
by limingcv - opened

This space is designed for paper ControlNet++: Improving Conditional Controls with Efficient Consistency Feedback. We kindly request a T4 GPU to run our demo.

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

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

Thank you so much for your generous help! I am currently modifying the relevant code, and I will convert space to public after improvement.

I'm seeing the following error in your Space.

Traceback (most recent call last):
  File "/home/user/app/app.py", line 14, in <module>
    from model import Model
  File "/home/user/app/model.py", line 8, in <module>
    from controlnet_aux.util import HWC3
  File "/usr/local/lib/python3.10/site-packages/controlnet_aux/__init__.py", line 7, in <module>
    from .midas import MidasDetector
  File "/usr/local/lib/python3.10/site-packages/controlnet_aux/midas/__init__.py", line 11, in <module>
    from .api import MiDaSInference
  File "/usr/local/lib/python3.10/site-packages/controlnet_aux/midas/api.py", line 9, in <module>
    from .midas.dpt_depth import DPTDepthModel
  File "/usr/local/lib/python3.10/site-packages/controlnet_aux/midas/midas/dpt_depth.py", line 6, in <module>
    from .blocks import (
  File "/usr/local/lib/python3.10/site-packages/controlnet_aux/midas/midas/blocks.py", line 4, in <module>
    from .vit import (
  File "/usr/local/lib/python3.10/site-packages/controlnet_aux/midas/midas/vit.py", line 3, in <module>
    import timm
  File "/usr/local/lib/python3.10/site-packages/timm/__init__.py", line 2, in <module>
    from .layers import is_scriptable, is_exportable, set_scriptable, set_exportable
  File "/usr/local/lib/python3.10/site-packages/timm/layers/__init__.py", line 7, in <module>
    from .classifier import ClassifierHead, create_classifier, NormMlpClassifierHead
  File "/usr/local/lib/python3.10/site-packages/timm/layers/classifier.py", line 14, in <module>
    from .create_act import get_act_layer
  File "/usr/local/lib/python3.10/site-packages/timm/layers/create_act.py", line 8, in <module>
    from .activations_me import *
  File "/usr/local/lib/python3.10/site-packages/timm/layers/activations_me.py", line 105, in <module>
    def hard_sigmoid_jit_bwd(x, grad_output):
  File "/usr/local/lib/python3.10/site-packages/torch/jit/_script.py", line 1341, in script
    fn = torch._C._jit_script_compile(
  File "/usr/local/lib/python3.10/site-packages/torch/jit/annotations.py", line 71, in get_signature
    signature = try_real_annotations(fn, loc)
  File "/usr/local/lib/python3.10/site-packages/torch/jit/annotations.py", line 278, in try_real_annotations
    arg_types = [ann_to_type(p.annotation, loc)
  File "/usr/local/lib/python3.10/site-packages/torch/jit/annotations.py", line 278, in <listcomp>
    arg_types = [ann_to_type(p.annotation, loc)
  File "/usr/local/lib/python3.10/site-packages/torch/jit/annotations.py", line 422, in ann_to_type
    raise ValueError(f"Unknown type annotation: '{ann}' at {loc.highlight()}")
ValueError: Unknown type annotation: 'Any' at   File "/usr/local/lib/python3.10/site-packages/timm/layers/activations_me.py", line 106


@torch

	.jit.script
def hard_sigmoid_jit_bwd(x, grad_output):
    m = torch.ones_like(x) * ((x >= -3.) & (x <= 3.)) / 6.
        ~~~~~~~~~~~~~~~ <--- HERE
    return grad_output * m

I think you can avoid this error by replacing torch.jit.script with a function that does nothing before importing timm like this:

import torch

torch.jit.script = lambda f: f

Thanks for your help! But there's a weird bug that I haven't encountered on the T4 GPU. Could you please take a look at the errors now? I can run the demo locally and on the T4 GPU.

image.png

Hi @hysts ,

I specified the version of gradio in requirements.txt, but at the end of each deployment, a 3.46 version was automatically installed for me, causing me to be unable to use Zero GPU normally. Could you please check this problem and give me some suggestions? I really appreciate your help!

image.png

@limingcv Ah, it's kind of confusing (actually, I myself got confused multiple times in the past) but, on HF Spaces, you need to specify your SDK version in README.md. https://huggingface.co/spaces/limingcv/ControlNet-Plus-Plus/blob/43208f4dbefbb6cb4c5170367e53e48e7efaaf15/README.md?code=true#L7
Updating the sdk_version to 4.26.0 should fix your issue.

@limingcv Ah, it's kind of confusing (actually, I myself got confused multiple times in the past) but, on HF Spaces, you need to specify your SDK version in README.md. https://huggingface.co/spaces/limingcv/ControlNet-Plus-Plus/blob/43208f4dbefbb6cb4c5170367e53e48e7efaaf15/README.md?code=true#L7
Updating the sdk_version to 4.26.0 should fix your issue.

Huge thanks for the help! I really appreciate it!

limingcv changed discussion status to closed

Sign up or log in to comment