Skip to content

Commit

Permalink
fix(api): silence controlnet registration warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
ssube committed Dec 22, 2023
1 parent 2546084 commit ccff9a3
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 15 deletions.
4 changes: 4 additions & 0 deletions api/onnx_web/convert/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@
"ignore",
".*Converting a tensor to a Python boolean might cause the trace to be incorrect.*",
)
warnings.filterwarnings(
"ignore",
".*Overwriting tiny_vit_.*",
)

logger = getLogger(__name__)

Expand Down
39 changes: 24 additions & 15 deletions api/onnx_web/image/source_filter.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,29 @@
# https://github.com/ForserX/StableDiffusionUI/blob/main/data/repo/diffusion_scripts/controlnet_pipe.py

from logging import getLogger
from os import path

import cv2
import numpy as np
import torch
import transformers
from controlnet_aux import HEDdetector, MLSDdetector, OpenposeDetector
from huggingface_hub import snapshot_download
from PIL import Image, ImageChops, ImageFilter

from ..server.context import ServerContext
from .ade_palette import ade_palette
from .laion_face import generate_annotation
from .noise_source import noise_source_histogram
import warnings

warnings.filterwarnings(
"ignore",
".*Overwriting tiny_vit_.*",
)

# from https://stackoverflow.com/a/65418681
if True: # noqa: E402
from logging import getLogger
from os import path

import cv2
import numpy as np
import torch
import transformers
from controlnet_aux import HEDdetector, MLSDdetector, OpenposeDetector
from huggingface_hub import snapshot_download
from PIL import Image, ImageChops, ImageFilter

from ..server.context import ServerContext
from .ade_palette import ade_palette
from .laion_face import generate_annotation
from .noise_source import noise_source_histogram

logger = getLogger(__name__)

Expand Down

0 comments on commit ccff9a3

Please sign in to comment.