merve / kosmos-2.5-ft

huggingface.co
Total runs: 11
24-hour runs: 0
7-day runs: 2
30-day runs: -2
Model's Last Updated: September 11 2025
image-text-to-text

Introduction of kosmos-2.5-ft

Model Details of kosmos-2.5-ft

Kosmos-2.5 Fine-tuned on DocLayNet

Kosmos-2.5 fine-tuned on grounded OCR (OCR with bounding boxes), find the script here: ( GH , HF )

Try the (base model) Kosmos-2.5 demo here .

Here's the inference code:

from transformers import AutoProcessor, Kosmos2_5ForConditionalGeneration
import torch 

model = Kosmos2_5ForConditionalGeneration.from_pretrained("merve/kosmos-2.5-ft", device_map="cuda", dtype=torch.bfloat16)
processor = AutoProcessor.from_pretrained("microsoft/kosmos-2.5")

import requests
from PIL import Image
url = "https://huggingface.co/datasets/merve/vlm_test_images/resolve/main/ufo-sighting.jpg"
image = Image.open(requests.get(url, stream=True).raw)


import re
prompt = "<ocr>"
inputs = processor(text=prompt, images=image, return_tensors="pt")
height, width = inputs.pop("height"), inputs.pop("width")
raw_width, raw_height = image.size
scale_height = raw_height / height
scale_width = raw_width / width

inputs = {k: v.to("cuda") if v is not None else None for k, v in inputs.items()}
inputs["flattened_patches"] = inputs["flattened_patches"].to(torch.bfloat16)

generated_ids = model.generate(
    **inputs,
    max_new_tokens=2000,
)

generated_text = processor.batch_decode(generated_ids, skip_special_tokens=True)

import re
from PIL import ImageDraw

def post_process(y, scale_height, scale_width):

    pattern = r"<bbox><x_\d+><y_\d+><x_\d+><y_\d+></bbox>"
    bboxes_raw = re.findall(pattern, y)
    lines = re.split(pattern, y)[1:]  
    bboxes = [list(map(int, re.findall(r"\d+", bb))) for bb in bboxes_raw]

    out_lines = []
    for i, box in enumerate(bboxes):
        if len(box) != 4:
            continue
        x0, y0, x1, y1 = box

        if x0 >= x1 or y0 >= y1:
            continue

        sx0 = int(x0 * scale_width)
        sy0 = int(y0 * scale_height)
        sx1 = int(x1 * scale_width)
        sy1 = int(y1 * scale_height)

        label = lines[i] if i < len(lines) else ""
        label = label.lstrip(", ").strip()

        out_lines.append(f"{sx0},{sy0},{sx1},{sy0},{sx1},{sy1},{sx0},{sy1},{label}")

    return "\n".join(out_lines)


output_text = post_process(generated_text[0], scale_height, scale_width)
print(output_text)  

draw = ImageDraw.Draw(image)

for line in output_text.strip().splitlines():
    coords = re.findall(r"-?\d+", line)[:8]
    if len(coords) < 8:
        continue
    xy = list(map(int, coords))
    draw.polygon(xy, outline="red")

image.save("output.png")

The image and the text (shortened here) output:

338,17,673,17,673,82,338,82,CONFIDENTIAL
445,68,478,68,478,97,445,97,-2-
169,129,193,129,193,157,169,157,6.
334,129,910,129,910,157,334,157,A suggestion that the light could have been produced by
169,150,900,150,900,177,169,177,a photo-flash from a high-flying aircraft was discounted. No aircraft
166,171,856,171,856,198,166,198,was heard at the time and, in any case, no known photo-flash has a
...

image/png

Runs of merve kosmos-2.5-ft on huggingface.co

11
Total runs
0
24-hour runs
0
3-day runs
2
7-day runs
-2
30-day runs

More Information About kosmos-2.5-ft huggingface.co Model

More kosmos-2.5-ft license Visit here:

https://choosealicense.com/licenses/apache-2.0

kosmos-2.5-ft huggingface.co

kosmos-2.5-ft huggingface.co is an AI model on huggingface.co that provides kosmos-2.5-ft's model effect (), which can be used instantly with this merve kosmos-2.5-ft model. huggingface.co supports a free trial of the kosmos-2.5-ft model, and also provides paid use of the kosmos-2.5-ft. Support call kosmos-2.5-ft model through api, including Node.js, Python, http.

