infer_stable_cascade

infer_stable_cascade

About

1.0.0
Custom license

Stable Cascade is a diffusion model trained to generate images given a text prompt.

Task: Image generation
Stable Diffusion
Hugging Face
Stability-AI
text-to-image
Generative

Stable Cascade is a diffusion model trained to generate images given a text prompt. The Stable Cascade algorithm needs 17 GB of VRAM to run.

SD cascade

🚀 Use with Ikomia API

1. Install Ikomia API

We strongly recommend using a virtual environment. If you're not sure where to start, we offer a tutorial here.

pip install ikomia

2. Create your workflow

from ikomia.dataprocess.workflow import Workflow
from ikomia.utils.displayIO import display

# Init your workflow
wf = Workflow()

# Add algorithm
algo = wf.add_task(name = "infer_stable_cascade", auto_connect=False)

# Run directly on your image
wf.run()

# Display the image
display(algo.get_output(0).get_image())

☀️ Use with Ikomia Studio

Ikomia Studio offers a friendly UI with the same features as the API.

  • If you haven't started using Ikomia Studio yet, download and install it from this page.
  • For additional guidance on getting started with Ikomia Studio, check out this blog post.

📝 Set algorithm parameters

  • prompt (str) - default 'Anthropomorphic cat dressed as a pilot' : Text prompt to guide the image generation .
  • negative_prompt (str, optional) - default '': The prompt not to guide the image generation. Ignored when not using guidance (i.e., ignored if guidance_scale is less than 1).
  • prior_num_inference_steps (int) - default '20': Stage B timesteps.
  • prior_guidance_scale (float) - default '4.0': Higher guidance scale encourages to generate images that are closely linked to the text prompt, usually at the expense of lower image quality. (minimum: 1; maximum: 20).
  • num_inference_steps (int) - default '30': Stage C timesteps
  • guidance_scale (float) - default '0.0': Higher guidance scale encourages to generate images that are closely linked to the text prompt, usually at the expense of lower image quality. (minimum: 1; maximum: 20).
  • height (int) - default '1024': The height in pixels of the generated image.
  • width (int) - default '1024': The width in pixels of the generated image.
  • num_images_per_prompt (int) - default '1': Number of generated image(s).
  • seed (int) - default '-1': Seed value. '-1' generates a random number between 0 and 191965535.
from ikomia.dataprocess.workflow import Workflow
from ikomia.utils.displayIO import display

# Init your workflow
wf = Workflow()

# Add algorithm
algo = wf.add_task(name = "infer_stable_cascade", auto_connect=False)

algo.set_parameters({
    'prompt': 'Anthropomorphic cat dressed as a pilot',
    'negative_prompt': '',
    'prior_num_inference_steps': '20',
    'prior_guidance_scale': '4.0',
    'num_inference_steps': '30',
    'guidance_scale': '0.0',
    'seed': '-1',
    'width': '1024',
    'height': '1024',
    'num_images_per_prompt':'1',
    })

# Generate your image
wf.run()

# Display the image
display(algo.get_output(0).get_image())

🔍 Explore algorithm outputs

Every algorithm produces specific outputs, yet they can be explored them the same way using the Ikomia API. For a more in-depth understanding of managing algorithm outputs, please refer to the documentation.

from ikomia.dataprocess.workflow import Workflow

# Init your workflow
wf = Workflow()

# Add algorithm
algo = wf.add_task(name="infer_stable_cascade", auto_connect=False)

# Run  
wf.run()

# Iterate over outputs
for output in algo.get_outputs():
    # Print information
    print(output)
    # Export it to JSON
    output.to_json()

Developer

  • Ikomia
    Ikomia