|
#!/bin/bash |
|
|
|
|
|
train_data_dir="./input" |
|
repo_id="SmilingWolf/wd-v1-4-swinv2-tagger-v2" |
|
model_dir="" |
|
batch_size=12 |
|
max_data_loader_n_workers=0 |
|
thresh=0.35 |
|
general_threshold=0.35 |
|
character_threshold=0.1 |
|
remove_underscore=0 |
|
undesired_tags="" |
|
recursive=0 |
|
frequency_tags=0 |
|
|
|
|
|
|
|
|
|
export HF_HOME="huggingface" |
|
export TF_CPP_MIN_LOG_LEVEL=3 |
|
extArgs=() |
|
|
|
if [ -n "$repo_id" ]; then |
|
extArgs+=( "--repo_id=$repo_id" ) |
|
fi |
|
|
|
if [ -n "$model_dir" ]; then |
|
extArgs+=( "--model_dir=$model_dir" ) |
|
fi |
|
|
|
if [[ $batch_size -ne 0 ]]; then |
|
extArgs+=( "--batch_size=$batch_size" ) |
|
fi |
|
|
|
if [ -n "$max_data_loader_n_workers" ]; then |
|
extArgs+=( "--max_data_loader_n_workers=$max_data_loader_n_workers" ) |
|
fi |
|
|
|
if [ -n "$general_threshold" ]; then |
|
extArgs+=( "--general_threshold=$general_threshold" ) |
|
fi |
|
|
|
if [ -n "$character_threshold" ]; then |
|
extArgs+=( "--character_threshold=$character_threshold" ) |
|
fi |
|
|
|
if [ "$remove_underscore" -eq 1 ]; then |
|
extArgs+=( "--remove_underscore" ) |
|
fi |
|
|
|
if [ -n "$undesired_tags" ]; then |
|
extArgs+=( "--undesired_tags=$undesired_tags" ) |
|
fi |
|
|
|
if [ "$recursive" -eq 1 ]; then |
|
extArgs+=( "--recursive" ) |
|
fi |
|
|
|
if [ "$frequency_tags" -eq 1 ]; then |
|
extArgs+=( "--frequency_tags" ) |
|
fi |
|
|
|
|
|
|
|
accelerate launch --num_cpu_threads_per_process=8 "./sd-scripts/finetune/tag_images_by_wd14_tagger.py" \ |
|
$train_data_dir \ |
|
--thresh=$thresh \ |
|
--caption_extension .txt \ |
|
${extArgs[@]} |
|
|