Divooka Reference

Image Generation

7 nodes

On this page 7

Add ControlNet

Function

Adds a ControlNet to steer a picture: Generate Image, Transform Image or Inpaint Image follows its conditioning picture. Chain several to combine them, such as edges and depth.

Signature
AddControlNet -> Control Net Guide
    controlNet: Control Net
    image: Pixel Image
    scale: Number
    start: Number
    end: Number
    guessMode: Truth
    control: Control Net Guide
ControlNetGuide AddControlNet(
    ControlNet controlNet,
    PixelImage image,
    double scale = 0,
    double start = 0,
    double end = 1,
    bool guessMode = false,
    ControlNetGuide control)

Parameters

nametypedefaultdescription
controlNetControl Net—A ControlNet made for the generator's family, from Load ControlNet.
imagePixel Image—The conditioning picture, already processed as the ControlNet expects (an edge map for a canny ControlNet, a depth map, a pose); Generate Image paints at its size, and Transform Image and Inpaint Image need it at their picture's.
scaleNumber0How strongly it steers: 1 fully, less to loosen its hold; 0 for the pipeline's own (1 from text, 0.8 for img2img, 0.5 for Stable Diffusion inpainting, 1 for SDXL inpainting). SDXL ControlNets often want about 0.5.
startNumber0The share of the steps after which it starts to steer: 0 from the first step.
endNumber1The share of the steps after which it stops: 1 to the last step.
guessModeTruthFalseLet the conditioning picture carry the content with little or no prompt; on for every ControlNet of the chain once any asks for it.
controlControl Net Guide—ControlNets already added, to combine with this one.

Returns

ControlControl Net Guide
Ships with
Divooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Image Generation
Package
Machine Learning

Finish With Refiner

Function

Finishes an SDXL picture with SDXL's refiner: the base model paints the first part of the steps and hands its unfinished picture over, and the refiner paints the rest. Give it to Generate Image, Transform Image or Inpaint Image.

Signature
FinishWithRefiner -> Refiner Stage
    refiner: Image Generator
    handOverAt: Number
    aestheticScore: Number
    negativeAestheticScore: Number
RefinerStage FinishWithRefiner(
    ImageGenerator refiner,
    double handOverAt = 0.8,
    double aestheticScore = 6,
    double negativeAestheticScore = 2.5)

Parameters

nametypedefaultdescription
refinerImage Generator—The refiner, loaded by Load Image Generator from stabilityai/stable-diffusion-xl-refiner-1.0 on the base model's device and precision.
handOverAtNumber0.8The share of the steps the base model paints before handing over: 0.8 leaves the refiner the last fifth.
aestheticScoreNumber6The aesthetic score the refiner aims for, on the scale of the LAION ratings it was trained on.
negativeAestheticScoreNumber2.5The score it steers away from, when Guidance is above 1.

Returns

RefinerRefiner Stage
Ships with
Divooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Image Generation
Package
Machine Learning

Generate Image

Function

Paints a picture from a description, optionally following ControlNets and finished by SDXL's refiner.

Signature
GenerateImage -> Pixel Image
    generator: Image Generator
    prompt: Text
    negativePrompt: Text
    width: Integer
    height: Integer
    steps: Integer
    guidance: Number
    seed: Large Integer
    scheduler: Diffusion Scheduler
    control: Control Net Guide
    refiner: Refiner Stage
PixelImage GenerateImage(
    ImageGenerator generator,
    string prompt,
    string negativePrompt,
    int width = 0,
    int height = 0,
    int steps = 0,
    double guidance = -1,
    long seed = 0,
    DiffusionScheduler scheduler = DiffusionScheduler.Default,
    ControlNetGuide control,
    RefinerStage refiner)

Parameters

