/ Модель

Характеристики

Лицензия
Apache 2.0
Библиотека
transformers
Опубликована
1 июн 2025

patram-7b-instruct

Изображение и текст → текст14 профессий

Семейство зрительно-языковых моделей BharatGen для ответов на вопросы и извлечения данных из изображений документов, таблиц и диаграмм.

2 977скачиваний за 30 дней44лайкавеса обновлены7 апр 2026

Бенчмарки

Как модель справилась с задачами пользователей ailist и что о ней публикуют открытые лидерборды

Публичные оценки

Из открытых лидербордов. Сравнивайте результаты одного теста при одинаковых условиях — отсутствие оценки не значит, что модель хуже.

В подключённых источниках результатов для этой модели пока нет.

Что умеет модель

Описание составлено по карточке модели и метаданным Hugging Face

Patram-7B-Instruct — семейство зрительно-языковых моделей BharatGen с 7 млрд параметров, обученных с нуля для анализа документов по изображениям. Репозиторий содержит версии 1.0, 1.1 и 1.2; README описывает их как отдельные ревизии одной модели. Модель принимает изображение документа и текстовый запрос, а отвечает текстом в диалоговом формате. В зависимости от версии поддерживаются визуальные вопросы и ответы, извлечение текста и ключевых значений, многоходовый диалог, а в версии 1.2 также анализ таблиц, диаграмм и блок-схем, а также рассуждения для VQA.

Модель предназначена для понимания текстовых и визуально насыщенных документов, включая индийские документы. В README приведены результаты оценки на наборах DocVQA, WTQ, VisualMRC, ChartQA, InfoVQA, FlowVQA и других; показатели зависят от набора и режима prompting. Репозиторий использует библиотеку Transformers и формат safetensors. Лицензия — Apache-2.0. README не приводит сведений о поддерживаемых разрешениях изображений или длине контекста.

Сценарии применения

  • ответы на вопросы по сканам документов
  • извлечение текста и ключевых значений из форм
  • анализ таблиц на изображениях
  • интерпретация диаграмм и графиков
  • многоходовый диалог по содержимому документа
  • понимание индийских документов

Ограничения

Возможности и результаты различаются между ревизиями: например, анализ таблиц и диаграмм и извлечение текста перечислены для версии 1.2. Поддерживаемые разрешения изображений и длина контекста в предоставленных источниках не описаны.

Для каких профессий подходит14

Разделы каталога профессий, в задачах которых используется эта модель

Все профессии

Также подходит для

Карточка модели

README от автора на Hugging Face, как он его опубликовал

Открыть на Hugging Face

Patram-7B-Instruct

Patram by BharatGen is a family of 7B parameter vision-language models trained from scratch for visual document understanding. This README covers Patram-7B-Instruct (v1.0), Patram1.1-7B-Instruct, and Patram1.2-7B-Instruct, released as revisions of the same bharatgenai/patram-7b-instruct repository — pick a revision below and run any of them.

News 📢

  • [2026-02-17] 🚀 Released Patram1.2-7B-Instruct — adds Chain-of-thought VQA, Text Extraction, Chart Understanding, Table Understanding, and Flowchart Understanding on top of v1.1, trained on BharatDocs-v1.2. Evaluated across Text-Rich Document VQA, Visually-Rich Document VQA, TableVQA, and Indian benchmarks.
  • [2025-08-08] 🚀 Released Patram1.1-7B-Instruct — adds Multi-turn VQA and Key-value extraction on top of v1.0, trained on BharatDocs-v1.1. Evaluated across Text-Rich Document VQA, Visually-Rich Document VQA, and Indian benchmarks.
  • [2025-06-02] 🚀 Released Patram-7B-Instruct — India's first document foundation model for visual document understanding, trained on BharatDocs-v1.

Index

  1. News
  2. Introduction
  3. Comparison
  4. Benchmarks
  5. Inference
  6. Examples
  7. Authors
  8. Citation
  9. Contact

Introduction

Patram-7B-Instruct by BharatGen is a 7B parameter vision-language model trained from scratch for visual document understanding. As India's first document foundation model, it is built to tackle complex document analysis. Each release is trained on a carefully curated instruction-tuned dataset, combining diverse public and custom synthetic data designed to support a broad spectrum of document understanding tasks.

  • Patram-7B-Instruct (v1.0) is the original release.
  • Patram1.1-7B-Instruct builds on it with a richer training set (BharatDocs-v1.1) and adds multi-turn and key-value-extraction capabilities.
  • Patram1.2-7B-Instruct builds further (BharatDocs-v1.2), adding chain-of-thought reasoning, text extraction, and chart/table/flowchart understanding.

