text_plain_output_1.png
from blip.models import blip

from clip_interrogator import clip_interrogator

import importlib

import inspect

blip_path = inspect.getfile(blip)
fin = open(blip_path, 'rt')
data = fin.read()
data = data.replace("BertTokenizer.from_pretrained('bert-base-uncased')", "BertTokenizer.from_pretrained('/kaggle/input/clip-interrogator-models-x/bert-base-uncased')")
fin.close()
fin = open(blip_path, 'wt')
fin.write(data)
fin.close()
importlib.reload(blip)

clip_interrogator_path = inspect.getfile(clip_interrogator.Interrogator)
fin = open(clip_interrogator_path, 'rt')
data = fin.read()
data = data.replace('open_clip.get_tokenizer(clip_model_name)', 'open_clip.get_tokenizer(config.clip_model_name.split("/", 2)[0])')
fin.close()
fin = open(clip_interrogator_path, 'wt')
fin.write(data)
fin.close()
importlib.reload(clip_interrogator)