nametypedefaultdescription
generatorImage Generator—An image generator.
promptText—What the picture shows, such as "a lighthouse at dusk, oil painting".
negativePromptText—What it should not show; used only when Guidance is above 1.
widthInteger0Its width in pixels, a multiple of 8; 0 for the model's own (512 for Stable Diffusion 1.5, 1024 for SDXL), or with Control the control picture's.
heightInteger0Its height in pixels, a multiple of 8; 0 for the model's own, or with Control the control picture's.
stepsInteger0How many denoising steps: 0 for the pipeline's own (50); 20 to 50 suit most models, 1 to 4 Turbo models.
guidanceNumber-1How closely it follows the prompt: below 0 for the pipeline's own (7.5 for Stable Diffusion, 5 for SDXL); 0 for Turbo models.
seedLarge Integer0The starting noise; the same seed and settings give the same picture. Negative for a different one each time.
schedulerDiffusion SchedulerDefaultThe denoising method.
controlControl Net Guide—ControlNets the picture follows, from Add ControlNet.
refinerRefiner Stage—SDXL's refiner to finish the picture, from Finish With Refiner.

Returns

ImagePixel Image
Ships with
Divooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Image Generation
Package
Machine Learning

Inpaint Image

Function

Repaints the part of a picture a mask marks to match a description, and keeps the rest: inpainting, optionally following ControlNets and finished by SDXL's refiner. An inpainting checkpoint fills best; any other model repaints too.

Signature
InpaintImage -> Pixel Image
    generator: Image Generator
    image: Pixel Image
    mask: Pixel Image
    prompt: Text
    negativePrompt: Text
    strength: Number
    steps: Integer
    guidance: Number
    seed: Large Integer
    scheduler: Diffusion Scheduler
    refiner: Refiner Stage
    control: Control Net Guide
PixelImage InpaintImage(
    ImageGenerator generator,
    PixelImage image,
    PixelImage mask,
    string prompt,
    string negativePrompt,
    double strength = 0,
    int steps = 0,
    double guidance = -1,
    long seed = 0,
    DiffusionScheduler scheduler = DiffusionScheduler.Default,
    RefinerStage refiner,
    ControlNetGuide control)

Parameters

nametypedefaultdescription
generatorImage Generator—An image generator.
imagePixel Image—The picture to repaint; the result is its size, whose sides must be multiples of 8.
maskPixel Image—White where to repaint and black where to keep, the picture's size; grey counts from half way.
promptText—What the repainted part shows.
negativePromptText—What it should not show; used only when Guidance is above 1.
strengthNumber0How much of the masked part to change: 1 paints it afresh, less keeps more of what was there and runs that share of the steps; 0 for the pipeline's own (1 for Stable Diffusion, 0.9999 for SDXL).
stepsInteger0How many denoising steps the whole schedule has: 0 for the pipeline's own (50).
guidanceNumber-1How closely it follows the prompt: below 0 for the pipeline's own (7.5; 5 for SDXL with Control).
seedLarge Integer0The starting noise; the same seed and settings give the same picture. Negative for a different one each time.
schedulerDiffusion SchedulerDefaultThe denoising method.
refinerRefiner Stage—SDXL's refiner to finish the repainted part, from Finish With Refiner.
controlControl Net Guide—ControlNets the repainted part follows, from Add ControlNet; their pictures are this picture's size.

Returns

ImagePixel Image
Ships with
Divooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Image Generation
Package
Machine Learning

Load ControlNet

Function

Loads a ControlNet, which makes a picture follow a conditioning picture such as an edge map, a depth map or a pose.

Signature
LoadControlNet -> Control Net
    model: Text
    device: Compute Device
    precision: Precision
    variant: Text
ControlNet LoadControlNet(
    string model,
    ComputeDevice device = ComputeDevice.Auto,
    Precision precision = Precision.Auto,
    string variant)

Parameters

nametypedefaultdescription
modelText—A repository id such as lllyasviel/control_v11p_sd15_canny for Stable Diffusion 1.5 or diffusers/controlnet-canny-sdxl-1.0-small for SDXL, or a folder with its config.json.
deviceCompute DeviceAutoWhere it runs: the generator's device.
precisionPrecisionAutoThe number format of its weights: the generator's precision.
variantText—Which copy of the weights to download, such as fp16 for half-size files; empty for the full ones.