Comparison

CategoryItemPatram 1.0Patram 1.1Patram 1.2
CapabilitiesExtractive VQA✅✅✅
Abstractive VQA✅✅✅
Multi-turn VQA✅✅
Key-value extraction✅✅
Chain-of-thought VQA✅
Text Extraction✅
Chart Understanding✅
Table Understanding✅
Flowchart Understanding✅
ArchitectureVision EncoderVision Transformer (ViT)CLIP-style Vision TransformerCLIP-style Vision Transformer
ProjectorMLP projectorAttention-pooling + gated-MLP projectorAttention-pooling + gated-MLP projector
LLMOLMo-7BOLMo-7BOLMo-7B
Training DataDatasetBharatDocs-v1 + open-source document datasetsImproved BharatDocs-v1.1 + open-source document datasetsBharatDocs-v1.2 + open-source document datasets
I/OSupported formatsEnglish instructions + image input; text outputEnglish instructions + image input; text outputEnglish instructions + image input; text output
LanguageSupported languagesEnglishEnglish (Indian language support upcoming)English (Indian language support upcoming)
LicenseLicenseApache 2.0Apache 2.0Apache 2.0

Benchmarks

Metric: G-Eval (LLM-as-a-judge)

RankModelDocVQAWTQVisualMRCRico ScreenQAWeighted Avg.
🥇 1bharatgenai/patram-7b-instruct91.891.694.689.691.16
🥈 2Qwen/Qwen3-VL-8B-Instruct96.464.895.992.089.79
🥉 3OpenGVLab/InternVL3-8B92.761.196.089.687.27
4google/gemma-3-12b-it85.758.695.287.984.13
5allenai/Molmo-7B-D-092439.313.154.461.347.33
6allenai/Molmo-7B-O-092436.612.047.458.244.08

RankModelChartQAInfoVQAFlowVQAChartBenchCharXivAvg.
🥇 1Qwen/Qwen3-VL-8B-Instruct81.579.993.679.374.381.72
🥈 2bharatgenai/patram-7b-instruct81.987.892.677.566.181.18
🥉 3OpenGVLab/InternVL3-8B86.371.892.176.068.078.84
4google/gemma-3-12b-it76.054.288.970.859.369.84
5allenai/Molmo-7B-D-092430.926.343.357.929.137.50
6allenai/Molmo-7B-O-092429.827.041.153.727.735.86

RankModelTabFactTableVQAWeighted Avg.
🥇 1Qwen/Qwen3-VL-8B-Instruct82.868.381.28
🥈 2bharatgenai/patram-7b-instruct80.883.881.12
🥉 3OpenGVLab/InternVL3-8B79.966.278.46
4google/gemma-3-12b-it73.662.872.47
5allenai/Molmo-7B-O-092450.824.047.98
6allenai/Molmo-7B-D-092439.727.138.40

RankModelPatram-Bench-VQA-enOverall Avg.
🥇 1Qwen/Qwen3-VL-8B-Instruct94.486.80
🥈 2bharatgenai/patram-7b-instruct92.186.39
🥉 3OpenGVLab/InternVL3-8B79.781.07
4google/gemma-3-12b-it73.274.91
5allenai/Molmo-7B-O-092475.150.76
6allenai/Molmo-7B-D-092479.250.61

Overall Avg. is the average of the Text-Rich Document VQA, Visually-Rich Document VQA, TableVQA, and Patram-Bench-VQA-en bucket averages above.

Inference

All three versions live in the same Hugging Face repository, bharatgenai/patram-7b-instruct, as separate revisions — patram1.0, patram1.1, and patram1.2. Set REVISION accordingly in the snippet below.

Environment

All three revisions use the same environment

torch==2.7.0
torchvision==0.22.0
transformers==4.50.3
accelerate==0.26.0
einops==0.8.1

import base64
import io
import urllib.request

import torch
from PIL import Image
from transformers import AutoProcessor, AutoModelForCausalLM, GenerationConfig

MODEL_ID = "bharatgenai/patram-7b-instruct"
REVISION = "patram1.1"  # "patram1.0", "patram1.1", or "patram1.2"
HF_TOKEN = "hf_........"  # Insert HF token here
DEVICE = "cuda" if torch.cuda.is_available() else "cpu"

IMAGE_URL = "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQzcRxT-eX_C8Kahj9-DvCF1t1gzHctM7SIFOasQkCboQ&s=10"  # Insert image URL here
IMAGE_B64 = ""                                  # ...or a base64-encoded image instead


