วันศุกร์ที่ 19 มิถุนายน พ.ศ. 2569

นูปสอนนูป ติด tag สำหรับทำ Pony SDXL LoRA

 


นูปสอนนูป ติด tag สำหรับทำ Pony SDXL LoRA
เอาละครับ วิธีที่ผม ก็มีสามวิธี 
 
1.เขียนเอง ที่ละ tag

2 ใช้โปรแกมช่วย  กึ่งอัตโนมัต

3ใช้กุ้งแดง OpenClaw หรือ Taggui ทำอัตโนมัต

โดยที่ ผมจะ อธิบายข้อ 2 อย่างเดียวเพราะ ผมใช้วิธีนี้ 

 

 อันนี้คำแนะนำจาก AI gem-pro 

การเตรียมและติด Tag สำหรับทำ LoRA ของ Pony SDXL มีความสำคัญมากครับ เพราะโมเดลตระกูล Pony เข้าใจภาษาแบบ Danbooru (คำสั้นๆ คั่นด้วยจุลภาค) เป็นหลัก หากติดแท็กไม่ดี โมเดลจะเบลนด์สไตล์หรือเสื้อผ้าปนกันมั่วจนแกะไม่ออก

ขั้นตอนที่ถูกต้องและเป็นระบบในการเตรียม Dataset มีดังนี้ครับ

🚀 ขั้นตอนการติด Tag สำหรับ Pony SDXL LoRA

1เตรียมรูปภาพ (Dataset Preparation):ขั้นตอนแรกก่อนเริ่มแท็ก

รวบรวมรูปภาพ (แนะนำ 20-50 รูปสำหรับตัวละคร) นำมาครอปและปรับขนาดเป็น 1024x1024 พิกเซล (หรือใช้ระบบ Bucket อัตโนมัติในตอนเทรนก็ได้) พยายามเลือกภาพที่คมชัด ไม่มีลายน้ำ และมีมุมมองหรือเสื้อผ้าที่หลากหลายเพื่อให้โมเดลไม่จำสเปกแคบเกินไป

2ใช้เครื่องมือสแกนแท็กอัตโนมัติ (Auto-Tagging):ประหยัดเวลาด้วย AI

ใช้โปรแกรมอย่าง TagGUI, BooruDatasetTagManager หรือเมนู ยูทิลิตี้ใน Kohya_ss โดยเลือกใช้คอร์สแกน WD14 Tagger (แนะนำโมเดล wd-v1-4-convnextv2-tagger-v2 หรือตัวที่ใหม่กว่า)

  • ตั้งค่า Threshold ไว้ที่ประมาณ 0.35 - 0.40 เพื่อให้ได้แท็กที่ละเอียดพอดี

  • กดรันเพื่อสร้างไฟล์ .txt ชื่อเดียวกับรูปภาพขึ้นมา

3ใส่คำกระตุ้น (Activation Tag / Trigger Word):สิ่งสำคัญที่ทำให้ LoRA ทำงาน

เปิดไฟล์ .txt ทั้งหมด (แนะนำให้ใช้โปรแกรมที่แก้ไขพร้อมกันได้ทั้งโฟลเดอร์ เช่น BooruDatasetTagManager หรือ Notepad++) แล้วทำการเพิ่มชื่อ Trigger Word ของคุณไว้ที่บรรทัดแรก สุดทางซ้ายสุด ตามด้วยเครื่องหมายจุลภาค

  • ตัวอย่าง: my_character_name, 1girl, solo, long_hair...

4คัดกรองและลบแท็ก (Tag Pruning):ขั้นตอนชี้ชะตาความยืดหยุ่นของ LoRA

ขั้นตอนนี้คือการเลือกว่าจะให้โมเดล "จดจำ" หรือ "ลบ" อะไรออกไป เพื่อปล่อยให้สิ่งนั้นกลายเป็นอัตลักษณ์ของ Trigger Word (อ่านหลักการเลือกสลับแท็กได้ในหัวข้อถัดไปด้านล่าง)

5เพิ่มแท็กเฉพาะของ Pony (Pony Specific Tags):ปรับแต่งให้เข้ากับ Base Model

เพื่อให้ LoRA เข้ากันได้ดีกับโครงสร้างของ Pony SDXL ให้เพิ่มแท็กประเภทรวมไว้ข้างหลัง Trigger Word (หรือจะไว้ท้ายสุดก็ได้) เช่น source_anime (หากเป็นงานอนิเมะ) หรือกลุ่มเรตติ้ง เช่น rating_safe หรือ rating_explicit เพื่อให้ LoRA รู้ว่ารูปภาพชุดนี้อยู่ในกลุ่มไหนของโมเดลหลัก

 

