Run this model with HF Jobs

Run stabilityai/stable-diffusion-3.5-medium on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.

Paste one of these prompts into your coding agent:

Fine-tune on my dataset

Use HF Jobs to fine-tune https://huggingface.co/stabilityai/stable-diffusion-3.5-medium. Ask me which dataset to train on, then push the fine-tuned model to a new private model repo. Run `hf jobs --help` first to learn the CLI.

Run batch inference

Use HF Jobs to run batch inference with https://huggingface.co/stabilityai/stable-diffusion-3.5-medium on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.

local Lora not loading

#7
by LolaRoseHB - opened

My local Lora is not loading. Here's the code :

from diffusers import StableDiffusion3Pipeline
import torch

model_id = "stabilityai/stable-diffusion-3.5-medium"

pipe = StableDiffusion3Pipeline.from_pretrained(
model_id,
low_cpu_mem_usage=False,
text_encoder_3=None,
tokenizer_3=None,
torch_dtype=torch.float32,
use_safetensors=True
)

lora = "my_sd35_lora"

pipe.load_lora_weights(
"/path/to/lora",
weight_name="my_sd35_lora.safetensors",
adapter_name=lora
)

pipe.set_adapters([lora], adapter_weights=[1.0])
pipe.fuse_lora()

image = pipe(
prompt="this is a prompt",
num_inference_steps=30
).images[0]

image.save("my_image.png", format="PNG")

EDIT:

I did get a HF (not local) lora working by making these changes.

installed:
pip install protobuf
pip install sentencepiece

added this code to previous example:
from torch import mps
import os

os.environ["PYTORCH_MPS_HIGH_WATERMARK_RATIO"] = "0.0"

pipe = StableDiffusion3Pipeline.from_pretrained(
"stabilityai/stable-diffusion-3.5-medium",
torch_dtype=torch.bfloat16
)

pipe.load_lora_weights(
"hugging-user/hf-SD3.5-LoRA",
weight_name="hf-SD3.5-LoRA.safetensors"
)

pipe.fuse_lora(lora_scale=1.0)
pipe.to("mps")

Sign up or log in to comment