Skip to Content
StepsImage Generation

Image Generation (ImageGenerator)

ImageGenerator steps in flows let you produce images using a base model or a previously trained model. You can leverage prompts, negative prompts, and a variety of configuration options to fine-tune the generation process.

You can also directly generate images on the Inferences area of the dashboard. There you may also create an inference pack for testing or reproducibility purposes.

Use a trained model by specifying a trainingId along with a base model (we recommend using the same base model used for the training). Or only provide a baseModel to generate images from a publicly available Hugging Face model.

Flow examples

Generating images based on the user’s input

In this example, the user will be asked to enter a genre (promptType). The flow will use it to generate a list of 40 prompts, which will be provided to the ImageGenerator step.

"title": "Let's generate images!", "description": "Generate images", "input": { "type": "object", "required": [ "promptType" ], "properties": { "promptType": { "type": "string", "title": "What kind of prompts", "maxLength": 1000, "minLength": 4, "description": "Describe what kinds of prompts you want to generate.", "placeholder": "Cyberpunk world" } } }, "ui": { "results": { "widgets": [ { "type": "Images", "sources": [ "dynamicImageGenerator" ] } ] }, }, "steps": [ { "id": "promptsGenerator", "type": "ObjectGenerator", "parameters": { "count": 40, "input": "$.input.promptType", "description": "You are going to be given a prompt type as input. As an experienced artist with knowledge of how diffusion models work, generate a list of prompts that will result in great images in the context of the prompt type input.", "schema": { "type": "object", "properties": { "prompts": { "type": "array", "items": { "type": "string" } } } } } }, { "id": "dynamicImageGenerator", "type": "ImageGenerator", "parameters": { "images": [ [ "@Map($.results.promptsGenerator.prompts)", { "steps": 30, "prompt": "$$", "negativePrompt": "ugly, blurry" } ] ], "baseModel": "stable-diffusion-v1-5/stable-diffusion-v1-5" } } ]
  • id: Unique identifier for the step.
  • type: Must be ImageGenerator.
  • parameters.images: An array describing which prompts (and settings) to apply.
  • **You can Map over data from previous steps. Each item in the array becomes a separate image request.
  • baseModel and trainingId:
    • baseModel: A Hugging Face model ID (e.g. “stable-diffusion-v1-5/stable-diffusion-v1-5”).
    • trainingId: If you want to generate images using a custom-trained model from a ModelGenerator step.
  • Other fields: (e.g. width, height, steps) can be inline or part of each images item.

When the Flow runs, each image definition triggers an inference job, producing one or more images that appear in your Flow results.

Inference Parameters

FieldTypeDefaultDescription
imagesImage[]nullA list of objects describing the image to be generated
trainingIdstring (UUID)nullA global trainingId to be applied to all images, unless specified individually on the image object
baseModelstringnullA global baseModel to be applied to all images, unless specified individually on the image object
inferencePackIdstring (UUID)nullThe ID of an inferece pack created through the dashboard.

Images

The images parameter accepts an array of objects that can contain these properties:

FieldTypeDefaultDescription
promptstring (required)nullA textual prompt describing what to generate.
baseModelstring (required)nullA valid Hugging Face model ID, e.g. “stable-diffusion-v1-5/stable-diffusion-v1-5”.
trainingIdstring (UUID)nullIf provided, uses a previously trained model from your account. Takes precedence over baseModel.
negativePromptstringnullItems to avoid in the image (e.g., “blurry, poorly drawn face”).
stepsnumber (60)25Number of diffusion steps. Higher = more detailed images but slower.
widthnumber (8–2048)1024Image width, must be a multiple of 8.
heightnumber (8–2048)1024Image height, must be a multiple of 8.
scalenumber (0–1)0.9Typically keep at 0.9 for stable results.
guidanceScalenumber (0–10)7.5Strength of prompt conditioning (aka CFG scale). High values = stricter adherence to your prompt.
seednumbernullSeed for deterministic outputs (good for testing). Leave blank for random.
batchSizenumber (1–4)1Generate multiple images from a single prompt (in a single pass).
precisionenum:Precisionfp16Mixed precision (fp16 or bf16). Generally keep at fp16 unless you have a reason to use bf16.

Tip: Setting a fixed seed is crucial for reproducible tests or comparing hyperparameters. If you want variety, omit the seed.

Putting it all together:

{ id: 'generateImagesOfNewModel', type: 'ImageGenerator', parameters: { trainingId: '$.results.myTrainingStep.id', baseModel: 'stable-diffusion-v1-5/stable-diffusion-v1-5', images: [ { prompt: 'A photo of an astronaut riding a horse on mars', negativePrompt: 'blurry, deformed', width: 768, height: 768, steps: 20, guidanceScale: 8.0, }, { prompt: 'A photo of an astronaut riding a horse on mars', negativePrompt: 'blurry, deformed', width: 768, height: 768, steps: 20, guidanceScale: 8.0, trainingId: '4716c93e-03bc-49cf-921d-203971fe5866', // This value will take precedence over the global trainingId baseModel: 'Realistic_Vision_V6.0_B1', // This value will take precedence over the global baseModel }, ], }, }

This example:

  • Uses a trainingId from a previously trained model step (myTrainingStep) as the global trainingId for all images and also a global baseModel.
  • However, the second image object overrides the global parameters and will instead use its own trainingId and baseModel parameters.
  • Generates two images at 768×768.
  • Adheres strongly to the prompt (guidanceScale=8.0).

Inference Packs

Inference Packs let you save a set of prompts and inference settings for reuse — similar to training templates but for image generation. They’re helpful if you frequently generate similar images with different trainings or models, or if you want to let have your flow always include some similar images.

  • Create an Inference Pack in the dashboard.
  • Reference the Pack in a Flow or use it to generate inferences through the dashboard:
    • Provide the inferencePackId alongside any extra prompts.
    • The system merges them all, generating every prompt in the pack plus any additional ones you specify.

Using inference packs:

  • Saves Time: No need to copy-paste the same set of prompts repeatedly.
  • Ensures Consistency: Everyone using the same pack sees the same set of baseline prompts.
  • Great for Testing: You can quickly compare how different training models handle the same set of reference prompts.

Key Points & Best Practices

It’s usually much faster to generate inferences in batches. Setting up an inference job can take a long time (downloading model, trainings, setting up enviroment, processing results, etc), so if there are multiple inference requests at once, we can optmize and batch what’s possible together, drastically speeding up the process in comparison to doing one inference at a time.

  • Prompt Crafting: Your prompt can drastically affect outcomes. Experiment with detail, style references, and negative prompts.
  • Image Dimensions: Must be multiples of 8. Larger images might result in poor results depending on the model.
  • Cost: Image generation is billed at $0.02 per inference.
Last updated on