CLI tool that easily converts a directory of images into a dataset for training generative ai models
Project description
ecko-cli
[!IMPORTANT] This tools has the option to now use the JoyCaption model for captioning images. You will need to have huggingface hub installed to download the model and the tokenizer. Also JoyCaption is a large model and will require a GPU with a healthy amount of memory. Demo on Huggingface // 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 firstgit clone https://github.com/Dao-AILab/flash-attention.git cd flash-attention pip install flash_attn --no-build-isolation pip install timmInstall via pipx
pipx inject ecko-cli flash_attn pipx inject ecko-cli timmInstall 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 MiaoshouAI/Florence-2-base-PromptGen-v2.0 model. Images are resized to multiple sizes for better captioning results. [1024, 768, 672, 512].
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/ecko-cli-itsjustregi/.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 process-images /path/to/images watercolors --padding 4
ecko process-images --use_joy_cap /path/to/images watercolors --padding 4
ecko process-images /path/to/images doors --is_object True
ecko process-images /path/to/images doors --trigger WORD
ecko create-jsonl /path/to/images [dataset]
ecko ui /path/to/images
Dependencies
This tool requires Python 3.11 or higher and has the following dependencies:
"typer",
"rich",
"shellingham",
"python-dotenv",
"torch",
"pillow",
"einops"
"transformers"
"timm"
"torchvision"
"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
Built Distribution
File details
Details for the file ecko_cli-1.6.0.tar.gz
.
File metadata
- Download URL: ecko_cli-1.6.0.tar.gz
- Upload date:
- Size: 264.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.20
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5d87c204b4e65dff757591b311cd2b99280329dcca12214744ffcb95bf495163 |
|
MD5 | 3d9b3d0e5999a8764aa68d0c0af76214 |
|
BLAKE2b-256 | 843fe31f328a8928ab807f43b28a3f012462cb5a965d6b10ab0b0d5d8d8c95a9 |
File details
Details for the file ecko_cli-1.6.0-py3-none-any.whl
.
File metadata
- Download URL: ecko_cli-1.6.0-py3-none-any.whl
- Upload date:
- Size: 265.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.20
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fe206d1a19c4d4a5b5a5cafe9118d474f7e5cf3562382e5ec3aa8877fd5b4bc2 |
|
MD5 | e7ef7bd57055d28a482b02dc46ced5b3 |
|
BLAKE2b-256 | b792ad8650171daf9a701fa78e4f9140e71876c1ee5ac2f4b8f20bdd2e5b50a2 |