Sign In

Tips for the Lazy Lora Makers (mac)

Tips for the Lazy Lora Makers (mac)


Making a lora can be a tedious process. Personnaly i love hoarding pics, but i hate wasting my time on the "technical" stuff. Hopefully most of it can be be done very fast and painlessly with the help of the Terminal and few other tools. This is not a pro step-by-step guide. Simply few tips i use, that can be useful for Mac users :

Hoarding pics :

First step is to get a dataset. Some tools :

Preparing the pics :

  • Birme, everybody know this one i guess. I don't crop anymore though. Not sure if ultimately needed but it's not an advice.

Now some terminal stuff :

⚠️ using terminal command wrong can permanently delete your pics or captions. ALWAYS - ALWAYS - ALWAYS keep your original folder, and copy it for exemple on your desktop to test on it, keep track of your pics number and copy at every step to not lose all the progress like a cunt ! ⚠️

Before entering any command, write "cd ", (one space after cd) drop your folder path and press enter. Exemple : cd /Users/Cunty. After that use TextEdit to Edit your Text (ooh) and copy paste your command and type enter. Change only yournewfilename and keyword.

Batch renaming :

Batch rename every jpg, png and jpeg files :

i=1; for file in *.jpg *.png *.jpeg; do if [ -f "$file" ]; then new_name="yournewfilename ($i).${file##*.}"; while [ -e "$new_name" ]; do ((i++)); new_name="yournewfilename ($i).${file##*.}"; done; mv "$file" "$new_name"; ((i++)); fi; done

Batch rename every .txt files : 

i=1; for file in *.txt; do new_name="yournewfilename ($i).txt"; while [ -e "$new_name" ]; do ((i++)); new_name="yournewfilename ($i).txt"; done; mv "$file" "$new_name"; ((i++)); done

Batch replace a word in all files names :

for file in *.txt *.jpeg *.jpg *.pics *.png; do mv "$file" "${file/youractualfilenameORjust1word/yournewfilenameORnewword}"; done

Create a number of .txt files with keywords inside :

for i in {1..yourtotalnumberofimages}; do echo "keyword, keyword, " > "yournewfilenamethesameaspics ($i).txt"; done

or :

i=1; for file in *.jpg *.png *.jpeg; do new_name="yournewfilenamesameaspics ($i).txt"; echo "keyword, keyword, " > "$new_name"; ((i++)); done

Additional batch captionning :

Add one or more keywords at the end of .txt files :

word_to_add="keyword, keyword, "; for file in *.txt; do sed -i '' "s/$/ $word_to_add/" "$file"; done

Delete a keyword in all .txt files :

sed -i '' 's/keyword, //g' *.txt

Dataset Maker Colab : Alternative for captionning


See a png metadata :

Write "exiftool " -note the space after exiftool- then drop your png (one or multiple).

Here it is. If you want your .txt files to not be a mess, try to think of spaces and commas.

I hope it will help some people who are maybe doing this manually so they will waste less time on this. If you have any problem ChatGpt is the best way to solve it.

Kiss ✌️