Detail slider for Z-Image

세부 정보

파일 다운로드

모델 설명

看圖的人應該可以看出來, fig 1/2 這是直接從 AI-TOOLKIT 測試圖用權重 +2~-2 測的

很明顯已經有顏色的次生變化

沒辦法因為是有加強對比度

有興趣的人可以測試下直接把下面的正負概念 PROMPT 沒有任何 LORA 情況出圖測試看看

然後把所有 PROMPT 掉用 LORA 測試看看很有趣

其實 Z-image 本身細節很強了, 這個未必有必要但是玩 slider lora 應該都是從 anime-photo, detail, old-young, 這些概念下手開始測試

下面是 LLM 幫忙生的說明

💡 AI-TOOLKIT 訓練 Z-Image Slider LoRA 實戰指南

✨ 一、Slider LoRA 概念速覽

Concept Slider LoRA 是一種高效能的訓練方法,它並非教導模型新事物,而是微調模型對一對相反概念的理解,從而實現精準的圖像控制。

特性說明****工作原理在兩個極端提示詞之間創建一條可控的連續過渡(Sliding Trajectory)權重控制LoRA 權重通常在 -1.0 到 +1.0(極端情況可達 $\pm 2.0$)之間調整,實現概念的增強或削弱。數據集需求極低。通常使用小型、通用的數據集即可,甚至可以嘗試不使用數據集(零樣本訓練)。訓練工具AI-TOOLKIT 的 Concept Slider 模式。


⚙️ 二、AI-TOOLKIT 訓練參數詳解

以下是針對 Z-Image Turbo 模型訓練 Detail/Texture Slider 的推薦配置和範例參數。

1. 核心訓練參數

參數建議值範例設定(參考)備註****模式(Mode)Concept Slider必須勾選或在 YAML 中設定。基礎模型(Model)Z-Image-Turbo確保使用 Z-Image 系列模型。網絡 Rank4 或 8建議使用較低的 Rank 以提高訓練效率和穩定性。Learning Rate (LR)$1 \times 10^{-3}$ ($0.001$)比傳統 LoRA 訓練(通常 $1 \times 10^{-4}$)高得多。Steps300 - 400 StepsConcept Slider 通常在低步數下即可收斂。Resolution$512 \times 512$訓練概念微調時,$512 \times 512$ 即可。

2. Slider 提示詞配置(Detail Slider 範例)

本次訓練的目標是創建一個控制圖像**細節與質感(Detail and Texture)**的滑桿。

參數名稱範例設定目的與作用範圍****Target Classdetail定義滑桿作用的主要概念。範例為 detailAnchor Classplain white background提供中性參考,防止訓練導致畫面出現次級幻覺(例如意外的顏色偏移或亮度變化)。Positive Prompt (目標概念:高細節)extremely detailed, intricate details, high resolution textures, fine details visible, sharp focus, clear photorealistic quality, masterpiece detail level, realistic surface textures, visible material properties, natural wear and tear, subtle imperfections, authentic textures, tactile quality, complex lighting, subtle shadows, natural light interaction, realistic reflections, ambient occlusion, detailed highlights and shadows當 LoRA 權重為 正值(例如 +1.0) 時,會加強這些高細節與複雜紋理的概念。Negative Prompt (目標概念:低細節)simple, basic details, low resolution, blurry, soft focus, simplified textures, cartoon style, minimal detail, flat rendering, smooth surfaces, perfect materials, no texture variation, artificial appearance, plastic-like finish, uniform textures, flat lighting, simple shadows, no reflections, basic illumination, uniform lighting, cartoon lighting當 LoRA 權重為 負值(例如 -1.0) 時,會加強這些簡化、低細節的概念。


🚨 三、Z-Image 訓練常見錯誤與解決方案

當使用 Z-Image-Turbo 模型在 Concept Slider 模式下進行訓練時,用戶經常遇到與批次大小(Batch Size)相關的錯誤(參考 GitHub Issue #554):

ValueError: Batch size of latents must be the same or half the batch size of text embeddings

A. 推薦解決方案:配置調整(低風險)

為了解決此錯誤,最安全且推薦的方法是關閉文字嵌入快取並將 batch_size 設為 $1$。

YAML

train:
  # ... 其他訓練參數
  cache_text_embeddings: false # 💡 關鍵:確保此項設定為 false,停用快取
  batch_size: 1               # 建議將 batch_size 設為 1 
  gradient_accumulation: 1    # 建議搭配 gradient_accumulation: 1

B. 程式碼修改(Code Patch - 高風險

這是 GitHub 討論中提出的替代方案,請謹慎使用,因為它可能在其他功能中引入未知錯誤:

  • 檔案路徑: /toolkit/prompt_utils.py

  • 修改內容: 在約 265 行,將處理 text_embeds 的程式碼進行替換:

    • text_embeds = embed_list

    • 替換為: text_embeds = padded

이 모델로 만든 이미지

이미지를 찾을 수 없습니다.