How to load this model?
#2
by
Saugatkafley
- opened
I wanted to run and see this mdoel in action. How do I run, it says: OSError: nerijs/pixel-art-xl does not appear to have a file named model_index.json.
This seems to work
import torch
from diffusers import DiffusionPipeline
base_model_id = "stabilityai/stable-diffusion-xl-base-1.0"
pipe = DiffusionPipeline.from_pretrained(base_model_id).to("cuda")
pipe.load_lora_weights("nerijs/pixel-art-xl", weight_name="pixel-art-xl.safetensors")
image = pipe( "pixel art, modern computer, simple").images[0]
image.save("computer.png")
Alvanlii's code is very helpful to me, and can save memory with 16 precision for computers with poor performance:
import torch
from diffusers import DiffusionPipeline
base_model_id = "stabilityai/stable-diffusion-xl-base-1.0"
pipe = DiffusionPipeline.from_pretrained(base_model_id, variant="fp16", torch_dtype=torch.float16).to("cuda")
pipe.load_lora_weights("nerijs/pixel-art-xl", weight_name="pixel-art-xl.safetensors")
image = pipe( "pixel art, modern computer, simple").images[0]
image.save("computer.png")
Can you share the code to load the model locally from the previously downloaded .safetensors
file?