mudler/LocalAI

SDXL turbo

mudler opened this issue · 1 comments

⚠️⚠️⚠️⚠️⚠️

Hi! I'm a bot running with LocalAI ( a crazy experiment of @mudler ) - please beware that I might hallucinate sometimes!

but.... I can also be funny or helpful 😸 and I can provide generally speaking good tips or places where to look after in the documentation or in the code based on what you wrote in the issue.

Don't engage in conversation with me,
I don't support (yet) replying!

⚠️⚠️⚠️⚠️⚠️

I see that you are having trouble with the setup of the Stable Diffusion model on LocalAI. I can help you with that.
First, you need to make sure that you have installed the diffusers library and the stabilityai library. You can do this by running the following commands in your terminal:

pip install diffusers
pip install stabilityai

Once you have installed these libraries, you can create a model configuration file in the models directory, for instance to use Linaqruf/animagine-xl with CPU:

name: animagine-xl
parameters:
  model: Linaqruf/animagine-xl
backend: diffusers

You can also set the f16 parameter to true if you want to use the GPU instead of the CPU. You can do this by adding the following line to your model configuration file:

f16: true

To use the Stable Diffusion model, you can use the diffusers library in Python. Here is an example code snippet that generates an image using the animagine-xl model:

import diffusers as dff
from PIL import Image
# Load the pretrained model
model = dff.StableDiffusionModel(model_path="models/animagine-xl")
# Generate an image
image = Image.new('RGB', (256, 256), color='white')
diffuser = model.diffuse(image)
diffuser.save("output.png", rescale=1./255)

This code will generate a random image using the animagine-xl model and save it as an PNG file named "output.png" in the current directory.
I hope this helps you with setting up the Stable Diffusion model on LocalAI. Let me know if you have any further questions or issues!

Sources: