潜在桥匹配(LBM)是一种新颖、多功能且可扩展的方法,在《LBM:用于快速图像到图像转换的潜在桥匹配》中提出,该方法依赖于潜在空间中的桥匹配来实现快速的图像到图像转换。该模型经过训练,可以根据提供的背景重新照亮前景对象。请查看我们的实时演示和官方Github仓库。
如何使用?
要使用此模型,您首先需要通过运行以下命令安装相关的 lbm 库
pip install git+https://github.com/gojasper/LBM.git
然后,你可以在输入图像上使用模型进行推理。
import torch
from diffusers.utils import load_image
from lbm.inference import evaluate, get_model
# Load model
model = get_model(
"jasperai/LBM_relighting",
torch_dtype=torch.bfloat16,
device="cuda",
)
# Load a source image
source_image = load_image(
"https://huggingface.co/jasperai/LBM_relighting/resolve/main/assets/source_image.jpg"
)
# Perform inference
output_image = evaluate(model, source_image, num_sampling_steps=1)
output_image