You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've only tested this on loras so far, but that's all I wanted it for for now.
How to use:
Install the sd-civitai-browser-plus extension inside A1111
Go to CivitAI Browser+ -> Update Models
Click Update model info & tags
Wait until it's finished
Open a terminal with Bash (zsh should be fine if you're on MacOS) (If on Windows, look up how to use bash in Windows)
Install jq so that the script can query the json. (If you're on an Ubuntu-based system, that's apt install jq in the terminal)
cd to the base directory for the type or model that you are organizing (i.e. if it's loras and the directory is loras/ then change to that directory.
Copy and paste the following bash script into your favorite text editor (No, Microsoft Word is not a text editor)
Edit the top two variables to suit your needs.
Copy and paste your modified script into your terminal (line breaks and all) and hit enter.
It searches through your entire directory recursively twice, once for the .api_info.json file and again for the matching files. That's because I had made a few mistakes earlier and some of my files got separated into different folders. This fixes that mistake.
#!/bin/bash# Change these variables to match your needs
target_base_model="SD 1.5"# find this base model in the .api_info.json files under the "modelVersions" key
destination_dir="./sd1-5"# must start with a "./" to to be compared correctly with the found_file_directory.# and no trailing slash either. Not strictly required though. It just prevents the script from doing extra work.# for every .api_info.json file recursively, even with spaces...
find . -name "*.api_info.json" -print0 |while IFS= read -r -d '' json_file;do
base_filename=$(basename "$json_file" .api_info.json)
found_file_directory=$(dirname "$json_file")
base_model=$(jq -r '.modelVersions[0].baseModel'"$json_file")if [ "$base_model"=="$target_base_model" ];thenif [ "$found_file_directory"!="$destination_dir" ];then
mkdir -p $destination_dir
find . -name "${base_filename}.*" -type f -exec mv {} "$destination_dir"\;echo"\"$base_filename\" files moved to $destination_dir"fifidone
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I've only tested this on loras so far, but that's all I wanted it for for now.
How to use:
CivitAI Browser+
->Update Models
Update model info & tags
jq
so that the script can query the json. (If you're on an Ubuntu-based system, that'sapt install jq
in the terminal)cd
to the base directory for the type or model that you are organizing (i.e. if it's loras and the directory isloras/
then change to that directory.It searches through your entire directory recursively twice, once for the
.api_info.json
file and again for the matching files. That's because I had made a few mistakes earlier and some of my files got separated into different folders. This fixes that mistake.Beta Was this translation helpful? Give feedback.
All reactions