เอาละ ตรงนี้ มัน Pony SDXL  มันไม่ใช่ SDXL 1.0 จะบรรยาย แบบ ใครทำอะไรที่ไหน ไม่ได้ ต้องติด tag  และมันต้องมี score_9, score_8_up, score_7_up, score_6_up, score_5_up, score_4_up, source_anime,
นำหน้าด้วย ไม่งั้นLoRA ไม่ออก  ผมลองแล้ว ก่อนที่จะอ่านจาก
https://civitai.red/models/257749/pony-diffusion-v6-xl


แน่นอน ถ้า มี 10-20 ภาพ เขียน เองดีสุด ยังไงคน*ก็ฉลาด กว่า AI 
*คนปกตินะ และก็ความฉลาด ไม่ใช่ความรู้นะ

และถ้ามี ซัก หมื่น หรือล้านภาพ ใช้กุ้งแดงครับ 

แต่ เคสนี้ มีประมาณ 200 ภาพ จึงใช้ แบบกึงอัตโนมัตได้ โดยการ โยนให้ AI เขียน tag แล้วเรา มาดูมาเติม แก้ไข เองทีละภาพ  หลายครั้ง ที่ AI มันมัว เพราะมันมองภาพได้ แค่  60-80%  ตามความฉลาด model

เอาละ ดังนั้น ผมจะมาแนะนำข้อ 2 กึ่งอัตโนมัต 

โดย จะแบบเป็น 

2.1 ใช้ CompyUI   

2.2 ใช้ LM studio

2.3 ใช้ Taggui 

 

มาเริ่ม ที่  CompyUI    ก่อน ผมลองแล้ว เร็วมาก  
วิธี ให้ไปติดตั้ง Workflow ก่อน   อันนี้มีคนทำมาให้แล้ว เหมาะสำหรับคนนูป คนกากอย่างผม 
https://civitai.red/models/969415/automatic-captioning-workflow-fluxstable-diffusion-35-comfyui

หรือ

https://civitai.red/models/1491063/auto-tagger 

หรือตัวอื่นๆก็ได้แล้วแต่ชอบ 



 ส่วนอีก ทาง 
2.2 LM studio อันนี้ ช้ากว่า 


 โดยผมเคยทำคลิปสอนไปแล้ว แต่นี้ให้เพิ่ม System Prompt เข้าไปด้วย 
ผมใช้ prompt แบบนี้ครับ 


You are an expert AI image captioner and Danbooru tagging assistant, specialized in generating prompt tags for the "Pony SDXL" (Stable Diffusion XL) model. Your task is to analyze the user's image description or image input, and convert it into a precise, comma-separated list of tags that Pony SDXL understands perfectly.

Strictly adhere to the following tagging rules and structure:

1. FORMATTING RULES:
- Use English only.
- Write everything in LOWERCASE.
- Separate tags with a comma and a space (e.g., "tag1, tag2, tag3").
- Use underscores (_) instead of spaces for multi-word tags (e.g., "blue_eyes", "school_uniform", "looking_at_viewer").
- DO NOT use natural language, sentences, or conjunctions (No "and", "with", "a picture of").
- Avoid using parenthesis unless it's part of a standard Danbooru tag (like character/series names).

2. PROMPT STRUCTURE (Always follow this order):
[QUALITY TAGS] -> [SOURCE & RATING TAGS] -> [CHARACTER FEATURES] -> [CLOTHING & ACCESSORIES] -> [POSE & EXPRESSION] -> [BACKGROUND & ENVIRONMENT]

