Prompt engineering tool using BLIP 1/2 + CLIP Interrogate approach.
Project description
pytorch_clip_interrogator: Image-To-Promt.
Install package
pip install pytorch_clip_interrogator
Install the latest version
pip install --upgrade git+https://github.com/bes-dev/pytorch_clip_interrogator.git
Features
- Fully compatible with models from Huggingface.
- Supports BLIP 1/2 model.
- Support batch processing.
Usage
Simple code
import torch
import requests
from PIL import Image
from pytorch_clip_interrogator import PromptEngineer
# build pipeline
pipe = PromptEngineer(
blip_model="Salesforce/blip2-opt-2.7b",
clip_model="openai/clip-vit-base-patch32",
device="cuda",
torch_dtype=torch.float16
)
# load image
img_url = 'https://storage.googleapis.com/sfr-vision-language-research/BLIP/demo.jpg'
image = Image.open(requests.get(img_url, stream=True).raw).convert('RGB')
# generate caption
print(pipe(image))
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
File details
Details for the file pytorch_clip_interrogator-2023.2.19.13-py3-none-any.whl
.
File metadata
- Download URL: pytorch_clip_interrogator-2023.2.19.13-py3-none-any.whl
- Upload date:
- Size: 788.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.15
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6363276e75de97a374ce6001a2a8aa1f17a35bfaa28f1c14fdfa84cbf5a5a492 |
|
MD5 | fc829f4cd9a88f09efa92e4164602ffb |
|
BLAKE2b-256 | 69284fd8a056f638bc90a8395cd9977f7ca4b7351e06da8024efc8be0e5c0bb0 |