Sponsored by
Vmake Labs Video Enhancer
-Vmake Labs Video Enhancer uses AI to improve video quality, restore details, reduce blur, and upscale videos to 8K.
microsoft/Florence-2-large tuned on Ejafa/ye-pop captioned with CogVLM2
This repository contains a fine-tuned version of the
microsoft/Florence-2-large
model. The model has been tuned on a 38,000 image subset of the
Ejafa/ye-pop
dataset, with captions generated using
THUDM/cogvlm2-llama3-chat-19B
.
Training Details
Vision Encoder
: The vision encoder was frozen during training.
Batch Size
: 32
Gradient Accumulation Steps
: 8
Learning Rate
: 4.2667e-5
Optimizer
: AdamW
Scheduler
: linear
Epochs
: 7
Dataset
The fine-tuning process utilized a 38,000 image subset from the
Ejafa/ye-pop
dataset. This dataset contains a wide array of images with varying subjects, providing a robust training ground for improving the model's captioning abilities.
Captioning
The captions were generated using
THUDM/cogvlm2-llama3-chat-19B
.
Usage
To use this model, you can load it directly from the Hugging Face Model Hub:
from transformers import AutoModelForCausalLM, AutoProcessor, AutoConfig
import torch
device = torch.device("cuda"if torch.cuda.is_available() else"cpu")
model = AutoModelForCausalLM.from_pretrained("thwri/CogFlorence-2-Large-Freeze", trust_remote_code=True).to(device).eval()
processor = AutoProcessor.from_pretrained("thwri/CogFlorence-2-Large-Freeze", trust_remote_code=True)
# Function to run the model on an exampledefrun_example(task_prompt, image):
prompt = task_prompt
# Ensure the image is in RGB modeif image.mode != "RGB":
image = image.convert("RGB")
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,
num_beams=3,
do_sample=True
)
generated_text = processor.batch_decode(generated_ids, skip_special_tokens=False)[0]
parsed_answer = processor.post_process_generation(generated_text, task=task_prompt, image_size=(image.width, image.height))
return parsed_answer
from PIL import Image
import requests
import copy
url = "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/transformers/tasks/car.jpg?download=true"
image = Image.open(requests.get(url, stream=True).raw)
result = run_example("<MORE_DETAILED_CAPTION>" , image)
print(result)
# {'<MORE_DETAILED_CAPTION>': 'a turquoise volkswagen beetle parked on a cobblestone street in front of a yellow wall with two wooden doors. the car's body is painted in a vibrant shade of teal, with a glossy finish that reflects the sunlight, and the wheels are polished with a silver hubcap. the building behind the car has a weathered, aged appearance, with visible cracks and peeling paint. the sky above is clear and blue, suggesting a sunny day.'}
Runs of thwri CogFlorence-2-Large-Freeze on huggingface.co
275
Total runs
4
24-hour runs
2
3-day runs
4
7-day runs
-76
30-day runs
More Information About CogFlorence-2-Large-Freeze huggingface.co Model
More CogFlorence-2-Large-Freeze license Visit here:
CogFlorence-2-Large-Freeze huggingface.co is an AI model on huggingface.co that provides CogFlorence-2-Large-Freeze's model effect (), which can be used instantly with this thwri CogFlorence-2-Large-Freeze model. huggingface.co supports a free trial of the CogFlorence-2-Large-Freeze model, and also provides paid use of the CogFlorence-2-Large-Freeze. Support call CogFlorence-2-Large-Freeze model through api, including Node.js, Python, http.
CogFlorence-2-Large-Freeze huggingface.co is an online trial and call api platform, which integrates CogFlorence-2-Large-Freeze's modeling effects, including api services, and provides a free online trial of CogFlorence-2-Large-Freeze, you can try CogFlorence-2-Large-Freeze online for free by clicking the link below.
thwri CogFlorence-2-Large-Freeze online free url in huggingface.co:
CogFlorence-2-Large-Freeze is an open source model from GitHub that offers a free installation service, and any user can find CogFlorence-2-Large-Freeze on GitHub to install. At the same time, huggingface.co provides the effect of CogFlorence-2-Large-Freeze install, users can directly use CogFlorence-2-Large-Freeze installed effect in huggingface.co for debugging and trial. It also supports api for free installation.
CogFlorence-2-Large-Freeze install url in huggingface.co: