Package: civitdl-z
civitdl (civitai-batch-download)Uses CLI to batch download Stable Diffusion models from CivitAI, metadata (including description of model, author, base model, example prompts and etc.) and example images (default is 3) of checkpoint and lora models. One thing to note is that forsfw models, currently, the program is set to onlydownload sfw images. Please note that there may be sfw models that are rated as nsfw by CivitAI (and vice versa).DescriptionThere are two ways to batch download using this script (NOTE: batchdir has been removed):batchfile -> given the path to a comma separated text file (recommend .txt) that contains numbers or urls, it extracts all of the model ids from the file.batchstr -> specify a comma separated list of model id and/or url as arguments.Getting StartedDependenciesPython3requirements.txtInstallingInstall using PIPpip3 install civitdlUsepip install civitdlifpip3is not found.Build from sourceDownload the project:git clone https://github.com/OwenTruong/civitdl.gitInside terminal, run:cd civitdlThen run:pip3 install -r requirements.txtUsepip install -r requirements.txtifpip3is not found.Then run:make installNow the module is available globally (example):civitdl batchstr 123456 ./TroubleshootingIf you encounter the following warning on Linux:WARNING:Thescriptcivitdlisinstalledin'/home/OwenTruong/.local/bin'whichisnotonPATH.ConsideraddingthisdirectorytoPATHor,ifyouprefertosuppressthiswarning,use--no-warn-script-location.Please concat the path to your PATH env, example:echo'PATH="$HOME/.local/bin:"$PATH'>>~/.bashrcsource~/.bashrcExecuting programbatchfileArgs:civitdl batchfile <txt file path> <destination model folder path>Make sure everything is comma separated. txt files are recommended.The comma separated list can be made out of model id, civitai.com/models or civitai.com/api/download/models urls.If you need a specific version of a model, copy paste the url of the specific version in the txt file, and it would download the correct one.Example of a url with a specific version id:https://civitai.com/models/197273?modelVersionId=221861Examples:civitdl batchfile ./custom/batchfile.txt ~/sorted-models --filter=tagscivitdl batchfile ./custom/batchfile.txt ~/sorted-models --custom-filter=./custom/filter.pySeebatchfile.txtfor example of a batchfilebatchstrArgs:civitdl batchstr <comma separated string of model id / url> <destination model folder path>Accepts model id or urls separated by commas as an argument (accepts the same type of comma separated list as batchfile).Examples:civitdl batchstr "https://civitai.com/models/7808/easynegative, 79326" ~/Downloads/ComfyUI/models/lorasFiltersBeyond downloading models, it is possible to specify some filters, or rules, on how to organize the model folders when batch downloading multiple models.There are two built-in filters: tags and basic."tags" filters the models by the model type (i.e. if lora is trained on a 1.5 or 2.0 or SDXL base model) and tags associated with them on CivitAI.Example, if a model was trained on 1.5, and has tags - Anime, Character -, it would be filtered as so:Running script:civitdl batchstr 123456 ~/models --filter="tags"~/models/SD_1.5/Anime/Character/yaemiko-lora-nochekaiser/yaemiko-lora-nochekaiser-mid_123456-vid_134605.safetensorsSeefilters.pyfor available tags in the filter."basic" does not filter anything. It just downloads all of the models' data inside destination path folder specified in the arguments. It is also the default filter function used.Example:Running script:civitdl batchstr "123456" ~/modelsThe model for 123456 is a Yae Miko character lora. The folder that includes the models folder, json and example images are stored in the following path: ~/models/yaemiko-lora-nochekaiserCreating Custom FiltersTo create a custom filter, please create a python file with any filename. The only thing that is important is that the python file must contain a function called filter_model that has the following signatures: filter_model(Dict,Dict,str,str) -> strPlease seefilter.pyin custom folder for an example.Other examples include the built in onefilters.py.HelpPlease create an issue if you encounter any problem, bugs or if you have a feature request.LicenseThis project is licensed under the MIT License - see the LICENSE.md file for details