def load_image(url=None, b64=None):
    """Load a document image from a URL or from a base64 string."""
    if b64:
        # tolerates a leading "data:image/png;base64," prefix
        data = base64.b64decode(b64.split(",", 1)[-1])
    elif url:
        with urllib.request.urlopen(url) as response:
            data = response.read()
    else:
        raise ValueError("Provide either url= or b64=")
    return Image.open(io.BytesIO(data)).convert("RGB")


image = load_image(url=IMAGE_URL)
# image = load_image(b64=IMAGE_B64)

processor = AutoProcessor.from_pretrained(
    MODEL_ID, revision=REVISION, trust_remote_code=True, token=HF_TOKEN
)
model = AutoModelForCausalLM.from_pretrained(
    MODEL_ID,
    revision=REVISION,
    trust_remote_code=True,
    torch_dtype=torch.bfloat16,
    token=HF_TOKEN,
).to(DEVICE)
model.eval()

prompt = "Question: What is this document about? Answer based on the image."
inputs = processor.process(images=[image], text=prompt)
# float tensors (the image patches) must match the model dtype; integer ids must not be cast
inputs = {
    k: (v.to(DEVICE).to(model.dtype) if torch.is_floating_point(v) else v.to(DEVICE)).unsqueeze(0)
    for k, v in inputs.items()
}

with torch.autocast(device_type=DEVICE, enabled=True, dtype=torch.bfloat16):
    output = model.generate_from_batch(
        inputs,
        GenerationConfig(max_new_tokens=256, do_sample=False, stop_strings="<|endoftext|>"),
        tokenizer=processor.tokenizer,
    )

generated = output[0, inputs["input_ids"].size(1):]
print(processor.tokenizer.decode(generated, skip_special_tokens=True))

Patram1.2 only — supports two prompting modes via a MODE flag, direct and cot:

MODE = "cot"  # "direct" or "cot"
PROMPT_TEMPLATES = {
    "direct": "Question: {question} Answer based on the image.",
    "cot": "Question: {question} Think step by step, then answer based on the image.",
}
MAX_NEW_TOKENS = {"direct": 2048, "cot": 4096}

question = "What is the total amount on this invoice?"
prompt = PROMPT_TEMPLATES[MODE].format(question=question)
inputs = processor.process(images=[image], text=prompt)  # image = PIL.Image.open(...).convert("RGB")

Note: If you're trying this on an Apple Silicon (M1/M2/M3/M4/...) chip, please follow the official documentation by PyTorch and Hugging Face for installing dependencies:

Footnote — Patram1.2 prompting modes

Patram1.2 supports two prompting modes (direct and cot — see Hugging Face above for how to run each). Benchmark scores above were evaluated with the following mode per benchmark:

BenchmarkMode
DocVQAdirect
WTQdirect
VisualMRCcot
Rico ScreenQAdirect
ChartQAcot
InfoVQAcot
FlowVQAcot
ChartBenchcot
CharXivcot
TabFactcot
TableVQAcot
Patram-Bench-VQA-encot

Examples

Examples below are from Patram1.1-7B-Instruct.

Examples below are from Patram1.2-7B-Instruct.

Authors

  • Principal Investigators: Prof. Ravi Kiran Sarvadevabhatla, Prof. Ganesh Ramakrishnan
  • Contributors: BharatGen Team

Citation

@misc{bharatgen_patram_2025,
  title        = {Patram: India's Pioneering Vision-Language Foundation Model for Document Intelligence},
  author       = {{BharatGen Team}},
  year         = {2025},
  howpublished = {\url{https://huggingface.co/bharatgenai/patram-7b-instruct}},
  note         = {Accessed: 2025-06-02}
}
@misc{bharatgen_patram1_1_2025,
  title        = {Patram1.1: India's Pioneering Vision-Language Foundation Model for Document Intelligence},
  author       = {{BharatGen Team}},
  year         = {2025},
  howpublished = {\url{https://huggingface.co/bharatgenai/patram-7b-instruct}},
  note         = {Accessed: 2025-08-08}
}
@misc{bharatgen_patram1_2_2026,
  title        = {Patram1.2: India's Pioneering Vision-Language Foundation Model for Document Intelligence},
  author       = {{BharatGen Team}},
  year         = {2026},
  howpublished = {\url{https://huggingface.co/bharatgenai/patram-7b-instruct}},
  note         = {Accessed: 2026-02-17}
}

Contact

Как запустить

На своей GPU в ailist. Цена — по текущим предложениям провайдеров

GPU в ailist

Универсальный рантайм · transformers

Нельзя запустить

Доступ к модели ограничен автором; у платформы нет доступа к весам.

Ревизия весов
6a31983

0 моделей