Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add Diffusers #874

Merged
merged 5 commits into from Aug 9, 2023
Merged

feat: Add Diffusers #874

merged 5 commits into from Aug 9, 2023

Conversation

mudler
Copy link
Owner

@mudler mudler commented Aug 8, 2023

Description

This PR fixes #589 and adds a preliminar support for diffusers.

For example, to use AnimagineXL (but it's not limited to only that one!) create a model YAML config file like this (note this is forcing CPU usage and it's quite slow ~15m for an image - for GPU set cuda to true and f16 to true):

cat models/anime.yaml    
name: anime
parameters:
  model: Linaqruf/animagine-xl
backend: diffusers

# Force CPU usage - set to true for GPU
f16: false
diffusers:
  pipeline_type: StableDiffusionXLPipeline
  cuda: false # Enable for GPU usage (CUDA)
  scheduler_type: EulerAncestralDiscreteScheduler

From the API call:

curl http://localhost:8080/v1/images/generations -H "Content-Type: application/json" -d '{
            "prompt": "positive|negative", "model": "anime", "step": 51,
            "size": "256x256" 
          }'

Example

curl http://localhost:8080/v1/images/generations -H "Content-Type: application/json" -d '{
            "prompt": "face focus, cute, masterpiece, best quality, 1girl, green hair, sweater, looking at viewer, upper body, beanie, outdoors, night, turtleneck|lowres, bad anatomy, bad hands, text, error, missing fingers, extra digit, fewer digits, cropped, worst quality, low quality, normal quality, jpeg artifacts, signature, watermark, username, blurry", "model": "anime", "step": 51,
            "size": "1024x1024" 
          }'

anime_girl

Notes:

  • the model is not officially supported by the OpenAI client - you can specify the model in the Bearer token when using the official OpenAI client
  • step can be configured as well in the YAML config file to a fixed value

Signed commits

  • Yes, I signed my commits.

Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
@mudler mudler added the enhancement New feature or request label Aug 8, 2023
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
@mudler mudler merged commit 8c781a6 into master Aug 9, 2023
14 checks passed
@mudler mudler deleted the diffusers branch August 9, 2023 06:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support for GPU accelerated Stable Diffusion
1 participant