Skip to main content

CLI tool that easily converts a directory of images into a dataset for training generative ai models

Project description

ecko-cli

[!IMPORTANT] This tool makes use of the SmilingWolf/wd-eva02-large-tagger-v3 library, which you will need to download and place in the models directory inside the ecko_cli folder of this project. Make sure to not rename the file as the script will be looking for model.onnx.

Huggingface Repo

[!IMPORTANT] This tool makes use of the flash-attention library, which has known to be problematic to install based on PyTorch > and CUDA versions. You may need to install the dependencies manually if you encounter issues. The way to install flash-attention is to clone > the repo and install the package with pip. This is the recommended way to install the package. You can also install the package with pip, but you will need to clone the repo first

git clone https://github.com/Dao-AILab/flash-attention.git
cd flash-attention
pip install flash_attn --no-build-isolation
pip install timm

Install via pipx

pipx inject ecko-cli flash_attn
pipx inject ecko-cli timm

Install via the CLI

ecko tools install-flash-attention

[!NOTE] You may notice a delay when first using the tool...normally this means that the models are being downloaded/update from huggingface or that they are being moved to your GPU. Check your terminal to make see progress

Overview

ecko-cli is a simple CLI tool that streamlines the process of processingimages in a directory, generating captions, and saving them as text files. Additionally, it provides functionalities to create a JSONL file from images in the directory you specify. Images will be captioned using the Microsoft Florence-2-large model and the ONNX Runtime engine. Images are resized to multiple sizes for better captioning results. [1024, 768, 672, 512]. The WD14 model is used for captioning all images based on a modified version of the selected tags it was trained on.

screenshot

Why

I wanted to create a tool that would allow me to process images in bulk quickly and efficiently for using in generative art projects. This tool allows me to generate captions for images that I can use as training data captions for my training LORAs (Large OpenAI Research Agents) and other generative models.

Installation (Recommended)

You have a couple of options for installing/running the tool:

Install pipx, then run the tool with the following command

pipx install ecko-cli

Alternatively, you can install using pip

pip install .

Configuration

[!IMPORTANT] Before using the tool, It's required to set up a .env file in the parent directory of the script or your home user dir [windows] or $HOME/.config/civitai-cli-manager/.env

The application intelligently locates your .env file, accommodating various platforms like Windows and Linux, or defaulting to the current directory.

Usage // Available Commands

Once installed via pipx or pip:

ecko-cli process-images /path/to/images watercolors --padding 4
ecko-cli process-images /path/to/images doors --is_object True
ecko-cli process-images /path/to/images doors --trigger WORD
ecko-cli create-jsonl /path/to/images [dataset]

Dependencies

This tool requires Python 3.11 or higher and has the following dependencies:

"typer",
"rich",
"shellingham",
"python-dotenv",
"onnxruntime-gpu",
"numpy",
"pandas",
"torch",
"pillow",
"einops"
"transformers"
"timm"
"huggingface_hub[cli]"

Contact

For any inquiries, feedback, or suggestions, please feel free to open an issue on this repository.

License

This project is licensed under the MIT License.


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

ecko_cli-1.3.0.tar.gz (262.0 kB view details)

Uploaded Source

Built Distribution

ecko_cli-1.3.0-py3-none-any.whl (263.6 kB view details)

Uploaded Python 3

File details

Details for the file ecko_cli-1.3.0.tar.gz.

File metadata

  • Download URL: ecko_cli-1.3.0.tar.gz
  • Upload date:
  • Size: 262.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.2

File hashes

Hashes for ecko_cli-1.3.0.tar.gz
Algorithm Hash digest
SHA256 0880578a2ad0edd5385f1324d3f7f8fa6fd0a057145fffe33452b532fc4a7ed9
MD5 e8ff5775fcd7f64142e6ee881d05177f
BLAKE2b-256 9490e95383ffa0675ae28646676b8660ddb1e942354fe7829de8d1361ad11e21

See more details on using hashes here.

File details

Details for the file ecko_cli-1.3.0-py3-none-any.whl.

File metadata

  • Download URL: ecko_cli-1.3.0-py3-none-any.whl
  • Upload date:
  • Size: 263.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.2

File hashes

Hashes for ecko_cli-1.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2db9e9cf534058a9698aed16446ceb7adebc77494b361e62d5da87e7e5cdd87c
MD5 6a38a3368ebebd2fdefa9b6b4871df39
BLAKE2b-256 c7e8c821a81e3a7164e73c639af6a9afdaff4b34673d3b57bed58f8e0d306c7a

See more details on using hashes here.

Supported by

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