GOTOCR2Options
Options & Configuration · AiDotNet.VisionLanguage.Document
Configuration options for GOT-OCR2, the General OCR Theory model (Wei et al., 2024).
Inheritance: ModelOptions → GenerativeVLMOptions → DocumentVLMOptions → GOTOCR2Options
How It Works
GOT-OCR2 has three parts:
- A SAM ViTDet-B image encoder over 1024 px pages: patch 16, 768 wide, 12 blocks, windowed 14x14
attention with global attention in blocks 2/5/8/11, and a 256-channel neck.
- Two stride-2 convolutions that reduce the page to 256 image tokens.
- The Qwen-0.5B decoder: 1024 wide, 24 layers, 16 heads with 16 KV heads, a SiLU-gated FFN of 2816,
RoPE theta 1e6, and a 151860-token vocabulary.
These are the defaults of HF GotOcr2Config.
The inherited options mean the following here: VisionDim,
NumVisionLayers and NumHeads describe the
ViTDet encoder. DecoderDim and
NumDecoderLayers describe the Qwen decoder.
MaxSequenceLength bounds the full prompt plus answer.
Constructors
| Constructor | Summary |
|---|---|
GOTOCR2Options() |
Creates the published GOT-OCR2 configuration. |
GOTOCR2Options(GOTOCR2Options other) |
Copies every option from other. |
Properties
| Property | Summary |
|---|---|
bool FormatOutput { get; set; } |
When true, the query is “OCR with format: “, which asks for formatted output (Markdown, LaTeX, music notation). |
double RmsNormEpsilon { get; set; } |
RMSNorm epsilon. |
double RopeTheta { get; set; } |
Rotary embedding base. |
int DecoderFeedForwardDim { get; set; } |
Qwen decoder SiLU-gated feed-forward width. |
int DecoderHeads { get; set; } |
Qwen decoder query heads. |
int DecoderKeyValueHeads { get; set; } |
Qwen decoder key/value heads. |
int EndOfTextTokenId { get; set; } |
Qwen’s <|endoftext|> id. |
int GlobalAttentionEvery { get; set; } |
Every N-th ViTDet block attends globally; the rest use windows. |
int ImEndTokenId { get; set; } |
ChatML’s <|im_end|> id, which also ends an answer. |
int ImStartTokenId { get; set; } |
ChatML’s <|im_start|> id. |
int ImageEndTokenId { get; } |
The </img> id. |
int ImagePadTokenId { get; } |
<imgpad>, the image-slot token: the last id of the vocabulary. |
int ImageStartTokenId { get; } |
The <img> id. |
int NeckChannels { get; set; } |
Channels of ViTDet’s neck output. |
int PatchSize { get; set; } |
ViTDet patch size, also the encoder’s stride. |
int VisionMlpDim { get; set; } |
ViTDet MLP width. |
int WindowSize { get; set; } |
Side of ViTDet’s windowed-attention windows. |
Methods
| Method | Summary |
|---|---|
void Validate() |
Throws if the configuration cannot build GOT-OCR2. |