Skip to main content

Package for batch downloading models from civitai.com

Project description

civitdl (civitai-batch-download)

(QUICK NOTE: CivitAI seems to have changed their API so that it will require an API key for all model downloads, please see API Key Page for instructions)

Note v2 has some changes regarding the cli args of the program. Please read the README below or run civitdl --help for the new arguments!

Uses CLI to batch download Stable Diffusion models, metadata (including description of model, author, base model, example prompts and etc.) and example images (default is 3) of checkpoints, loras, and TI models from civitai!


Navigate


Table Of Contents


Getting Started

Dependencies

  • Python3.8 or above
  • requirements.txt

Installing

Install using PIP

pip3 install civitdl 
# pip install civitdl # if pip3 is not found

Build from source 1

git clone https://github.com/OwenTruong/civitdl.git # Clone the project
cd civitdl # CD into project directory
pip3 install . # Use pip if pip3 is not found

Build from source 2 (if the instruction above fails with UNKNOWN package installed, else ignore this section)

# Make sure you are in project directory # use pip if pip3 is not found
python3 -m build
pip3 install -r ./requirements.txt
pip3 install --upgrade dist/*.whl

Quick Start

To get started quickly, copy the command below.

civitdl 123456 ./models
  • Replace 123456 with your model of choice (it can be a civitai.com url or model id).
  • Replace ./models with the directory you wish to download the model to.

Example with url:

civitdl https://civitai.com/models/123456 ./models

Configuration Program Options - civitconfig

  • Configuring the program might make your life easier. You would be able to set default sorter, max images, and api key to use without running any of those options in the main program!
    • You would also be able to add and delete sorters and aliases from the program.
    • Check civitconfig doc.
  • Run civitconfig --help to check what options are available!

Changes in v2 from v1

  • basic and tags sorter now downloads metadata and images to /parent_dir/extra_data/ instead of to /parent_dir/
  • Sorter is now more flexible/customizable (i.e. able to select individual paths model, metadata and images should go to)
  • Added support for providing API Key to program to download restricted models.
  • Added multiple new options to the main program, civitdl.
  • Added configuration to set defaults for options, and to create alias + sorters.
  • Concurrently download images.
  • Isolates each image's prompt/metadata from the model's metadata.
  • Able to retry download if model fails initially.
  • Faster requests.
  • Added features to skip model download if model already exists in path, or locally in cache.

Troubleshooting


If you encounter similar warning on Linux/Windows while building and installing manually:

  WARNING: The script civitdl is installed in '/home/OwenTruong/.local/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.

For Linux, please concat the path to your PATH env, example:

echo 'PATH="$HOME/.local/bin:"$PATH' >> ~/.bashrc
source ~/.bashrc

For Windows, this may help: https://www.computerhope.com/issues/ch000549.htm

If you are building from source and the following packages are not available setuptools, wheel, build, please install them with pip install setuptools wheel build



Contributing

Thanks for the interest in the project!

Please create an issue if you encounter any problem, bugs or if you have a feature request.

To debug things, it is recommended to run with --verbose option.

  • Running in verbose allows users to print tracebacks and other messages useful for debugging.
  • Example: civitdl 123456 ./models --verbose

To work on an issue:

  • Please create a fork.
  • Then clone your fork locally.
  • Then create a local branch that describes the issue.
  • Once you have commited your changes, push the branch to your forked repository.
  • Then open a pull request to this repository.

License

This project is licensed under the Apache License 2.0 - see the LICENSE.md file for details

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

civitdl-2.1.2.tar.gz (43.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

civitdl-2.1.2-py3-none-any.whl (44.7 kB view details)

Uploaded Python 3

File details

Details for the file civitdl-2.1.2.tar.gz.

File metadata

  • Download URL: civitdl-2.1.2.tar.gz
  • Upload date:
  • Size: 43.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for civitdl-2.1.2.tar.gz
Algorithm Hash digest
SHA256 7c7695ef55d0c9e2c7e5731b14252265e672d452ed56a9684623bc1ea41f2061
MD5 55bcfee6730a91eb028d0caff9cc9aab
BLAKE2b-256 0cf51aa26ccb366e6403991c0ee3a9c7de226902dfa648c2396c8e83c4bb116e

See more details on using hashes here.

Provenance

The following attestation bundles were made for civitdl-2.1.2.tar.gz:

Publisher: publish.yml on OwenTruong/civitdl

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file civitdl-2.1.2-py3-none-any.whl.

File metadata

  • Download URL: civitdl-2.1.2-py3-none-any.whl
  • Upload date:
  • Size: 44.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for civitdl-2.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 c2a01f1dec65ea047968045906bd1ebf9b3bfda807b230391b6e6c1ff8a03a5f
MD5 f120611dbe8c2d915403b85a9b5cadcf
BLAKE2b-256 f869d570805aa07749a227a27cdbc05d53a4741546b95e503db5756a7edc5cd6

See more details on using hashes here.

Provenance

The following attestation bundles were made for civitdl-2.1.2-py3-none-any.whl:

Publisher: publish.yml on OwenTruong/civitdl

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page