kosmos-2.5-ft huggingface.co Url

https://huggingface.co/merve/kosmos-2.5-ft

merve kosmos-2.5-ft online free

kosmos-2.5-ft huggingface.co is an online trial and call api platform, which integrates kosmos-2.5-ft's modeling effects, including api services, and provides a free online trial of kosmos-2.5-ft, you can try kosmos-2.5-ft online for free by clicking the link below.

merve kosmos-2.5-ft online free url in huggingface.co:

https://huggingface.co/merve/kosmos-2.5-ft

kosmos-2.5-ft install

kosmos-2.5-ft is an open source model from GitHub that offers a free installation service, and any user can find kosmos-2.5-ft on GitHub to install. At the same time, huggingface.co provides the effect of kosmos-2.5-ft install, users can directly use kosmos-2.5-ft installed effect in huggingface.co for debugging and trial. It also supports api for free installation.

kosmos-2.5-ft install url in huggingface.co:

https://huggingface.co/merve/kosmos-2.5-ft

Url of kosmos-2.5-ft

kosmos-2.5-ft huggingface.co Url

Provider of kosmos-2.5-ft huggingface.co

merve
ORGANIZATIONS

Other API from merve

huggingface.co

Total runs: 61
Run Growth: 40
Growth Rate: 65.57%
Updated:October 12 2023
huggingface.co

Total runs: 37
Run Growth: 22
Growth Rate: 59.46%
Updated:September 19 2025
huggingface.co

Total runs: 34
Run Growth: -24
Growth Rate: -70.59%
Updated:January 06 2024
huggingface.co

Total runs: 33
Run Growth: -4
Growth Rate: -12.50%
Updated:February 26 2024
huggingface.co

Total runs: 32
Run Growth: 19
Growth Rate: 59.38%
Updated:January 28 2026
huggingface.co

Total runs: 14
Run Growth: 7
Growth Rate: 50.00%
Updated:July 18 2024
huggingface.co

Total runs: 13
Run Growth: 8
Growth Rate: 61.54%
Updated:October 04 2023
huggingface.co

Total runs: 12
Run Growth: -3
Growth Rate: -25.00%
Updated:February 22 2024
huggingface.co

Total runs: 10
Run Growth: 9
Growth Rate: 90.00%
Updated:November 25 2023
huggingface.co

Total runs: 9
Run Growth: 6
Growth Rate: 66.67%
Updated:February 10 2023
huggingface.co

Total runs: 8
Run Growth: -22
Growth Rate: -275.00%
Updated:December 18 2024
huggingface.co

Total runs: 8
Run Growth: 4
Growth Rate: 50.00%
Updated:July 11 2023
huggingface.co

Total runs: 7
Run Growth: 1
Growth Rate: 14.29%
Updated:March 26 2024
huggingface.co

Total runs: 6
Run Growth: -5
Growth Rate: -83.33%
Updated:January 28 2023
huggingface.co

Total runs: 5
Run Growth: 3
Growth Rate: 60.00%
Updated:April 02 2023
huggingface.co

Total runs: 5
Run Growth: 3
Growth Rate: 60.00%
Updated:April 02 2023
huggingface.co

Total runs: 5
Run Growth: -2
Growth Rate: -40.00%
Updated:March 26 2024
huggingface.co

Total runs: 4
Run Growth: 0
Growth Rate: 0.00%
Updated:June 14 2023
huggingface.co

Total runs: 1
Run Growth: 1
Growth Rate: 100.00%
Updated:December 20 2024
huggingface.co

Total runs: 0
Run Growth: 0
Growth Rate: 0.00%
Updated:April 25 2026
huggingface.co

Total runs: 0
Run Growth: 0
Growth Rate: 0.00%
Updated:May 22 2024
huggingface.co

Total runs: 0
Run Growth: 0
Growth Rate: 0.00%
Updated:August 30 2022
huggingface.co

Total runs: 0
Run Growth: 0
Growth Rate: 0.00%
Updated:January 04 2024
huggingface.co

Total runs: 0
Run Growth: 0
Growth Rate: 0.00%
Updated:May 30 2022
huggingface.co

Total runs: 0
Run Growth: 0
Growth Rate: 0.00%
Updated:October 22 2024