kaito icon indicating copy to clipboard operation
kaito copied to clipboard

feat: Stable Diffusion

Open ishaansehgal99 opened this issue 1 year ago • 1 comments

Currently this just supports text-to-image. Not Image Inpainting, Super-Resolution or Depth-to-Image

Need these dependencies on machine:

RUN apt-get update && apt-get install ffmpeg libsm6 libxext6  -y

Accelerate launch:

CUDA_VISIBLE_DEVICES="0" accelerate launch --num_processes 1 --num_machines 1 --machine_rank 0  inference_api.py --pretrained_model_name_or_path <MODEL_NAME>

Curl command

curl -X POST "http://localhost:5000/generate?prompt="microsoft%20employee%20riding%20a%20horse%20on%20mars"" > output.png

Example:

CUDA_VISIBLE_DEVICES="0" accelerate launch --num_processes 1 --num_machines 1 --machine_rank 0  an_inference.py --pretrained_model_name_or_path stabilityai/stable-diffusion-xl-base-1.0 --allow_remote_files --torch_dtype=float16 --use_safetensors --variant="fp16"

API Requests:

curl -X POST "http://localhost:5000/generate?prompt=astronaut%20riding%20a%20horse%20on%20mars%20eating%20a%20pizza" > output.png

image

curl -X POST "http://localhost:5000/generate?prompt=Kubernetes%20cluster%20orchestrating%20a%20dance%20party%20for%20AI-powered%20robots%20on%20a%20cloud" > output.png

image

curl -X POST "http://localhost:5000/generate?prompt=Microsoft%20engineer%20enjoying%20a%20lively%20celebration%20with%20their%20team%20at%20KubeCon,%20animated%20cartoon" > output.png

output

ishaansehgal99 avatar Mar 06 '24 07:03 ishaansehgal99

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 65.33%. Comparing base (de2b45c) to head (5d64ade). Report is 45 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #282      +/-   ##
==========================================
+ Coverage   65.27%   65.33%   +0.06%     
==========================================
  Files          14       14              
  Lines        1123     1125       +2     
==========================================
+ Hits          733      735       +2     
  Misses        352      352              
  Partials       38       38              

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar Mar 06 '24 07:03 codecov[bot]