jbilcke-hf/sdxl-panorama

jbilcke-hf
Texto a imagen

LoRA para Stable Diffusion XL orientado a generar imágenes panorámicas, especialmente vistas HDRI y composiciones anchas. Está basado en stabilityai/stable-diffusion-xl-base-1.0 y se recomienda usarlo con resolución 1024x512.

Como usar

Instalación y uso básico con Diffusers:

pip install -U diffusers transformers accelerate

import torch
from diffusers import DiffusionPipeline

# switch to "mps" for apple devices
pipe = DiffusionPipeline.from_pretrained("stabilityai/stable-diffusion-xl-base-1.0", dtype=torch.bfloat16, device_map="cuda")
pipe.load_lora_weights("jbilcke-hf/sdxl-panorama")

prompt = ""
image = pipe(prompt).images[0]

Inferencia con Replicate:

pip install replicate
export REPLICATE_API_TOKEN=r8_*************************************

import replicate

output = replicate.run(
  "sdxl-panorama@sha256:fd1f53277a424000168dfceeef58934c43bb3c27a3843a75e7b6d72c46cfc8fa",
  input={"prompt": "hdri view, a nice house in London, in the style of TOK"}
)
print(output)

Uso avanzado con Diffusers, LoRA y embeddings:

pip install diffusers transformers accelerate safetensors huggingface_hub
git clone https://github.com/replicate/cog-sdxl cog_sdxl

import torch
from huggingface_hub import hf_hub_download
from diffusers import DiffusionPipeline
from cog_sdxl.dataset_and_utils import TokenEmbeddingsHandler
from diffusers.models import AutoencoderKL

pipe = DiffusionPipeline.from_pretrained(
    "stabilityai/stable-diffusion-xl-base-1.0",
    torch_dtype=torch.float16,
    variant="fp16",
).to("cuda")

pipe.load_lora_weights("jbilcke-hf/sdxl-panorama", weight_name="lora.safetensors")

text_encoders = [pipe.text_encoder, pipe.text_encoder_2]
tokenizers = [pipe.tokenizer, pipe.tokenizer_2]
embedding_path = hf_hub_download(repo_id="jbilcke-hf/sdxl-panorama", filename="embeddings.pti", repo_type="model")

embhandler = TokenEmbeddingsHandler(text_encoders, tokenizers)
embhandler.load_embeddings(embedding_path)

prompt="hdri view, a nice house in London, in the style of "
images = pipe(
    prompt,
    cross_attention_kwargs={"scale": 0.8},
).images

#your output image
images[0]

Funcionalidades

Generación texto-a-imagen con Stable Diffusion XL.
Adaptador LoRA entrenado para resultados panorámicos.
Compatible con Diffusers y pesos lora.safetensors.
Soporte de inferencia mediante proveedor fal-ai/fast-sdxl.
Incluye flujo alternativo con Replicate y carga de embeddings de Pivotal Tuning/Textual Inversion.

Casos de uso

Crear panoramas anchos a partir de prompts de texto.
Generar vistas HDRI o escenas arquitectónicas panorámicas.
Producir fondos, entornos o assets visuales en formato horizontal para diseño, juegos o prototipos.
Experimentar con LoRA sobre SDXL usando Diffusers, Replicate o proveedores de inferencia.