Ir para o conteúdo
ModelListadosExterno
Baixar

Trocr Base Printed Onnx

This repository contains an optimized ONNX version of the microsoft/trocr-base-printed model. It was exported using the optimum library for faster inference on CPU and GPU.

TipoCLIP visionModelo basemicrosoft/trocr-base-printedVersãoBnota

Fonte do modelo

Tipo
CLIP vision
Tamanho do arquivo
1,11 GB
Modelo base
microsoft/trocr-base-printed
Versão
vdecoder_model
Atualizado
2 de nov. de 2026
Downloads
27
Fonte
Hugging Face

Descrição da fonte

trocr-base-printed-onnx

This repository contains an optimized ONNX version of the microsoft/trocr-base-printed model. It was exported using the optimum library for faster inference on CPU and GPU.

Model Details

  • Architecture: Vision Encoder-Decoder (ViT encoder + RoBERTa decoder)
  • Format: ONNX (Encoder, Decoder, and Decoder with Past Key Values)
  • Task: Optical Character Recognition (OCR) for printed text.

Usage

from optimum.onnxruntime import ORTModelForVision2Seq
from transformers import TrOCRProcessor
import torch

model_id = "KvaytG/trocr-base-printed-onnx"
providers = ["CUDAExecutionProvider", "CPUExecutionProvider"] if torch.cuda.is_available() else ["CPUExecutionProvider"]

processor = TrOCRProcessor.from_pretrained(model_id)
model = ORTModelForVision2Seq.from_pretrained(
    model_id,
    providers=providers,
    decoder_file_name="decoder_model.onnx",
    decoder_with_past_file_name="decoder_with_past_model.onnx"
)

inputs = processor(images=image, return_tensors="pt").to(device)
generated_ids = model.generate(
    inputs.pixel_values,
    use_cache=True
)
text = processor.batch_decode(generated_ids, skip_special_tokens=True)
print(text)

Credits

Original model by Microsoft.

License

Licensed under the MIT license.

Fontes

1 fonte
Hugging FacePrimárioVersão 711ed7e5f87a8255f81c6459566cf46b236151d1
huggingface.co/KvaytG/trocr-base-printed-onnx/tree/711ed7e5f87a8255f81c6459566cf46b236151d1

Verificado 2 de nov.

Download files

Artefatos de modelo

1 artefato

decoder_model.onnx

onnx · 1,11 GB · SHA-256 b312cfcf1e25…3bfb · Hugging Face

Download file

Trechos de fonte

3 trechos

--- language: en license: mit tags: - ocr - trocr - onnx - vision-encoder-decoder - text-recognition pipeline_tag: image-to-text library_name: optimum --- # trocr-base-printed-onnx This repository contains an optimized **ONNX** version of the **microsoft/trocr-base-printed** model. It was exported using the `optimum` library for faster inference on CPU and GPU. ## Model Details - **Architecture:** Vision Encoder-Decoder (ViT encoder + RoBERTa decoder) - **Format:** ONNX (Encoder, Decoder, and Decoder with Past Key Values) - **Task:** Optical Character Recognition (OCR) for printed text. ## Usage ```python from optimum.onnxruntime import ORTModelForVision2Seq from transformers import TrOCRProcessor import torch model_id = "KvaytG/trocr-base-printed-onnx" providers = ["CUDAExecutionProvider", "CPUExecutionProvider"] if torch.cuda.is_available() else ["CPUExecutionProvider"] processor = TrOCRProcessor.from_pretrained(model_id) model = ORTModelForVision2Seq.from_pretrained( model_id, providers=providers, decoder_file_name="decoder_model.onnx", decoder_with_past_file_name="decoder_with_past_model.onnx" ) inputs = processor(images=image, return_tensors="pt").to(device) generated_ids = model.generate( inputs.pixel_values, use_cache=True ) text = processor.batch_decode(generated_ids, skip_special_tokens=True) print(text) ``` ## Credits Original model by **Microsoft**. ## License Licensed under the **MIT** license.

Source context: 27 downloads · 0 likes · Pipeline image-to-text · Library optimum · Repo KvaytG/trocr-base-printed-onnx

Source context: 5 downloads · 0 likes · Pipeline image-to-text · Library optimum · Repo KvaytG/trocr-base-printed-onnx