civitdl-z


Namecivitdl-z JSON
Version 1.2.4 PyPI version JSON
download
home_page
SummaryPackage for batch downloading models from civitai.com
upload_time2023-12-11 08:37:23
maintainer
docs_urlNone
authorOwen Truong
requires_python>=3.6
licenseMIT License Copyright (c) 2023 Owen Truong Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords civitai batch download
VCS
bugtrack_url
requirements requests build termcolor tqdm
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 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 for **sfw models**, currently, the program is set to only **download sfw images**. Please note that there may be sfw models that are rated as nsfw by CivitAI (and vice versa).

## Description

There 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 Started

### Dependencies
* Python3
* `requirements.txt`


### Installing

#### Install using PIP
* `pip3 install civitdl`
  * Use `pip install civitdl` if `pip3` is not found.

#### Build from source
* Download the project:
    * `git clone https://github.com/OwenTruong/civitdl.git`
* Inside terminal, run:
    * `cd civitdl`
* Then run:
    * `pip3 install -r requirements.txt`
        * Use `pip install -r requirements.txt ` if `pip3` is not found.
* Then run:
    * `make install`
* Now the module is available globally (example):
    * `civitdl batchstr 123456 ./`

#### Troubleshooting

If you encounter the following warning on Linux:
```bash
  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.
```
Please concat the path to your PATH env, example:
```bash
echo 'PATH="$HOME/.local/bin:"$PATH' >> ~/.bashrc
source ~/.bashrc
```


### Executing program

#### batchfile 
* Args: 
    * `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=221861`
* Examples:
    * `civitdl batchfile ./custom/batchfile.txt ~/sorted-models --filter=tags`
    * `civitdl batchfile ./custom/batchfile.txt ~/sorted-models --custom-filter=./custom/filter.py`
* See [batchfile.txt](./custom/batchfile.txt) for example of a batchfile


#### batchstr
* Args: 
    * `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/loras`

#### Filters
* Beyond 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.safetensors`
        * See [filters.py](./src/civitai_batch_download/filters.py?plain=1#L13) for 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" ~/models`
            * The 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-nochekaiser

#### Creating Custom Filters
* To 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) -> str
* Please see [filter.py](./custom/filter.py) in custom folder for an example.
  * Other examples include the built in one [filters.py](./src/civitai_batch_download/filters.py).



## Help

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