Returns

ModelControl Net
Ships with
Divooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Image Generation
Package
Machine Learning

Load Image Generator

Function

Loads a Stable Diffusion or SDXL pipeline from a Hub repository or a folder in diffusers' layout, with LoRAs when given.

Signature
LoadImageGenerator -> Image Generator
    model: Text
    device: Compute Device
    precision: Precision
    variant: Text
    loras: Text Array
    loraWeights: Number Array
ImageGenerator LoadImageGenerator(
    string model,
    ComputeDevice device = ComputeDevice.Auto,
    Precision precision = Precision.Auto,
    string variant,
    string[] loras,
    double[] loraWeights)

Parameters

nametypedefaultdescription
modelText—A repository id such as stable-diffusion-v1-5/stable-diffusion-v1-5, stabilityai/sdxl-turbo, an inpainting checkpoint such as stable-diffusion-v1-5/stable-diffusion-inpainting or SDXL's refiner stabilityai/stable-diffusion-xl-refiner-1.0, or a folder with model_index.json.
deviceCompute DeviceAutoWhere it runs. A picture takes seconds on a GPU and minutes on a CPU.
precisionPrecisionAutoThe number format of its weights; Auto is Float32 on the CPU and Float16 on the GPU.
variantText—Which copy of the weights to download, such as fp16 for half-size files; empty for the full ones.
lorasText Array—LoRAs to apply: .safetensors files, folders or repository ids, in diffusers', PEFT's or kohya's layout.
loraWeightsNumber Array—How strongly each LoRA applies, in the same order; 1 when not given.

Returns

GeneratorImage Generator
Ships with
Divooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Image Generation
Package
Machine Learning

Transform Image

Function

Repaints a picture to match a description, keeping its composition: img2img, optionally following ControlNets and finished by SDXL's refiner.

Signature
TransformImage -> Pixel Image
    generator: Image Generator
    image: Pixel Image
    prompt: Text
    negativePrompt: Text
    strength: Number
    steps: Integer
    guidance: Number
    seed: Large Integer
    scheduler: Diffusion Scheduler
    control: Control Net Guide
    refiner: Refiner Stage
PixelImage TransformImage(
    ImageGenerator generator,
    PixelImage image,
    string prompt,
    string negativePrompt,
    double strength = 0,
    int steps = 0,
    double guidance = -1,
    long seed = 0,
    DiffusionScheduler scheduler = DiffusionScheduler.Default,
    ControlNetGuide control,
    RefinerStage refiner)

Parameters

nametypedefaultdescription
generatorImage Generator—An image generator.
imagePixel Image—The picture to start from; the result is its size, whose sides must be multiples of 8.
promptText—What the result shows.
negativePromptText—What it should not show; used only when Guidance is above 1.
strengthNumber0How much to change: 1 ignores the picture, less keeps more of it and runs that share of the steps; 0 for the pipeline's own (0.8 for Stable Diffusion; 0.3 for SDXL, 0.8 with Control).
stepsInteger0How many denoising steps the whole schedule has: 0 for the pipeline's own (50).
guidanceNumber-1How closely it follows the prompt: below 0 for the pipeline's own (7.5 for Stable Diffusion, 5 for SDXL); 0 for Turbo models.
seedLarge Integer0The added noise; the same seed and settings give the same picture. Negative for a different one each time.
schedulerDiffusion SchedulerDefaultThe denoising method.
controlControl Net Guide—ControlNets the picture follows, from Add ControlNet; their pictures are this picture's size.
refinerRefiner Stage—SDXL's refiner to finish the picture, from Finish With Refiner; not together with Control.

Returns

ImagePixel Image
Ships with
Divooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Image Generation
Package
Machine Learning