microsoft / dit-base

huggingface.co
Total runs: 8.3K
24-hour runs: -74
7-day runs: -510
30-day runs: -2.0K
Model's Last Updated: February 28 2023

Introduction of dit-base

Model Details of dit-base

Document Image Transformer (base-sized model)

Document Image Transformer (DiT) model pre-trained on IIT-CDIP (Lewis et al., 2006), a dataset that includes 42 million document images. It was introduced in the paper DiT: Self-supervised Pre-training for Document Image Transformer by Li et al. and first released in this repository . Note that DiT is identical to the architecture of BEiT .

Disclaimer: The team releasing DiT did not write a model card for this model so this model card has been written by the Hugging Face team.

Model description

The Document Image Transformer (DiT) is a transformer encoder model (BERT-like) pre-trained on a large collection of images in a self-supervised fashion. The pre-training objective for the model is to predict visual tokens from the encoder of a discrete VAE (dVAE), based on masked patches.

Images are presented to the model as a sequence of fixed-size patches (resolution 16x16), which are linearly embedded. One also adds absolute position embeddings before feeding the sequence to the layers of the Transformer encoder.

By pre-training the model, it learns an inner representation of images that can then be used to extract features useful for downstream tasks: if you have a dataset of labeled document images for instance, you can train a standard classifier by placing a linear layer on top of the pre-trained encoder.

Intended uses & limitations

You can use the raw model for encoding document images into a vector space, but it's mostly meant to be fine-tuned on tasks like document image classification, table detection or document layout analysis. See the model hub to look for fine-tuned versions on a task that interests you.

How to use

Here is how to use this model in PyTorch:

from transformers import BeitImageProcessor, BeitForMaskedImageModeling
import torch
from PIL import Image

image = Image.open('path_to_your_document_image').convert('RGB')

processor = BeitImageProcessor.from_pretrained("microsoft/dit-base")
model = BeitForMaskedImageModeling.from_pretrained("microsoft/dit-base")

num_patches = (model.config.image_size // model.config.patch_size) ** 2
pixel_values = processor(images=image, return_tensors="pt").pixel_values
# create random boolean mask of shape (batch_size, num_patches)
bool_masked_pos = torch.randint(low=0, high=2, size=(1, num_patches)).bool()

outputs = model(pixel_values, bool_masked_pos=bool_masked_pos)
loss, logits = outputs.loss, outputs.logits
BibTeX entry and citation info
@article{Lewis2006BuildingAT,
  title={Building a test collection for complex document information processing},
  author={David D. Lewis and Gady Agam and Shlomo Engelson Argamon and Ophir Frieder and David A. Grossman and Jefferson Heard},
  journal={Proceedings of the 29th annual international ACM SIGIR conference on Research and development in information retrieval},
  year={2006}
}

Runs of microsoft dit-base on huggingface.co

8.3K
Total runs
-74
24-hour runs
-367
3-day runs
-510
7-day runs
-2.0K
30-day runs

More Information About dit-base huggingface.co Model

dit-base huggingface.co

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

microsoft dit-base online free

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

microsoft dit-base online free url in huggingface.co:

https://huggingface.co/microsoft/dit-base

dit-base install

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

dit-base install url in huggingface.co:

https://huggingface.co/microsoft/dit-base

Url of dit-base

Provider of dit-base huggingface.co

microsoft
ORGANIZATIONS

Other API from microsoft

huggingface.co

Total runs: 681.1K
Run Growth: 208.0K
Growth Rate: 30.53%
Updated:February 03 2022
huggingface.co

Total runs: 595.8K
Run Growth: -131.1K
Growth Rate: -22.00%
Updated:November 25 2025
huggingface.co

Total runs: 535.6K
Run Growth: 307.0K
Growth Rate: 57.32%
Updated:April 08 2024
huggingface.co

Total runs: 511.8K
Run Growth: -531.5K
Growth Rate: -103.84%
Updated:December 08 2025
huggingface.co

Total runs: 461.8K
Run Growth: -2.3K
Growth Rate: -0.49%
Updated:September 26 2022
huggingface.co

Total runs: 289.1K
Run Growth: -22.3K
Growth Rate: -7.70%
Updated:February 14 2024
huggingface.co

Total runs: 117.8K
Run Growth: -147.4K
Growth Rate: -125.12%
Updated:November 08 2023
huggingface.co

Total runs: 117.6K
Run Growth: -1.2K
Growth Rate: -1.03%
Updated:February 29 2024
huggingface.co

Total runs: 100.0K
Run Growth: -425
Growth Rate: -0.42%
Updated:August 28 2025
huggingface.co

Total runs: 95.9K
Run Growth: -29.5K
Growth Rate: -30.77%
Updated:February 03 2023
huggingface.co

Total runs: 69.7K
Run Growth: -13.1K
Growth Rate: -18.74%
Updated:November 25 2025
huggingface.co

Total runs: 68.7K
Run Growth: -18.2K
Growth Rate: -26.47%
Updated:December 03 2025
huggingface.co

Total runs: 52.0K
Run Growth: 26.0K
Growth Rate: 50.00%
Updated:December 23 2021
huggingface.co

Total runs: 32.5K
Run Growth: 28.2K
Growth Rate: 86.85%
Updated:April 23 2026
huggingface.co

Total runs: 29.5K
Run Growth: -48.9K
Growth Rate: -165.86%
Updated:August 04 2021
huggingface.co

Total runs: 29.1K
Run Growth: -91.1K
Growth Rate: -312.94%
Updated:May 12 2026