| | --- |
| | license: other |
| | license_name: tencent-hunyuan-community |
| | license_link: https://huggingface.co/Tencent-Hunyuan/HunyuanDiT/blob/main/LICENSE.txt |
| | --- |
| | ```py |
| | from diffusers import HunyuanDiT2DControlNetModel, HunyuanDiTControlNetPipeline |
| | import torch |
| | controlnet = HunyuanDiT2DControlNetModel.from_pretrained("Tencent-Hunyuan/HunyuanDiT-v1.1-ControlNet-Diffusers-Depth", torch_dtype=torch.float16) |
| | |
| | pipe = HunyuanDiTControlNetPipeline.from_pretrained("Tencent-Hunyuan/HunyuanDiT-v1.1-Diffusers", controlnet=controlnet, torch_dtype=torch.float16) |
| | pipe.to("cuda") |
| | |
| | from diffusers.utils import load_image |
| | cond_image = load_image('https://huggingface.co/Tencent-Hunyuan/HunyuanDiT-v1.1-ControlNet-Diffusers-Depth/resolve/main/depth.jpg?download=true') |
| | |
| | ## You may also use English prompt as HunyuanDiT supports both English and Chinese |
| | prompt = "在茂密的森林中,一只黑白相间的熊猫静静地坐在绿树红花中,周围是山川和海洋。背景是白天的森林,光线充足" |
| | # prompt = "In the dense forest, a black and white panda sits quietly in green trees and red flowers, surrounded by mountains, rivers, and the ocean. The background is the forest in a bright environment." |
| | image = pipe( |
| | prompt, |
| | height=1024, |
| | width=1024, |
| | control_image=cond_image, |
| | num_inference_steps=50, |
| | ).images[0] |
| | ``` |