diffusers / controlnet-depth-sdxl-1.0

huggingface.co
Total runs: 35.9K
24-hour runs: 0
7-day runs: 3.7K
30-day runs: 15.6K
Model's Last Updated: April 24 2024
text-to-image

Introduction of controlnet-depth-sdxl-1.0

Model Details of controlnet-depth-sdxl-1.0

SDXL-controlnet: Depth

These are controlnet weights trained on stabilityai/stable-diffusion-xl-base-1.0 with depth conditioning. You can find some example images in the following.

prompt: spiderman lecture, photorealistic images_0)

Usage

Make sure to first install the libraries:

pip install accelerate transformers safetensors diffusers

And then we're ready to go:

import torch
import numpy as np
from PIL import Image

from transformers import DPTFeatureExtractor, DPTForDepthEstimation
from diffusers import ControlNetModel, StableDiffusionXLControlNetPipeline, AutoencoderKL
from diffusers.utils import load_image


depth_estimator = DPTForDepthEstimation.from_pretrained("Intel/dpt-hybrid-midas").to("cuda")
feature_extractor = DPTFeatureExtractor.from_pretrained("Intel/dpt-hybrid-midas")
controlnet = ControlNetModel.from_pretrained(
    "diffusers/controlnet-depth-sdxl-1.0",
    variant="fp16",
    use_safetensors=True,
    torch_dtype=torch.float16,
)
vae = AutoencoderKL.from_pretrained("madebyollin/sdxl-vae-fp16-fix", torch_dtype=torch.float16)
pipe = StableDiffusionXLControlNetPipeline.from_pretrained(
    "stabilityai/stable-diffusion-xl-base-1.0",
    controlnet=controlnet,
    vae=vae,
    variant="fp16",
    use_safetensors=True,
    torch_dtype=torch.float16,
)
pipe.enable_model_cpu_offload()

def get_depth_map(image):
    image = feature_extractor(images=image, return_tensors="pt").pixel_values.to("cuda")
    with torch.no_grad(), torch.autocast("cuda"):
        depth_map = depth_estimator(image).predicted_depth

    depth_map = torch.nn.functional.interpolate(
        depth_map.unsqueeze(1),
        size=(1024, 1024),
        mode="bicubic",
        align_corners=False,
    )
    depth_min = torch.amin(depth_map, dim=[1, 2, 3], keepdim=True)
    depth_max = torch.amax(depth_map, dim=[1, 2, 3], keepdim=True)
    depth_map = (depth_map - depth_min) / (depth_max - depth_min)
    image = torch.cat([depth_map] * 3, dim=1)

    image = image.permute(0, 2, 3, 1).cpu().numpy()[0]
    image = Image.fromarray((image * 255.0).clip(0, 255).astype(np.uint8))
    return image


prompt = "stormtrooper lecture, photorealistic"
image = load_image("https://huggingface.co/lllyasviel/sd-controlnet-depth/resolve/main/images/stormtrooper.png")
controlnet_conditioning_scale = 0.5  # recommended for good generalization

depth_image = get_depth_map(image)

images = pipe(
    prompt, image=depth_image, num_inference_steps=30, controlnet_conditioning_scale=controlnet_conditioning_scale,
).images
images[0]

images[0].save(f"stormtrooper.png")

For more details, check out the official documentation of StableDiffusionXLControlNetPipeline .

Training

Our training script was built on top of the official training script that we provide here .

Training data and Compute

The model is trained on 3M image-text pairs from LAION-Aesthetics V2. The model is trained for 700 GPU hours on 80GB A100 GPUs.

Batch size

Data parallel with a single GPU batch size of 8 for a total batch size of 256.

Hyper Parameters

The constant learning rate of 1e-5.

Mixed precision

fp16

Runs of diffusers controlnet-depth-sdxl-1.0 on huggingface.co

35.9K
Total runs
0
24-hour runs
1.6K
3-day runs
3.7K
7-day runs
15.6K
30-day runs

More Information About controlnet-depth-sdxl-1.0 huggingface.co Model

More controlnet-depth-sdxl-1.0 license Visit here:

https://choosealicense.com/licenses/openrail++

controlnet-depth-sdxl-1.0 huggingface.co

controlnet-depth-sdxl-1.0 huggingface.co is an AI model on huggingface.co that provides controlnet-depth-sdxl-1.0's model effect (), which can be used instantly with this diffusers controlnet-depth-sdxl-1.0 model. huggingface.co supports a free trial of the controlnet-depth-sdxl-1.0 model, and also provides paid use of the controlnet-depth-sdxl-1.0. Support call controlnet-depth-sdxl-1.0 model through api, including Node.js, Python, http.

controlnet-depth-sdxl-1.0 huggingface.co Url

https://huggingface.co/diffusers/controlnet-depth-sdxl-1.0

diffusers controlnet-depth-sdxl-1.0 online free

controlnet-depth-sdxl-1.0 huggingface.co is an online trial and call api platform, which integrates controlnet-depth-sdxl-1.0's modeling effects, including api services, and provides a free online trial of controlnet-depth-sdxl-1.0, you can try controlnet-depth-sdxl-1.0 online for free by clicking the link below.

diffusers controlnet-depth-sdxl-1.0 online free url in huggingface.co:

https://huggingface.co/diffusers/controlnet-depth-sdxl-1.0

controlnet-depth-sdxl-1.0 install

controlnet-depth-sdxl-1.0 is an open source model from GitHub that offers a free installation service, and any user can find controlnet-depth-sdxl-1.0 on GitHub to install. At the same time, huggingface.co provides the effect of controlnet-depth-sdxl-1.0 install, users can directly use controlnet-depth-sdxl-1.0 installed effect in huggingface.co for debugging and trial. It also supports api for free installation.

controlnet-depth-sdxl-1.0 install url in huggingface.co:

https://huggingface.co/diffusers/controlnet-depth-sdxl-1.0

Url of controlnet-depth-sdxl-1.0

controlnet-depth-sdxl-1.0 huggingface.co Url

Provider of controlnet-depth-sdxl-1.0 huggingface.co

diffusers
ORGANIZATIONS

Other API from diffusers

huggingface.co

Total runs: 5.7K
Run Growth: 1.3K
Growth Rate: 22.12%
Updated: February 08 2023
huggingface.co

Total runs: 5.3K
Run Growth: -856
Growth Rate: -10.61%
Updated: October 22 2024
huggingface.co

Total runs: 16
Run Growth: 3
Growth Rate: 18.75%
Updated: February 07 2024
huggingface.co

Total runs: 12
Run Growth: -23
Growth Rate: -191.67%
Updated: January 27 2023
huggingface.co

Total runs: 1
Run Growth: -1
Growth Rate: -100.00%
Updated: March 14 2023