3. MANDATORY TAG DEFINITIONS:
- Quality Tags: Always start with "score_9, score_8_up, score_7_up, score_6_up, score_5_up, score_4_up".
- Source Tags: Choose the most appropriate one from: "source_anime", "source_cartoon", "source_furry", "source_pony". (Can use multiple if it's a crossover style).
- Rating Tags: Choose ONLY ONE based on the image content:
  * "rating_safe" (SFW, no nudity/lewdness)
  * "rating_questionable" (Ecchi, suggestive, underwear, swimwear)
  * "rating_explicit" (NSFW, nudity, sexual acts)

4. DETAILED TAGGING GUIDELINES:
- Character: Describe gender (1girl, 1boy), hair color/style, eye color, breast size if applicable, and unique features (e.g., cat_ears).
- Camera/Framing: Include camera angles or framing tags if applicable (e.g., "cowboy_shot", "close_up", "from_below").
- Background: Describe the setting clearly (e.g., "masterpiece_background", "cityscape", "indoors", "simple_background").

Output ONLY the final comma-separated tags. Do not include any introductory or concluding remarks.

 

ก็อบไปได้เลย หรือ เขียนเอง หรือ ไปก็อบคนอื่นก็ได้ครับ 

 

มาเปรียบเทียบกันครับ 
ภาพตัวอย่าง 1 

ภาพตัวอย่างที่ 1: ผลงานโดย @CagliostroLab บน Civitai 
@CagliostroLab https://civitai.red/images/57571454

Compy UI  10.30 s (RTX 5060Ti 16GB)

 souryuu asuka langley, 1girl, solo, long hair, breasts, looking at viewer, smile, blue eyes, brown hair, holding, hair between eyes, closed mouth, sitting, medium breasts, weapon, small breasts, holding weapon, orange hair, two side up, head tilt, feet out of frame, bodysuit, chair, headgear, eyepatch, crossed legs, light smile, polearm, skin tight, science fiction, shiny clothes, spear, on chair, holding polearm, pilot suit, plugsuit, red bodysuit, interface headset, armchair, multicolored bodysuit, lance of longinus \(evangelion\)

 

 

 LM Studio 24.30s  (RTX 5060Ti 16GB)

score_9, score_8_up, score_7_up, score_6_up, score_5_up, score_4_up, source_anime, rating_safe, 1girl, asuka_langley_soryu, long_hair, orange_hair, blue_eyes, eye_patch, breast_size_small, plugsuit, red_plugsuit, bodysuit, sitting, leaning_back, holding_staff, trident, looking_at_viewer, slight_smile, cowboy_shot, throne, chair, indoors, masterpiece_background, soft_lighting 

 

 LM Studio 56.27 s (RTX 5060Ti 16GB)

ภาพตัวอย่างที่ 2



ภาพตัวอย่างที่ 2: ผลงานโดย @rukisan บน Pixiv 
@rukisan https://www.pixiv.net/en/artworks/143399155 

 Compy UI  9.16s (RTX 5060ti 16GB)

1girl, solo, breasts, looking at viewer, blush, short hair, blue eyes, simple background, brown hair, gloves, dress, thighhighs, bow, closed mouth, bare shoulders, standing, underwear, panties, ass, thighs, cowboy shot, small breasts, choker, pointy ears, elbow gloves, looking back, fingerless gloves, from behind, orange hair, covered nipples, strapless, sash, shiny skin, colored skin, skindentation, blue dress, blue bow, blue background, border, back, half-closed eyes, short dress, white border, strapless dress, bridal gauntlets, eyeshadow, outside border, freckles, outline, backless outfit, back bow, white outline, backless dress, shoulder blades, blue choker, pink thighhighs, aqua background, yellow sclera, body blush, yellow panties, aqua dress, blue sash, orange thighhighs, long nose

 

 LM Studio  19.6s (RTX 5060ti 16GB)

score_9, score_8_up, score_7_up, score_6_up, score_5_up, score_4_up, source_cartoon, rating_questionable, 1girl, short_hair, orange_hair, blue_eyes, pointy_nose, dress, light_blue_dress, backless_dress, bow, blue_bow, gloves, opera_gloves, light_blue_gloves, panties, tan_panties, buttocks, looking_back, profile, standing, simple_background, turquoise_background, full_body 

 

เทียบกันเอาเองแล้วกันครับ ว่าอะไรดี กว่ากันทั้งนี้ขึ้น อยู่กับ LLM model ที่ใช้ หรือ workflow ด้วยครับ  

 

3.1 กุ้งแดง ใช้ไม่เป็นครับ  ดูจะยากเสียเวลาเรียนเลขข้ามครั้บ  

3.2 ใช้ Taggui อันนี้ง่ายมาก ถึงว่า ถึงชอบสอนอันนี้กัน ก็ไม่ยาก 
https://github.com/jhc13/taggui/releases

สำหรับ windows โหลดไฟล์ แตกไฟล์ รันexe  เลือกโฟลเดอร์ภาพ กด all เลือกโมเดล ปล่อยมันไป มาสร้างไฟล์ txt ให้จบ อันนี้ก็ ถือว่าออโต้ 

ผลที่ แนะนำให้ ลองเองครับ 
ปล.ถ้า จะแท็ก รูป nsfw ก็ควรหาโมเดลภาษาให้เหมาะสมด้วยครับ  ไม่งั้น มันติดเซ็นเซอร์ เข้าใจนะครับ 

ลิงก์ถาวร
https://poipoi-test.blogspot.com/2026/06/tag-pony-sdxl-lora.html


ทดสอบเพิ่มเติม 
บน tagui 
fancyfeast/llama-joycaption-beta-one-hf-llava
เหมาะกับ SDXL 1.0
ไม่เหมาะ กับ Pony เท่าไหร่
ลองแล้ว 2 ตัวนี้ เหมาะกับ Pony
SmilingWolf/wd-eva02-large-tagger-v3
กับ
SmilingWolf/wd-vit-large-tagger-v3
คล้ายๆ กัน    ยังไม่แน่ใจว่าอันไหนดีกว่ากัน