All Products
Search
Document Center

Platform For AI:PAI ArtLab Kohya

Last Updated:Apr 01, 2026

Train a custom LoRA model in the cloud using Kohya (Exclusive Edition) — no local GPU required. This guide walks through the end-to-end workflow: preparing a dataset, captioning images, configuring training parameters, and evaluating the trained model.

Log in to the PAI ArtLab console before you begin.

Prerequisites

Before you begin, make sure you have:

How it works

Training a LoRA model with Kohya (Exclusive Edition) follows four stages:

  1. Create a dataset — Upload training images into a named folder.

  2. Caption images — Use the WD14 model to auto-generate text descriptions for each image.

  3. Train the model — Configure and launch a LoRA training job. Monitor the loss value to assess training quality.

  4. Evaluate the output — Run the trained LoRA in Stable Diffusion (Shared Edition) and compare results with an X/Y/Z plot.

The example in this guide trains an oil painting style model using 15 landscape images at 768 × 768 pixels.

Step 1: Create a dataset

  1. Log in to PAI ArtLab. In the upper-right corner, hover over the image icon and select China (Shanghai).

  2. On the Dataset page, click Create Dataset and enter a name.

  3. Open the dataset, click Create Folder, and enter a folder name. Folder names must follow the format Number_CustomName, where the number controls how many times images in the folder repeat during training. For example, 30_test repeats each image 30 times.

  4. Upload your training images to the folder. Image quality requirements:

    • Use more than 15 clear images.

    • For LoRA training on the sd1.5 base model, 512 × 512 or 512 × 768 pixels is sufficient — higher resolutions are unnecessary.

    • Avoid images with watermarks, low definition, unusual lighting, complex or unrecognizable content, or unusual angles.

Step 2: Caption images

Captioning generates a text description for each image. The WD14 model reads each image and creates a prompt describing its content. You can review and edit captions afterward if needed.

  1. On the Toolbox page, click the Kohya (Exclusive Edition) card to open the tool.

  2. Go to the > Captioning tab and configure the following parameters.

    ParameterDescription
    Image folder to captionSelect the folder you created. If it doesn't appear in the drop-down list, enter the path manually — for example, /data-oss/datasets/test/30_test.
    Undesired TagsEnter any tags you want to exclude from the generated captions.
    Prefix to add to WD14 captionEnter the LoRA trigger word. Use the format DatasetName + Number — for example, test1.
  3. Click Caption images. Captioning takes 2–3 minutes. When captioning done appears in the log, captioning is complete.

  4. On the Datasets page, open your folder and click any image to view its caption. Edit the caption text if needed.

Step 3: Train the model

Select a base model

On the Model > Model Scope page, select a Checkpoint base model and add it to My Models.

MethodWhen to useSteps
Preset model (recommended)You want a platform-provided model, such as sd1.5 xlSelect the model directly from the Model Scope page.
Custom modelYou have your own Checkpoint modelUpload a base model or add an existing model to My Models first.
image

For a custom model, set Model Quick Pick to custom. In the Pretrained model name or path field, enter /data-oss/models/Stable-diffusion, append /, and then select the Checkpoint model you added or uploaded to My Models.

image

Configure and start training

  1. On the Kohya (Exclusive Edition) page, go to LoRA > Training and configure each tab:

    Source Model tab

    ParameterDescription
    Model Quick PickSelect custom.
    Pretrained model name or pathClick the image icon to refresh the model list. Select /data-oss/models/Stable-diffusion, append /, then select the model you added.

    Folders tab

    ParameterDescription
    Output FolderSelect the dataset you created.
    Model Output NameEnter a name for the trained LoRA model — for example, test.

    Parameters tab

    ParameterValueNotes
    Epoch20Number of full passes through the dataset.
    Max Resolution768, 768Match your training image resolution.
    Enable buckets (enables Data Containers)Clear (unchecked)Clear this check box when all images in the dataset have the same dimensions.
    Text Encoder learning rate0.00001Controls how fast the text encoder adapts.
    Network Rank (Dimension)128Higher values capture more detail but increase file size.
    Network Alpha64Scales the LoRA's influence during training.
  2. Click Start Training. Training generates logs in real time. Monitor the loss value — it measures how closely the model's output matches the training images. Lower is generally better. Use the table below to assess whether training is on track: When model saved appears in the log, training is complete.

    Model typeExpected loss range
    Character model0.06–0.09
    Object model0.07–0.09
    Style model0.08–0.13
    Feature model0.003–0.05

Step 4: Evaluate the model

Use an X/Y/Z plot to compare different training checkpoints and LoRA strength values side by side.

  1. On the Model > My Models page, click the image icon on a model card to add both the Checkpoint model and the trained LoRA model to Stable Diffusion (Shared Edition).

  2. On the Toolbox page, click the Stable Diffusion (Shared Edition) card.

  3. Click the image icon next to Stable Diffusion Model and select your Checkpoint model.

  4. On the Text-to-image tab, go to the Generation tab and configure:

    ParameterValue
    Steps30
    ScriptX/Y/Z plot
    X TypePrompt S/R
    X ValuesNUM,000001,000002,000003
    Y TypePrompt S/R
    Y ValuesSTRENGTH,0.3,0.5,0.6,0.7,0.8,0.9,1
  5. On the LoRA tab, click Refresh and select the LoRA model you trained. If your LoRA model isn't listed, select any trained LoRA model and update the prompt to reference your model. For example, change <lora:test-000002:1> to <lora:test-NUM:STRENGTH>.

  6. Enter the prompts:

    FieldValue
    Positive Prompttest1, outdoors, sky, day, cloud, water, tree, blue sky, no humans, traditional media, grass, building, nature, scenery, house, castle,
    Negative Promptlowres, 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,(worst quality:1.4),(low quality:1.4), (monochrome:1.1), Eagetive,
  7. Click Generate.

The X/Y/Z plot shows results for all combinations of checkpoint epochs (X axis) and LoRA strength values (Y axis). Use it to identify the checkpoint and strength that best match your target style.

What's next