## License

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

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "civitdl-z",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": "",
    "keywords": "civitai,batch download",
    "author": "Owen Truong",
    "author_email": "",
    "download_url": "",
    "platform": null,
    "description": "# civitdl (civitai-batch-download)\r\n\r\nUses 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 for **sfw models**, currently, the program is set to only **download sfw images**. Please note that there may be sfw models that are rated as nsfw by CivitAI (and vice versa).\r\n\r\n## Description\r\n\r\nThere are two ways to batch download using this script (NOTE: batchdir has been removed):\r\n- 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.\r\n- batchstr -> specify a comma separated list of model id and/or url as arguments.\r\n\r\n## Getting Started\r\n\r\n### Dependencies\r\n* Python3\r\n* `requirements.txt`\r\n\r\n\r\n### Installing\r\n\r\n#### Install using PIP\r\n* `pip3 install civitdl`\r\n  * Use `pip install civitdl` if `pip3` is not found.\r\n\r\n#### Build from source\r\n* Download the project:\r\n    * `git clone https://github.com/OwenTruong/civitdl.git`\r\n* Inside terminal, run:\r\n    * `cd civitdl`\r\n* Then run:\r\n    * `pip3 install -r requirements.txt`\r\n        * Use `pip install -r requirements.txt ` if `pip3` is not found.\r\n* Then run:\r\n    * `make install`\r\n* Now the module is available globally (example):\r\n    * `civitdl batchstr 123456 ./`\r\n\r\n#### Troubleshooting\r\n\r\nIf you encounter the following warning on Linux:\r\n```bash\r\n  WARNING: The script civitdl is installed in '/home/OwenTruong/.local/bin' which is not on PATH.\r\n  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.\r\n```\r\nPlease concat the path to your PATH env, example:\r\n```bash\r\necho 'PATH=\"$HOME/.local/bin:\"$PATH' >> ~/.bashrc\r\nsource ~/.bashrc\r\n```\r\n\r\n\r\n### Executing program\r\n\r\n#### batchfile \r\n* Args: \r\n    * `civitdl batchfile <txt file path> <destination model folder path>`\r\n* Make sure everything is comma separated. txt files are recommended. \r\n* The comma separated list can be made out of model id, civitai.com/models or civitai.com/api/download/models urls. \r\n* 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.\r\n  * Example of a url with a specific version id: `https://civitai.com/models/197273?modelVersionId=221861`\r\n* Examples:\r\n    * `civitdl batchfile ./custom/batchfile.txt ~/sorted-models --filter=tags`\r\n    * `civitdl batchfile ./custom/batchfile.txt ~/sorted-models --custom-filter=./custom/filter.py`\r\n* See [batchfile.txt](./custom/batchfile.txt) for example of a batchfile\r\n\r\n\r\n#### batchstr\r\n* Args: \r\n    * `civitdl batchstr <comma separated string of model id / url> <destination model folder path>`\r\n* Accepts model id or urls separated by commas as an argument (accepts the same type of comma separated list as batchfile).\r\n* Examples:\r\n    * `civitdl batchstr \"https://civitai.com/models/7808/easynegative, 79326\" ~/Downloads/ComfyUI/models/loras`\r\n\r\n#### Filters\r\n* Beyond downloading models, it is possible to specify some filters, or rules, on how to organize the model folders when batch downloading multiple models.\r\n* There are two built-in filters: tags and basic.\r\n    * \"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. \r\n        * Example, if a model was trained on 1.5, and has tags - Anime, Character -, it would be filtered as so: \r\n          * Running script: `civitdl batchstr 123456 ~/models --filter=\"tags\"`\r\n            * `~/models/SD_1.5/Anime/Character/yaemiko-lora-nochekaiser/yaemiko-lora-nochekaiser-mid_123456-vid_134605.safetensors`\r\n        * See [filters.py](./src/civitai_batch_download/filters.py?plain=1#L13) for available tags in the filter.\r\n    * \"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.\r\n        * Example: \r\n            * Running script: `civitdl batchstr \"123456\" ~/models`\r\n            * The 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-nochekaiser\r\n\r\n#### Creating Custom Filters\r\n* To 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) -> str\r\n* Please see [filter.py](./custom/filter.py) in custom folder for an example.\r\n  * Other examples include the built in one [filters.py](./src/civitai_batch_download/filters.py).\r\n\r\n\r\n\r\n## Help\r\n\r\nPlease create an issue if you encounter any problem, bugs or if you have a feature request.\r\n\r\n## License\r\n\r\nThis project is licensed under the MIT License - see the LICENSE.md file for details\r\n",
    "bugtrack_url": null,
    "license": "MIT License  Copyright (c) 2023 Owen Truong  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ",
    "summary": "Package for batch downloading models from civitai.com",
    "version": "1.2.4",
    "project_urls": {
        "Bug Tracker": "https://github.com/OwenTruong/civitdl/issues",
        "Repository": "https://github.com/OwenTruong/civitdl"
    },
    "split_keywords": [
        "civitai",
        "batch download"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "70eb10ee7796d8d086fa26bc37c937e775e500ce1d747a51d79accb64a126a0e",
                "md5": "564c70cc704c2bb688ffdf665fe75fa1",
                "sha256": "281a17db27540a1f5ab5a104a5c503623f772b1b7a66d900094793ba7c5689bc"
            },
            "downloads": -1,
            "filename": "civitdl_z-1.2.4-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "564c70cc704c2bb688ffdf665fe75fa1",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 11926,
            "upload_time": "2023-12-11T08:37:23",
            "upload_time_iso_8601": "2023-12-11T08:37:23.537582Z",
            "url": "https://files.pythonhosted.org/packages/70/eb/10ee7796d8d086fa26bc37c937e775e500ce1d747a51d79accb64a126a0e/civitdl_z-1.2.4-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-12-11 08:37:23",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "OwenTruong",
    "github_project": "civitdl",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "requests",
            "specs": []
        },
        {
            "name": "build",
            "specs": []
        },
        {
            "name": "termcolor",
            "specs": []
        },
        {
            "name": "tqdm",
            "specs": []
        }
    ],
    "lcname": "civitdl-z"
}
        
Elapsed time: 0.14991s