Browse Source

Update to nicer BLIP packaging

pull/34/head
pharmapsychotic 2 years ago
parent
commit
1ec6cd9d45
  1. 3
      README.md
  2. 2
      clip_interrogator.ipynb
  3. 2
      clip_interrogator/__init__.py
  4. 2
      clip_interrogator/clip_interrogator.py
  5. 3
      cog.yaml
  6. 2
      predict.py
  7. 1
      requirements.txt
  8. 2
      setup.py

3
README.md

@ -35,8 +35,7 @@ Install with PIP
# install torch with GPU support for example: # install torch with GPU support for example:
pip3 install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu117 pip3 install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu117
# install blip and clip-interrogator # install clip-interrogator
pip install -e git+https://github.com/pharmapsychotic/BLIP.git@lib#egg=blip
pip install clip-interrogator==0.3.2 pip install clip-interrogator==0.3.2
``` ```

2
clip_interrogator.ipynb

@ -55,7 +55,7 @@
" install_cmds = [\n", " install_cmds = [\n",
" ['pip', 'install', 'gradio'],\n", " ['pip', 'install', 'gradio'],\n",
" ['pip', 'install', 'open_clip_torch'],\n", " ['pip', 'install', 'open_clip_torch'],\n",
" ['pip', 'install', '-e', 'git+https://github.com/pharmapsychotic/BLIP.git@lib#egg=blip'],\n", " ['pip', 'install', 'git+https://github.com/pharmapsychotic/BLIP.git'],\n",
" ['git', 'clone', 'https://github.com/pharmapsychotic/clip-interrogator.git']\n", " ['git', 'clone', 'https://github.com/pharmapsychotic/clip-interrogator.git']\n",
" ]\n", " ]\n",
" for cmd in install_cmds:\n", " for cmd in install_cmds:\n",

2
clip_interrogator/__init__.py

@ -1,4 +1,4 @@
from .clip_interrogator import Interrogator, Config from .clip_interrogator import Interrogator, Config
__version__ = '0.3.2' __version__ = '0.3.3'
__author__ = 'pharmapsychotic' __author__ = 'pharmapsychotic'

2
clip_interrogator/clip_interrogator.py

@ -9,7 +9,7 @@ import time
import torch import torch
from dataclasses import dataclass from dataclasses import dataclass
from models.blip import blip_decoder, BLIP_Decoder from blip.models.blip import blip_decoder, BLIP_Decoder
from PIL import Image from PIL import Image
from torchvision import transforms from torchvision import transforms
from torchvision.transforms.functional import InterpolationMode from torchvision.transforms.functional import InterpolationMode

3
cog.yaml

@ -15,7 +15,6 @@ build:
- "open_clip_torch==2.7.0" - "open_clip_torch==2.7.0"
- "timm==0.4.12" - "timm==0.4.12"
- "pycocoevalcap==1.2" - "pycocoevalcap==1.2"
run: - "git+https://github.com/pharmapsychotic/BLIP.git"
- git clone https://github.com/salesforce/BLIP /root/blip
predict: "predict.py:Predictor" predict: "predict.py:Predictor"

2
predict.py

@ -2,8 +2,6 @@ import sys
from PIL import Image from PIL import Image
from cog import BasePredictor, Input, Path from cog import BasePredictor, Input, Path
sys.path.append('/root/blip')
from clip_interrogator import Interrogator, Config from clip_interrogator import Interrogator, Config

1
requirements.txt

@ -4,3 +4,4 @@ Pillow
requests requests
tqdm tqdm
open_clip_torch open_clip_torch
git+https://github.com/pharmapsychotic/BLIP.git

2
setup.py

@ -5,7 +5,7 @@ from setuptools import setup, find_packages
setup( setup(
name="clip-interrogator", name="clip-interrogator",
version="0.3.2", version="0.3.3",
license='MIT', license='MIT',
author='pharmapsychotic', author='pharmapsychotic',
author_email='me@pharmapsychotic.com', author_email='me@pharmapsychotic.com',

Loading…
Cancel
Save