Model Card for Model ID
Model Details
Model Description
This is the model card of a 🤗 transformers model that has been pushed on the Hub. This model card has been automatically generated.
- Developed by: [More Information Needed]
- Funded by [optional]: [More Information Needed]
- Shared by [optional]: [More Information Needed]
- Model type: [More Information Needed]
- Language(s) (NLP): [More Information Needed]
- License: [More Information Needed]
- Finetuned from model [optional]: [More Information Needed]
Uses
GPT4-O Style captioner, finetuned version using florence-2-base-ft
Direct Use
This model can be used to create gpt4-o styple captions.
Out-of-Scope Use
- This model might not generate long-text descriptions as the context length is 1024.
- Linear scaling is applied to increase the context length, its effect was not measured!
How to Get Started with the Model
# Load fine-tuned model and processor
import torch
from transformers import AutoModelForCausalLM, AutoProcessor
from PIL import Image
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
repo_name = "Vimax97/Florence-2-base-gpt4_captioner_v1"
model = AutoModelForCausalLM.from_pretrained(repo_name, trust_remote_code=True).to(device)
processor = AutoProcessor.from_pretrained(repo_name, trust_remote_code=True)
# Inference
image = Image.open("<path_to_image>")
prompt = "<ImageCAP>" + 'What is the <GPT4> style description for this image?'
inputs = processor(text=prompt, images=image, return_tensors="pt").to(device)
generated_ids = model.generate(
input_ids=inputs["input_ids"],
pixel_values=inputs["pixel_values"],
max_new_tokens=1024,
do_sample=False,
num_beams=3
)
generated_text = processor.batch_decode(generated_ids, skip_special_tokens=False)[0]
parsed_answer = processor.post_process_generation(generated_text, task=prompt, image_size=(image.width, image.height))
print("Generated: ",parsed_answer[prompt])
Training Hyperparameters
- Training regime: fp32 precision, 1000 images were used, 1 epoch of finetuning
Summary
- Downloads last month
- 65
Inference Providers
NEW
This model is not currently available via any of the supported Inference Providers.
The model cannot be deployed to the HF Inference API:
The HF Inference API does not support model that require custom code execution.
Model tree for Vimax97/Florence-2-base-gpt4_captioner_v1
Base model
microsoft/Florence-2-base-ft