åœãªããžããªã§ã¯ã¢ãã«ã®fine tuningãDreamBoothãããã³LoRAãšTextual Inversionã®åŠç¿ããµããŒãããŸãããã®ææžã§ã¯ãããã«å ±éãããåŠç¿ããŒã¿ã®æºåæ¹æ³ãã¹ã¯ãªãããªãã·ã§ã³ã«ã€ããŠèª¬æããŸãã
ããããããã®ãªããžããªã®READMEãåç §ããç°å¢æŽåãè¡ã£ãŠãã ããã
以äžã«ã€ããŠèª¬æããŸãã
- åŠç¿ããŒã¿ã®æºåã«ã€ããŠïŒèšå®ãã¡ã€ã«ãçšããæ°åœ¢åŒïŒ
- Aspect Ratio Bucketingã«ã€ããŠ
- 以åã®æå®åœ¢åŒïŒèšå®ãã¡ã€ã«ãçšããã³ãã³ãã©ã€ã³ããæå®ïŒ
- fine tuning æ¹åŒã®ã¡ã¿ããŒã¿æºåïŒãã£ãã·ã§ã³ãã³ã°ãªã©
1.ã ãå®è¡ããã°ãšããããåŠç¿ã¯å¯èœã§ãïŒåŠç¿ã«ã€ããŠã¯åã¹ã¯ãªããã®ããã¥ã¡ã³ããåç §ïŒã2.以éã¯å¿ èŠã«å¿ããŠåç §ããŠãã ããã
ä»»æã®ãã©ã«ãïŒè€æ°ã§ãå¯ïŒã«åŠç¿ããŒã¿ã®ç»åãã¡ã€ã«ãçšæããŠãããŸãã.png
, .jpg
, .jpeg
, .webp
, .bmp
ããµããŒãããŸãããªãµã€ãºãªã©ã®ååŠçã¯åºæ¬çã«å¿
èŠãããŸããã
ãã ãåŠç¿è§£å床ïŒåŸè¿°ïŒããã極端ã«å°ããç»åã¯äœ¿ããªããããããããè¶ è§£åAIãªã©ã§æ¡å€§ããŠããããšããå§ãããŸãããŸã極端ã«å€§ããªç»åïŒ3000x3000ãã¯ã»ã«çšåºŠïŒïŒããã倧ããªç»åã¯ãšã©ãŒã«ãªãå Žåãããããã§ãã®ã§äºåã«çž®å°ããŠãã ããã
åŠç¿æã«ã¯ãã¢ãã«ã«åŠã°ããç»åããŒã¿ãæŽçããã¹ã¯ãªããã«å¯ŸããŠæå®ããå¿ èŠããããŸããåŠç¿ããŒã¿ã®æ°ãåŠç¿å¯Ÿè±¡ããã£ãã·ã§ã³ïŒç»åã®èª¬æïŒãçšæã§ãããåŠããªã©ã«ãããããã€ãã®æ¹æ³ã§åŠç¿ããŒã¿ãæå®ã§ããŸãã以äžã®æ¹åŒããããŸãïŒããããã®ååã¯äžè¬çãªãã®ã§ã¯ãªããåœãªããžããªç¬èªã®å®çŸ©ã§ãïŒãæ£ååç»åã«ã€ããŠã¯åŸè¿°ããŸãã
-
DreamBoothãclass+identifieræ¹åŒïŒæ£ååç»å䜿çšå¯ïŒ
ç¹å®ã®åèª (identifier) ã«åŠç¿å¯Ÿè±¡ãçŽã¥ããããã«åŠç¿ããŸãããã£ãã·ã§ã³ãçšæããå¿ èŠã¯ãããŸãããããšãã°ç¹å®ã®ãã£ã©ãåŠã°ããå Žåã«äœ¿ããšãã£ãã·ã§ã³ãçšæããå¿ èŠããªãåãæ軜ã§ããã髪åãæè£ ãèæ¯ãªã©åŠç¿ããŒã¿ã®å šèŠçŽ ã identifier ã«çŽã¥ããããŠåŠç¿ããããããçææã®ããã³ããã§æãå€ããããªãããšãã£ãäºæ ãèµ·ããããŸãã
-
DreamBoothããã£ãã·ã§ã³æ¹åŒïŒæ£ååç»å䜿çšå¯ïŒ
ç»åããšã«ãã£ãã·ã§ã³ãèšé²ãããããã¹ããã¡ã€ã«ãçšæããŠåŠç¿ããŸããããšãã°ç¹å®ã®ãã£ã©ãåŠã°ãããšãç»åã®è©³çŽ°ããã£ãã·ã§ã³ã«èšè¿°ããããšã§ïŒçœãæãçããã£ã©Aãèµ€ãæãçããã£ã©Aããªã©ïŒãã£ã©ãšãã以å€ã®èŠçŽ ãåé¢ãããããå³å¯ã«ã¢ãã«ããã£ã©ã ããåŠã¶ããšãæåŸ ã§ããŸãã
-
fine tuningæ¹åŒïŒæ£ååç»å䜿çšäžå¯ïŒ
ããããããã£ãã·ã§ã³ãã¡ã¿ããŒã¿ãã¡ã€ã«ã«ãŸãšããŸããã¿ã°ãšãã£ãã·ã§ã³ãåããŠç®¡çããããåŠç¿ãé«éåããããlatentsãäºåãã£ãã·ã¥ããããªã©ã®æ©èœããµããŒãããŸãïŒããããå¥ææžã§èª¬æããŠããŸãïŒã
åŠç¿ããããã®ãšäœ¿çšã§ããæå®æ¹æ³ã®çµã¿åããã¯ä»¥äžã®éãã§ãã
åŠç¿å¯Ÿè±¡ãŸãã¯æ¹æ³ | ã¹ã¯ãªãã | DB / class+identifier | DB / ãã£ãã·ã§ã³ | fine tuning |
---|---|---|---|---|
ã¢ãã«ãfine tuning | fine_tune.py |
x | x | o |
ã¢ãã«ãDreamBooth | train_db.py |
o | o | x |
LoRA | train_network.py |
o | o | o |
Textual Invesion | train_textual_inversion.py |
o | o | o |
LoRAãTextual Inversionã«ã€ããŠã¯ãæ軜ã«ãã£ãã·ã§ã³ãã¡ã€ã«ãçšæããã«åŠç¿ãããå Žåã¯DreamBooth class+identifierãçšæã§ãããªãDreamBooth ãã£ãã·ã§ã³æ¹åŒãããã§ããããåŠç¿ããŒã¿ã®ææ°ãå€ãããã€æ£ååç»åã䜿çšããªãå Žåã¯fine tuningæ¹åŒãæ€èšããŠãã ããã
DreamBoothã«ã€ããŠãåæ§ã§ãããfine tuningæ¹åŒã¯äœ¿ããŸãããfine tuningã®å Žåã¯fine tuningæ¹åŒã®ã¿ã§ãã
ããã§ã¯ããããã®æå®æ¹æ³ã§å žåçãªãã¿ãŒã³ã«ã€ããŠã ã説æããŸãããã詳现ãªæå®æ¹æ³ã«ã€ããŠã¯ ããŒã¿ã»ããèšå® ãã芧ãã ããã
ãã®æ¹åŒã§ã¯ãåç»å㯠class identifier
ãšãããã£ãã·ã§ã³ã§åŠç¿ãããã®ãšåãããšã«ãªããŸãïŒshs dog
ãªã©ïŒã
åŠã°ããã察象ãçµã³ã€ããåèªidentifierãšã察象ã®å±ããclassã決ããŸãã
ïŒinstanceãªã©ãããããªåŒã³æ¹ããããŸããããšããããå ã®è«æã«åãããŸããïŒ
以äžããç°¡åã«èª¬æããŸãïŒè©³ããã¯èª¿ã¹ãŠãã ããïŒã
classã¯åŠç¿å¯Ÿè±¡ã®äžè¬çãªçš®å¥ã§ããããšãã°ç¹å®ã®ç¬çš®ãåŠã°ããå Žåã«ã¯ãclassã¯dogã«ãªããŸããã¢ãã¡ãã£ã©ãªãã¢ãã«ã«ããboyãgirlã1boyã1girlã«ãªãã§ãããã
identifierã¯åŠç¿å¯Ÿè±¡ãèå¥ããŠåŠç¿ããããã®ãã®ã§ããä»»æã®åèªã§æ§ããŸããããå è«æã«ãããšãtokinizerã§1ããŒã¯ã³ã«ãªã3æå以äžã§ã¬ã¢ãªåèªããè¯ããšã®ããšã§ãã
identifierãšclassã䜿ããããšãã°ãshs dogããªã©ã§ã¢ãã«ãåŠç¿ããããšã§ãåŠç¿ãããã察象ãclassããèå¥ããŠåŠç¿ã§ããŸãã
ç»åçææã«ã¯ãshs dogããšããã°åŠã°ããç¬çš®ã®ç»åãçæãããŸãã
ïŒidentifierãšããŠç§ãæè¿äœ¿ã£ãŠãããã®ãåèãŸã§ã«æãããšãshs sts scs cpc coc cic msm usu ici lvl cic dii muk ori hru rik koo yos wny
ãªã©ã§ããæ¬åœã¯ Danbooru Tag ã«å«ãŸããªããã€ãããæãŸããã§ããïŒ
step 2. æ£ååç»åã䜿ããåŠãã決ãã䜿ãå Žåã«ã¯æ£ååç»åãçæãã
æ£ååç»åãšã¯ãåè¿°ã®classå
šäœããåŠç¿å¯Ÿè±¡ã«åŒã£åŒµãããããšãé²ãããã®ç»åã§ãïŒlanguage driftïŒãæ£ååç»åã䜿ããªããšãããšãã° shs 1girl
ã§ç¹å®ã®ãã£ã©ã¯ã¿ãåŠã°ãããšãåãªã 1girl
ãšããããã³ããã§çæããŠããã®ãã£ã©ã«äŒŒãŠããŸãããã㯠1girl
ãåŠç¿æã®ãã£ãã·ã§ã³ã«å«ãŸããŠããããã§ãã
åŠç¿å¯Ÿè±¡ã®ç»åãšæ£ååç»åãåæã«åŠã°ããããšã§ãclass 㯠class ã®ãŸãŸã§çãŸããidentifier ãããã³ããã«ã€ããæã ãåŠç¿å¯Ÿè±¡ãçæãããããã«ãªããŸãã
LoRAãDreamBoothã§ç¹å®ã®ãã£ã©ã ãåºãŠããã°ããå Žåã¯ãæ£ååç»åãçšããªããŠãè¯ããšãããŸãã
Textual Inversionã§ã¯çšããªããŠããã§ãããïŒåŠã°ãã token string ããã£ãã·ã§ã³ã«å«ãŸããªãå Žåã¯ãªã«ãåŠç¿ãããªãããïŒã
æ£ååç»åãšããŠã¯ãåŠç¿å¯Ÿè±¡ã®ã¢ãã«ã§ãclass åã ãã§çæããç»åãçšããã®ãäžè¬çã§ãïŒããšãã° 1girl
ïŒããã ãçæç»åã®å質ãæªãå Žåã«ã¯ãããã³ããã工倫ãããããããããå¥éããŠã³ããŒãããç»åãçšããããšãã§ããŸãã
ïŒæ£ååç»åãåŠç¿ãããããããã®å質ã¯ã¢ãã«ã«åœ±é¿ããŸããïŒ
äžè¬çã«ã¯æ°çŸæçšåºŠãçšæããã®ãæãŸããããã§ãïŒææ°ãå°ãªããš class ç»åãäžè¬åããããããã®ç¹åŸŽãåŠãã§ããŸããŸãïŒã
çæç»åã䜿ãå Žåãéåžžãçæç»åã®ãµã€ãºã¯åŠç¿è§£å床ïŒããæ£ç¢ºã«ã¯bucketã®è§£å床ãåŸè¿°ïŒã«ããããŠãã ããã
ããã¹ããã¡ã€ã«ãäœæããæ¡åŒµåã .toml
ã«ããŸããããšãã°ä»¥äžã®ããã«èšè¿°ããŸãã
ïŒ#
ã§å§ãŸã£ãŠããéšåã¯ã³ã¡ã³ãã§ãã®ã§ããã®ãŸãŸã³ããããŠãã®ãŸãŸã§ãããã§ãããåé€ããŠãåé¡ãããŸãããïŒ
[general]
enable_bucket = true # Aspect Ratio Bucketingã䜿ããåŠã
[[datasets]]
resolution = 512 # åŠç¿è§£å床
batch_size = 4 # ããããµã€ãº
[[datasets.subsets]]
image_dir = 'C:\hoge' # åŠç¿çšç»åãå
¥ãããã©ã«ããæå®
class_tokens = 'hoge girl' # identifier class ãæå®
num_repeats = 10 # åŠç¿çšç»åã®ç¹°ãè¿ãåæ°
# 以äžã¯æ£ååç»åãçšããå Žåã®ã¿èšè¿°ãããçšããªãå Žåã¯åé€ãã
[[datasets.subsets]]
is_reg = true
image_dir = 'C:\reg' # æ£ååç»åãå
¥ãããã©ã«ããæå®
class_tokens = 'girl' # class ãæå®
num_repeats = 1 # æ£ååç»åã®ç¹°ãè¿ãåæ°ãåºæ¬çã«ã¯1ã§ãã
åºæ¬çã«ã¯ä»¥äžãå Žæã®ã¿æžãæããã°åŠç¿ã§ããŸãã
-
åŠç¿è§£å床
æ°å€1ã€ãæå®ãããšæ£æ¹åœ¢ïŒ
512
ãªã512x512ïŒãéµã«ãã³ã«ã³ãåºåãã§2ã€æå®ãããšæšªÃ瞊ïŒ[512,768]
ãªã512x768ïŒã«ãªããŸããSD1.xç³»ã§ã¯ããšããšã®åŠç¿è§£å床ã¯512ã§ãã[512,768]
çã®å€§ããã®è§£å床ãæå®ãããšçžŠé·ã暪é·ç»åçææã®ç Žç¶»ãå°ããã§ãããããããŸãããSD2.x 768ç³»ã§ã¯768
ã§ãã -
ããããµã€ãº
åæã«äœä»¶ã®ããŒã¿ãåŠç¿ããããæå®ããŸããGPUã®VRAMãµã€ãºãåŠç¿è§£å床ã«ãã£ãŠå€ãã£ãŠããŸãããŸãfine tuning/DreamBooth/LoRAçã§ãå€ãã£ãŠããŸãã®ã§ã詳ããã¯åã¹ã¯ãªããã®èª¬æãã芧ãã ããã
-
ãã©ã«ãæå®
åŠç¿çšç»åãæ£ååç»åïŒäœ¿çšããå Žåã®ã¿ïŒã®ãã©ã«ããæå®ããŸããç»åããŒã¿ãå«ãŸããŠãããã©ã«ããã®ãã®ãæå®ããŸãã
-
identifier ãš class ã®æå®
åè¿°ã®ãµã³ãã«ã®éãã§ãã
-
ç¹°ãè¿ãåæ°
åŸè¿°ããŸãã
ç¹°ãè¿ãåæ°ã¯ãæ£ååç»åã®ææ°ãšåŠç¿çšç»åã®ææ°ã調æŽããããã«çšããããŸããæ£ååç»åã®ææ°ã¯åŠç¿çšç»åãããå€ããããåŠç¿çšç»åãç¹°ãè¿ããŠææ°ãåããã1察1ã®æ¯çã§åŠç¿ã§ããããã«ããŸãã
ç¹°ãè¿ãåæ°ã¯ã åŠç¿çšç»åã®ç¹°ãè¿ãåæ°ÃåŠç¿çšç»åã®ææ°â§æ£ååç»åã®ç¹°ãè¿ãåæ°Ãæ£ååç»åã®ææ° ããšãªãããã«æå®ããŠãã ããã
ïŒ1 epochïŒããŒã¿ãäžåšãããš1 epochïŒã®ããŒã¿æ°ããåŠç¿çšç»åã®ç¹°ãè¿ãåæ°ÃåŠç¿çšç»åã®ææ°ããšãªããŸããæ£ååç»åã®ææ°ãããããå€ããšãäœã£ãéšåã®æ£ååç»åã¯äœ¿çšãããŸãããïŒ
ããããã®ããã¥ã¡ã³ããåèã«åŠç¿ãè¡ã£ãŠãã ããã
ãã®æ¹åŒã§ã¯åç»åã¯ãã£ãã·ã§ã³ã§åŠç¿ãããŸãã
åŠç¿çšç»åã®ãã©ã«ãã«ãç»åãšåããã¡ã€ã«åã§ãæ¡åŒµå .caption
ïŒèšå®ã§å€ããããŸãïŒã®ãã¡ã€ã«ã眮ããŠãã ãããããããã®ãã¡ã€ã«ã¯1è¡ã®ã¿ãšããŠãã ããããšã³ã³ãŒãã£ã³ã°ã¯ UTF-8
ã§ãã
step 2. æ£ååç»åã䜿ããåŠãã決ãã䜿ãå Žåã«ã¯æ£ååç»åãçæãã
class+identifier圢åŒãšåæ§ã§ãããªãæ£ååç»åã«ããã£ãã·ã§ã³ãä»ããããšãã§ããŸãããéåžžã¯äžèŠã§ãããã
ããã¹ããã¡ã€ã«ãäœæããæ¡åŒµåã .toml
ã«ããŸããããšãã°ä»¥äžã®ããã«èšè¿°ããŸãã
[general]
enable_bucket = true # Aspect Ratio Bucketingã䜿ããåŠã
[[datasets]]
resolution = 512 # åŠç¿è§£å床
batch_size = 4 # ããããµã€ãº
[[datasets.subsets]]
image_dir = 'C:\hoge' # åŠç¿çšç»åãå
¥ãããã©ã«ããæå®
caption_extension = '.caption' # ãã£ãã·ã§ã³ãã¡ã€ã«ã®æ¡åŒµåã.txt ã䜿ãå Žåã«ã¯æžãæãã
num_repeats = 10 # åŠç¿çšç»åã®ç¹°ãè¿ãåæ°
# 以äžã¯æ£ååç»åãçšããå Žåã®ã¿èšè¿°ãããçšããªãå Žåã¯åé€ãã
[[datasets.subsets]]
is_reg = true
image_dir = 'C:\reg' # æ£ååç»åãå
¥ãããã©ã«ããæå®
class_tokens = 'girl' # class ãæå®
num_repeats = 1 # æ£ååç»åã®ç¹°ãè¿ãåæ°ãåºæ¬çã«ã¯1ã§ãã
åºæ¬çã«ã¯ä»¥äžãå Žæã®ã¿æžãæããã°åŠç¿ã§ããŸããç¹ã«èšè¿°ããªãéšå㯠class+identifier æ¹åŒãšåãã§ãã
-
åŠç¿è§£å床
-
ããããµã€ãº
-
ãã©ã«ãæå®
-
ãã£ãã·ã§ã³ãã¡ã€ã«ã®æ¡åŒµå
ä»»æã®æ¡åŒµåãæå®ã§ããŸãã
-
ç¹°ãè¿ãåæ°
ããããã®ããã¥ã¡ã³ããåèã«åŠç¿ãè¡ã£ãŠãã ããã
ãã£ãã·ã§ã³ãã¿ã°ããŸãšãã管ççšãã¡ã€ã«ãã¡ã¿ããŒã¿ãšåŒã³ãŸããjson圢åŒã§æ¡åŒµå㯠.json
ã§ããäœææ¹æ³ã¯é·ããªããŸãã®ã§ãã®ææžã®æ«å°Ÿã«æžããŸããã
ããã¹ããã¡ã€ã«ãäœæããæ¡åŒµåã .toml
ã«ããŸããããšãã°ä»¥äžã®ããã«èšè¿°ããŸãã
[general]
shuffle_caption = true
keep_tokens = 1
[[datasets]]
resolution = 512 # åŠç¿è§£å床
batch_size = 4 # ããããµã€ãº
[[datasets.subsets]]
image_dir = 'C:\piyo' # åŠç¿çšç»åãå
¥ãããã©ã«ããæå®
metadata_file = 'C:\piyo\piyo_md.json' # ã¡ã¿ããŒã¿ãã¡ã€ã«å
åºæ¬çã«ã¯ä»¥äžãå Žæã®ã¿æžãæããã°åŠç¿ã§ããŸããç¹ã«èšè¿°ããªãéšå㯠DreamBooth, class+identifier æ¹åŒãšåãã§ãã
-
åŠç¿è§£å床
-
ããããµã€ãº
-
ãã©ã«ãæå®
-
ã¡ã¿ããŒã¿ãã¡ã€ã«å
åŸè¿°ã®æ¹æ³ã§äœæããã¡ã¿ããŒã¿ãã¡ã€ã«ãæå®ããŸãã
ããããã®ããã¥ã¡ã³ããåèã«åŠç¿ãè¡ã£ãŠãã ããã
Stable Diffusion ã®v1ã¯512*512ã§åŠç¿ãããŠããŸãããããã«å ããŠ256*1024ã384*640ãšãã£ã解å床ã§ãåŠç¿ããŸããããã«ããããªãã³ã°ãããéšåãæžããããæ£ãããã£ãã·ã§ã³ãšç»åã®é¢ä¿ãåŠç¿ãããããšãæåŸ ãããŸãã
ãŸãä»»æã®è§£å床ã§åŠç¿ãããããäºåã«ç»åããŒã¿ã®çžŠæšªæ¯ãçµ±äžããŠããå¿ èŠããªããªããŸãã
èšå®ã§æå¹ãåãããåãæ¿ããããŸããããããŸã§ã®èšå®ãã¡ã€ã«ã®èšè¿°äŸã§ã¯æå¹ã«ãªã£ãŠããŸãïŒtrue
ãèšå®ãããŠããŸãïŒã
åŠç¿è§£å床ã¯ãã©ã¡ãŒã¿ãšããŠäžãããã解å床ã®é¢ç©ïŒïŒã¡ã¢ãªäœ¿çšéïŒãè¶ ããªãç¯å²ã§ã64ãã¯ã»ã«åäœïŒããã©ã«ããå€æŽå¯ïŒã§çžŠæšªã«èª¿æŽãäœæãããŸãã
æ©æ¢°åŠç¿ã§ã¯å ¥åãµã€ãºããã¹ãŠçµ±äžããã®ãäžè¬çã§ãããç¹ã«å¶çŽãããããã§ã¯ãªããå®éã¯åäžã®ãããå ã§çµ±äžãããŠããã°å€§äžå€«ã§ããNovelAIã®èšãbucketingã¯ããããããæåž«ããŒã¿ããã¢ã¹ãã¯ãæ¯ã«å¿ããåŠç¿è§£å床ããšã«åé¡ããŠããããšãæããŠããããã§ãããããŠããããåbucketå ã®ç»åã§äœæããããšã§ããããã®ç»åãµã€ãºãçµ±äžããŸãã
ãã©ã«ãåã§ç¹°ãè¿ãåæ°ãæå®ããæ¹æ³ã§ãã
åŠç¿çšç»åãæ ŒçŽãããã©ã«ããäœæããŸãã ããã«ãã®äžã« ã以äžã®ååã§ãã£ã¬ã¯ããªãäœæããŸãã
<ç¹°ãè¿ãåæ°>_<identifier> <class>
éã®_
ãå¿ããªãã§ãã ããã
ããšãã°ãsls frogããšããããã³ããã§ãããŒã¿ã20åç¹°ãè¿ãå Žåãã20_sls frogããšãªããŸãã以äžã®ããã«ãªããŸãã
æ¹æ³ã¯åçŽã§ãåŠç¿çšç»åã®ãã©ã«ãå
ã« ç¹°ãè¿ãåæ°_<identifier> <class>
ã®ãã©ã«ããè€æ°ãæ£ååç»åãã©ã«ãã«ãåæ§ã« ç¹°ãè¿ãåæ°_<class>
ã®ãã©ã«ããè€æ°ãçšæããŠãã ããã
ããšãã°ãsls frogããšãcpc rabbitããåæã«åŠç¿ããå Žåã以äžã®ããã«ãªããŸãã
classãã²ãšã€ã§å¯Ÿè±¡ãè€æ°ã®å Žåãæ£ååç»åãã©ã«ãã¯ã²ãšã€ã§æ§ããŸãããããšãã°1girlã«ãã£ã©Aãšãã£ã©Bãããå Žåã¯æ¬¡ã®ããã«ããŸãã
- train_girls
- 10_sls 1girl
- 10_cpc 1girl
- reg_girls
- 1_1girl
åŠç¿çšç»åãæ£ååç»åã®ãã©ã«ãã«ãç»åãšåããã¡ã€ã«åã§ãæ¡åŒµå.captionïŒãªãã·ã§ã³ã§å€ããããŸãïŒã®ãã¡ã€ã«ã眮ããšããã®ãã¡ã€ã«ãããã£ãã·ã§ã³ãèªã¿èŸŒã¿ããã³ãããšããŠåŠç¿ããŸãã
â»ãããã®ç»åã®åŠç¿ã«ããã©ã«ãåïŒidentifier classïŒã¯äœ¿çšãããªããªããŸãã
ãã£ãã·ã§ã³ãã¡ã€ã«ã®æ¡åŒµåã¯ããã©ã«ãã§.captionã§ããåŠç¿ã¹ã¯ãªããã® --caption_extension
ãªãã·ã§ã³ã§å€æŽã§ããŸãã--shuffle_caption
ãªãã·ã§ã³ã§åŠç¿æã®ãã£ãã·ã§ã³ã«ã€ããŠãã«ã³ãåºåãã®åéšåãã·ã£ããã«ããªããåŠç¿ããŸãã
æ£ååç»åã䜿ãå Žåã®æé ã§ãã
æ£ååç»åãæ ŒçŽãããã©ã«ããäœæããŸãã ããã«ãã®äžã« <ç¹°ãè¿ãåæ°>_<class>
ãšããååã§ãã£ã¬ã¯ããªãäœæããŸãã
ããšãã°ãfrogããšããããã³ããã§ãããŒã¿ãç¹°ãè¿ããªãïŒ1åã ãïŒå Žåã以äžã®ããã«ãªããŸãã
ååŠç¿ã¹ã¯ãªãããå®è¡ããŸãã --train_data_dir
ãªãã·ã§ã³ã§åè¿°ã®åŠç¿çšããŒã¿ã®ãã©ã«ããïŒç»åãå«ããã©ã«ãã§ã¯ãªãããã®èŠªãã©ã«ãïŒã--reg_data_dir
ãªãã·ã§ã³ã§æ£ååç»åã®ãã©ã«ãïŒç»åãå«ããã©ã«ãã§ã¯ãªãããã®èŠªãã©ã«ãïŒãæå®ããŠãã ããã
åè¿°ã®ããã«åŠç¿ããããç»åããŒã¿ãçšæããä»»æã®ãã©ã«ãã«å ¥ããŠãã ããã
ããšãã°ä»¥äžã®ããã«ç»åãæ ŒçŽããŸãã
ãã£ãã·ã§ã³ã䜿ããã¿ã°ã ãã§åŠç¿ããå Žåã¯ã¹ãããããŠãã ããã
ãŸãæåã§ãã£ãã·ã§ã³ãçšæããå Žåããã£ãã·ã§ã³ã¯æåž«ããŒã¿ç»åãšåããã£ã¬ã¯ããªã«ãåããã¡ã€ã«åãæ¡åŒµå.captionçã§çšæããŠãã ãããåãã¡ã€ã«ã¯1è¡ã®ã¿ã®ããã¹ããã¡ã€ã«ãšããŸãã
ææ°çã§ã¯BLIPã®ããŠã³ããŒããéã¿ã®ããŠã³ããŒããä»®æ³ç°å¢ã®è¿œå ã¯äžèŠã«ãªããŸããããã®ãŸãŸã§åäœããŸãã
finetuneãã©ã«ãå ã®make_captions.pyãå®è¡ããŸãã
python finetune\make_captions.py --batch_size <ããããµã€ãº> <æåž«ããŒã¿ãã©ã«ã>
ããããµã€ãº8ãæåž«ããŒã¿ã芪ãã©ã«ãã®train_dataã«çœ®ããå Žåã以äžã®ããã«ãªããŸãã
python finetune\make_captions.py --batch_size 8 ..\train_data
ãã£ãã·ã§ã³ãã¡ã€ã«ãæåž«ããŒã¿ç»åãšåããã£ã¬ã¯ããªã«ãåããã¡ã€ã«åãæ¡åŒµå.captionã§äœæãããŸãã
batch_sizeã¯GPUã®VRAM容éã«å¿ããŠå¢æžããŠãã ããã倧ããã»ããéããªããŸãïŒVRAM 12GBã§ãããå°ãå¢ããããšæããŸãïŒã max_lengthãªãã·ã§ã³ã§ãã£ãã·ã§ã³ã®æ倧é·ãæå®ã§ããŸããããã©ã«ãã¯75ã§ããã¢ãã«ãããŒã¯ã³é·225ã§åŠç¿ããå Žåã«ã¯é·ãããŠãè¯ããããããŸããã caption_extensionãªãã·ã§ã³ã§ãã£ãã·ã§ã³ã®æ¡åŒµåãå€æŽã§ããŸããããã©ã«ãã¯.captionã§ãïŒ.txtã«ãããšåŸè¿°ã®DeepDanbooruãšç«¶åããŸãïŒã
è€æ°ã®æåž«ããŒã¿ãã©ã«ããããå Žåã«ã¯ãããããã®ãã©ã«ãã«å¯ŸããŠå®è¡ããŠãã ããã
ãªããæšè«ã«ã©ã³ãã æ§ããããããå®è¡ãããã³ã«çµæãå€ãããŸããåºå®ããå Žåã«ã¯--seedãªãã·ã§ã³ã§ --seed 42
ã®ããã«ä¹±æ°seedãæå®ããŠãã ããã
ãã®ä»ã®ãªãã·ã§ã³ã¯ --help
ã§ãã«ãããåç
§ãã ããïŒãã©ã¡ãŒã¿ã®æå³ã«ã€ããŠã¯ããã¥ã¡ã³ãããŸãšãŸã£ãŠããªãããã§ããœãŒã¹ãèŠããããªãããã§ãïŒã
ããã©ã«ãã§ã¯æ¡åŒµå.captionã§ãã£ãã·ã§ã³ãã¡ã€ã«ãçæãããŸãã
ããšãã°ä»¥äžã®ãããªãã£ãã·ã§ã³ãä»ããŸãã
danbooruã¿ã°ã®ã¿ã°ä»ãèªäœãè¡ããªãå Žåã¯ããã£ãã·ã§ã³ãšã¿ã°æ å ±ã®ååŠçãã«é²ãã§ãã ããã
ã¿ã°ä»ãã¯DeepDanbooruãŸãã¯WD14Taggerã§è¡ããŸããWD14Taggerã®ã»ãã粟床ãè¯ãããã§ããWD14Taggerã§ã¿ã°ä»ãããå Žåã¯ã次ã®ç« ãžé²ãã§ãã ããã
DeepDanbooru https://github.com/KichangKim/DeepDanbooru ãäœæ¥ãã©ã«ãã«cloneããŠããããzipãããŠã³ããŒãããŠå±éããŸããç§ã¯zipã§å±éããŸããã ãŸãDeepDanbooruã®Releasesã®ããŒãž https://github.com/KichangKim/DeepDanbooru/releases ã®ãDeepDanbooru Pretrained Model v3-20211112-sgd-e28ãã®Assetsãããdeepdanbooru-v3-20211112-sgd-e28.zipãããŠã³ããŒãããŠããŠDeepDanbooruã®ãã©ã«ãã«å±éããŸãã
以äžããããŠã³ããŒãããŸããAssetsãã¯ãªãã¯ããŠéããããããããŠã³ããŒãããŸãã
以äžã®ãããªãããããã£ã¬ã¯ããªæ§é ã«ããŠãã ãã
Diffusersã®ç°å¢ã«å¿ èŠãªã©ã€ãã©ãªãã€ã³ã¹ããŒã«ããŸããDeepDanbooruã®ãã©ã«ãã«ç§»åããŠã€ã³ã¹ããŒã«ããŸãïŒå®è³ªçã«ã¯tensorflow-ioãè¿œå ãããã ãã ãšæããŸãïŒã
pip install -r requirements.txt
ç¶ããŠDeepDanbooruèªäœãã€ã³ã¹ããŒã«ããŸãã
pip install .
以äžã§ã¿ã°ä»ãã®ç°å¢æŽåã¯å®äºã§ãã
DeepDanbooruã®ãã©ã«ãã«ç§»åããdeepdanbooruãå®è¡ããŠã¿ã°ä»ããè¡ããŸãã
deepdanbooru evaluate <æåž«ããŒã¿ãã©ã«ã> --project-path deepdanbooru-v3-20211112-sgd-e28 --allow-folder --save-txt
æåž«ããŒã¿ã芪ãã©ã«ãã®train_dataã«çœ®ããå Žåã以äžã®ããã«ãªããŸãã
deepdanbooru evaluate ../train_data --project-path deepdanbooru-v3-20211112-sgd-e28 --allow-folder --save-txt
ã¿ã°ãã¡ã€ã«ãæåž«ããŒã¿ç»åãšåããã£ã¬ã¯ããªã«ãåããã¡ã€ã«åãæ¡åŒµå.txtã§äœæãããŸãã1件ãã€åŠçããããããããšé ãã§ãã
è€æ°ã®æåž«ããŒã¿ãã©ã«ããããå Žåã«ã¯ãããããã®ãã©ã«ãã«å¯ŸããŠå®è¡ããŠãã ããã
以äžã®ããã«çæãããŸãã
ãããªæãã«ã¿ã°ãä»ããŸãïŒãããæ å ±éâŠâŠïŒã
DeepDanbooruã®ä»£ããã«WD14Taggerãçšããæé ã§ãã
Automatic1111æ°ã®WebUIã§äœ¿çšããŠããtaggerãå©çšããŸãããã¡ãã®githubããŒãžïŒhttps://github.com/toriato/stable-diffusion-webui-wd14-tagger#mrsmilingwolfs-model-aka-waifu-diffusion-14-tagger ïŒã®æ å ±ãåèã«ãããŠããã ããŸããã
æåã®ç°å¢æŽåã§å¿ èŠãªã¢ãžã¥ãŒã«ã¯ã€ã³ã¹ããŒã«æžã¿ã§ãããŸãéã¿ã¯Hugging Faceããèªåçã«ããŠã³ããŒãããŠããŸãã
ã¹ã¯ãªãããå®è¡ããŠã¿ã°ä»ããè¡ããŸãã
python tag_images_by_wd14_tagger.py --batch_size <ããããµã€ãº> <æåž«ããŒã¿ãã©ã«ã>
æåž«ããŒã¿ã芪ãã©ã«ãã®train_dataã«çœ®ããå Žåã以äžã®ããã«ãªããŸãã
python tag_images_by_wd14_tagger.py --batch_size 4 ..\train_data
ååèµ·åæã«ã¯ã¢ãã«ãã¡ã€ã«ãwd14_tagger_modelãã©ã«ãã«èªåçã«ããŠã³ããŒããããŸãïŒãã©ã«ãã¯ãªãã·ã§ã³ã§å€ããããŸãïŒã以äžã®ããã«ãªããŸãã
ã¿ã°ãã¡ã€ã«ãæåž«ããŒã¿ç»åãšåããã£ã¬ã¯ããªã«ãåããã¡ã€ã«åãæ¡åŒµå.txtã§äœæãããŸãã
threshãªãã·ã§ã³ã§ãå€å®ãããã¿ã°ã®confidenceïŒç¢ºä¿¡åºŠïŒãããã€ä»¥äžã§ã¿ã°ãã€ããããæå®ã§ããŸããããã©ã«ãã¯WD14Taggerã®ãµã³ãã«ãšåã0.35ã§ããå€ãäžãããšããå€ãã®ã¿ã°ãä»äžãããŸããã粟床ã¯äžãããŸãã
batch_sizeã¯GPUã®VRAM容éã«å¿ããŠå¢æžããŠãã ããã倧ããã»ããéããªããŸãïŒVRAM 12GBã§ãããå°ãå¢ããããšæããŸãïŒãcaption_extensionãªãã·ã§ã³ã§ã¿ã°ãã¡ã€ã«ã®æ¡åŒµåãå€æŽã§ããŸããããã©ã«ãã¯.txtã§ãã
model_dirãªãã·ã§ã³ã§ã¢ãã«ã®ä¿åå ãã©ã«ããæå®ã§ããŸãã
ãŸãforce_downloadãªãã·ã§ã³ãæå®ãããšä¿åå ãã©ã«ãããã£ãŠãã¢ãã«ãåããŠã³ããŒãããŸãã
è€æ°ã®æåž«ããŒã¿ãã©ã«ããããå Žåã«ã¯ãããããã®ãã©ã«ãã«å¯ŸããŠå®è¡ããŠãã ããã
ã¹ã¯ãªããããåŠçããããããã«ãã£ãã·ã§ã³ãšã¿ã°ãã¡ã¿ããŒã¿ãšããŠã²ãšã€ã®ãã¡ã€ã«ã«ãŸãšããŸãã
ãã£ãã·ã§ã³ãã¡ã¿ããŒã¿ã«å
¥ããã«ã¯ãäœæ¥ãã©ã«ãå
ã§ä»¥äžãå®è¡ããŠãã ããïŒãã£ãã·ã§ã³ãåŠç¿ã«äœ¿ããªãå Žåã¯å®è¡äžèŠã§ãïŒïŒå®éã¯1è¡ã§èšè¿°ããŸãã以äžåæ§ïŒã--full_path
ãªãã·ã§ã³ãæå®ããŠã¡ã¿ããŒã¿ã«ç»åãã¡ã€ã«ã®å Žæããã«ãã¹ã§æ ŒçŽããŸãããã®ãªãã·ã§ã³ãçç¥ãããšçžå¯Ÿãã¹ã§èšé²ãããŸããããã©ã«ãæå®ã .toml
ãã¡ã€ã«å
ã§å¥éå¿
èŠã«ãªããŸãã
python merge_captions_to_metadata.py --full_apth <æåž«ããŒã¿ãã©ã«ã>
ã --in_json <èªã¿èŸŒãã¡ã¿ããŒã¿ãã¡ã€ã«å> <ã¡ã¿ããŒã¿ãã¡ã€ã«å>
ã¡ã¿ããŒã¿ãã¡ã€ã«åã¯ä»»æã®ååã§ãã æåž«ããŒã¿ãtrain_dataãèªã¿èŸŒãã¡ã¿ããŒã¿ãã¡ã€ã«ãªããã¡ã¿ããŒã¿ãã¡ã€ã«ãmeta_cap.jsonã®å Žåã以äžã®ããã«ãªããŸãã
python merge_captions_to_metadata.py --full_path train_data meta_cap.json
caption_extensionãªãã·ã§ã³ã§ãã£ãã·ã§ã³ã®æ¡åŒµåãæå®ã§ããŸãã
è€æ°ã®æåž«ããŒã¿ãã©ã«ããããå Žåã«ã¯ãfull_pathåŒæ°ãæå®ãã€ã€ãããããã®ãã©ã«ãã«å¯ŸããŠå®è¡ããŠãã ããã
python merge_captions_to_metadata.py --full_path
train_data1 meta_cap1.json
python merge_captions_to_metadata.py --full_path --in_json meta_cap1.json
train_data2 meta_cap2.json
in_jsonãçç¥ãããšæžã蟌ã¿å ã¡ã¿ããŒã¿ãã¡ã€ã«ããããšããããèªã¿èŸŒã¿ãããã«äžæžãããŸãã
â»in_jsonãªãã·ã§ã³ãšæžã蟌ã¿å ãéœåºŠæžãæããŠãå¥ã®ã¡ã¿ããŒã¿ãã¡ã€ã«ãžæžãåºãããã«ãããšå®å šã§ãã
åæ§ã«ã¿ã°ãã¡ã¿ããŒã¿ã«ãŸãšããŸãïŒã¿ã°ãåŠç¿ã«äœ¿ããªãå Žåã¯å®è¡äžèŠã§ãïŒã
python merge_dd_tags_to_metadata.py --full_path <æåž«ããŒã¿ãã©ã«ã>
--in_json <èªã¿èŸŒãã¡ã¿ããŒã¿ãã¡ã€ã«å> <æžã蟌ãã¡ã¿ããŒã¿ãã¡ã€ã«å>
å ãšåããã£ã¬ã¯ããªæ§æã§ãmeta_cap.jsonãèªã¿ãmeta_cap_dd.jsonã«æžãã ãå Žåã以äžãšãªããŸãã
python merge_dd_tags_to_metadata.py --full_path train_data --in_json meta_cap.json meta_cap_dd.json
è€æ°ã®æåž«ããŒã¿ãã©ã«ããããå Žåã«ã¯ãfull_pathåŒæ°ãæå®ãã€ã€ãããããã®ãã©ã«ãã«å¯ŸããŠå®è¡ããŠãã ããã
python merge_dd_tags_to_metadata.py --full_path --in_json meta_cap2.json
train_data1 meta_cap_dd1.json
python merge_dd_tags_to_metadata.py --full_path --in_json meta_cap_dd1.json
train_data2 meta_cap_dd2.json
in_jsonãçç¥ãããšæžã蟌ã¿å ã¡ã¿ããŒã¿ãã¡ã€ã«ããããšããããèªã¿èŸŒã¿ãããã«äžæžãããŸãã
â»in_jsonãªãã·ã§ã³ãšæžã蟌ã¿å ãéœåºŠæžãæããŠãå¥ã®ã¡ã¿ããŒã¿ãã¡ã€ã«ãžæžãåºãããã«ãããšå®å šã§ãã
ãããŸã§ã§ã¡ã¿ããŒã¿ãã¡ã€ã«ã«ãã£ãã·ã§ã³ãšDeepDanbooruã®ã¿ã°ããŸãšããããŠããŸãããã èªåãã£ãã·ã§ãã³ã°ã«ãããã£ãã·ã§ã³ã¯è¡šèšãããªã©ããã埮åŠïŒâ»ïŒã§ãããã¿ã°ã«ã¯ã¢ã³ããŒã¹ã³ã¢ãå«ãŸããŠãããratingãä»ããŠãããããŸãã®ã§ïŒDeepDanbooruã®å ŽåïŒããšãã£ã¿ã®çœ®ææ©èœãªã©ãçšããŠãã£ãã·ã§ã³ãšã¿ã°ã®ã¯ãªãŒãã³ã°ãããã»ããããã§ãããã
â»ããšãã°ã¢ãã¡çµµã®å°å¥³ãåŠç¿ããå Žåããã£ãã·ã§ã³ã«ã¯girl/girls/woman/womenãªã©ã®ã°ãã€ãããããŸãããŸããanime girlããªã©ãåã«ãgirlããšããã»ããé©åãããããŸããã
ã¯ãªãŒãã³ã°çšã®ã¹ã¯ãªãããçšæããŠãããŸãã®ã§ãã¹ã¯ãªããã®å 容ãç¶æ³ã«å¿ããŠç·šéããŠã䜿ããã ããã
ïŒæåž«ããŒã¿ãã©ã«ãã®æå®ã¯äžèŠã«ãªããŸãããã¡ã¿ããŒã¿å ã®å šããŒã¿ãã¯ãªãŒãã³ã°ããŸããïŒ
python clean_captions_and_tags.py <èªã¿èŸŒãã¡ã¿ããŒã¿ãã¡ã€ã«å> <æžã蟌ãã¡ã¿ããŒã¿ãã¡ã€ã«å>
--in_jsonã¯ä»ããŸããã®ã§ã泚æãã ãããããšãã°æ¬¡ã®ããã«ãªããŸãã
python clean_captions_and_tags.py meta_cap_dd.json meta_clean.json
以äžã§ãã£ãã·ã§ã³ãšã¿ã°ã®ååŠçã¯å®äºã§ãã
â» ãã®ã¹ãããã¯å¿
é ã§ã¯ãããŸãããçç¥ããŠãåŠç¿æã«latentsãååŸããªããåŠç¿ã§ããŸãã
ãŸãåŠç¿æã« random_crop
ã color_aug
ãªã©ãè¡ãå Žåã«ã¯latentsã®äºåååŸã¯ã§ããŸããïŒç»åãæ¯åå€ããªããåŠç¿ããããïŒãäºåååŸãããªãå ŽåããããŸã§ã®ã¡ã¿ããŒã¿ã§åŠç¿ã§ããŸãã
ãããããç»åã®æœåšè¡šçŸãååŸããã£ã¹ã¯ã«ä¿åããŠãããŸããããã«ãããåŠç¿ãé«éã«é²ããããšãã§ããŸããããããŠbucketingïŒæåž«ããŒã¿ãã¢ã¹ãã¯ãæ¯ã«å¿ããŠåé¡ããïŒãè¡ããŸãã
äœæ¥ãã©ã«ãã§ä»¥äžã®ããã«å ¥åããŠãã ããã
python prepare_buckets_latents.py --full_path <æåž«ããŒã¿ãã©ã«ã>
<èªã¿èŸŒãã¡ã¿ããŒã¿ãã¡ã€ã«å> <æžã蟌ãã¡ã¿ããŒã¿ãã¡ã€ã«å>
<fine tuningããã¢ãã«åãŸãã¯checkpoint>
--batch_size <ããããµã€ãº>
--max_resolution <解å床 å¹
,é«ã>
--mixed_precision <粟床>
ã¢ãã«ãmodel.ckptãããããµã€ãº4ãåŠç¿è§£å床ã¯512*512ã粟床noïŒfloat32ïŒã§ãmeta_clean.jsonããã¡ã¿ããŒã¿ãèªã¿èŸŒã¿ãmeta_lat.jsonã«æžã蟌ãå Žåã以äžã®ããã«ãªããŸãã
python prepare_buckets_latents.py --full_path
train_data meta_clean.json meta_lat.json model.ckpt
--batch_size 4 --max_resolution 512,512 --mixed_precision no
æåž«ããŒã¿ãã©ã«ãã«numpyã®npz圢åŒã§latentsãä¿åãããŸãã
解å床ã®æå°ãµã€ãºã--min_bucket_resoãªãã·ã§ã³ã§ãæ倧ãµã€ãºã--max_bucket_resoã§æå®ã§ããŸããããã©ã«ãã¯ãããã256ã1024ã§ããããšãã°æå°ãµã€ãºã«384ãæå®ãããšã256*1024ã320*768ãªã©ã®è§£å床ã¯äœ¿ããªããªããŸãã 解å床ã768*768ã®ããã«å€§ããããå Žåãæ倧ãµã€ãºã«1280ãªã©ãæå®ãããšè¯ãã§ãããã
--flip_augãªãã·ã§ã³ãæå®ãããšå·Šå³å転ã®augmentationïŒããŒã¿æ¡åŒµïŒãè¡ããŸããç䌌çã«ããŒã¿éãäºåã«å¢ããããšãã§ããŸãããããŒã¿ãå·Šå³å¯Ÿç§°ã§ãªãå Žåã«æå®ãããšïŒäŸãã°ãã£ã©ã¯ã¿ã®å€èŠã髪åãªã©ïŒåŠç¿ãããŸãè¡ããªããªããŸãã
ïŒå転ããç»åã«ã€ããŠãlatentsãååŸãã*_flip.npzãã¡ã€ã«ãä¿åããåçŽãªå®è£ ã§ããfline_tune.pyã«ã¯ç¹ã«ãªãã·ã§ã³æå®ã¯å¿ èŠãããŸããã_flipä»ãã®ãã¡ã€ã«ãããå Žåãflipä»ãã»ãªãã®ãã¡ã€ã«ããã©ã³ãã ã«èªã¿èŸŒã¿ãŸããïŒ
ããããµã€ãºã¯VRAM 12GBã§ãããå°ãå¢ããããããããŸããã 解å床ã¯64ã§å²ãåããæ°åã§ã"å¹ ,é«ã"ã§æå®ããŸãã解å床ã¯fine tuningæã®ã¡ã¢ãªãµã€ãºã«çŽçµããŸããVRAM 12GBã§ã¯512,512ãéçãšæãããŸãïŒâ»ïŒã16GBãªã512,704ã512,768ãŸã§äžãããããããããŸããããªã256,256çã«ããŠãVRAM 8GBã§ã¯å³ããããã§ãïŒãã©ã¡ãŒã¿ãoptimizerãªã©ã¯è§£å床ã«é¢ä¿ããäžå®ã®ã¡ã¢ãªãå¿ èŠãªããïŒã
â»batch size 1ã®åŠç¿ã§12GB VRAMã640,640ã§åãããšã®å ±åããããŸããã
以äžã®ããã«bucketingã®çµæã衚瀺ãããŸãã
è€æ°ã®æåž«ããŒã¿ãã©ã«ããããå Žåã«ã¯ãfull_pathåŒæ°ãæå®ãã€ã€ãããããã®ãã©ã«ãã«å¯ŸããŠå®è¡ããŠãã ããã
python prepare_buckets_latents.py --full_path
train_data1 meta_clean.json meta_lat1.json model.ckpt
--batch_size 4 --max_resolution 512,512 --mixed_precision no
python prepare_buckets_latents.py --full_path
train_data2 meta_lat1.json meta_lat2.json model.ckpt
--batch_size 4 --max_resolution 512,512 --mixed_precision no
èªã¿èŸŒã¿å ãšæžã蟌ã¿å ãåãã«ããããšãå¯èœã§ããå¥ã ã®æ¹ãå®å šã§ãã
â»åŒæ°ãéœåºŠæžãæããŠãå¥ã®ã¡ã¿ããŒã¿ãã¡ã€ã«ã«æžã蟌ããšå®å šã§ãã