BLIP
Collection
1 item • Updated
How to use mobilint/blip-image-captioning-large with Transformers:
# Use a pipeline as a high-level helper
# Warning: Pipeline type "image-to-text" is no longer supported in transformers v5.
# You must load the model directly (see below) or downgrade to v4.x with:
# 'pip install "transformers<5.0.0'
from transformers import pipeline
pipe = pipeline("image-to-text", model="mobilint/blip-image-captioning-large", trust_remote_code=True) # Load model directly
from transformers import AutoModelForCausalLM
model = AutoModelForCausalLM.from_pretrained("mobilint/blip-image-captioning-large", trust_remote_code=True, dtype="auto")How to use mobilint/blip-image-captioning-large with Mobilint:
# pip install mblt-model-zoo
from mblt_model_zoo.vision import MBLT_Engine
model = MBLT_Engine(
model_cls="blip-image-captioning-large",
model_type="DEFAULT",
model_path="",
core_mode="global8",
)
try:
image = model.preprocess("path/to/image.jpg")
output = model(image)
result = model.postprocess(output)
finally:
model.dispose()
Base model
Salesforce/blip-image-captioning-large