You need to agree to share your contact information to access this model

This repository is publicly accessible, but you have to accept the conditions to access its files and content.

Log in or Sign Up to review the conditions and access this model content.

YAML Metadata Warning: The pipeline tag "text2text-generation" is not in the official list: text-classification, token-classification, table-question-answering, question-answering, zero-shot-classification, translation, summarization, feature-extraction, text-generation, fill-mask, sentence-similarity, text-to-speech, text-to-audio, automatic-speech-recognition, audio-to-audio, audio-classification, audio-text-to-text, voice-activity-detection, depth-estimation, image-classification, object-detection, image-segmentation, text-to-image, image-to-text, image-to-image, image-to-video, unconditional-image-generation, video-classification, reinforcement-learning, robotics, tabular-classification, tabular-regression, tabular-to-text, table-to-text, multiple-choice, text-ranking, text-retrieval, time-series-forecasting, text-to-video, image-text-to-text, image-text-to-image, image-text-to-video, visual-question-answering, document-question-answering, zero-shot-image-classification, graph-ml, mask-generation, zero-shot-object-detection, text-to-3d, image-to-3d, image-feature-extraction, video-text-to-text, keypoint-detection, visual-document-retrieval, any-to-any, video-to-video, other

texformer-270m-bf16

This repository contains a TeXformer 270m checkpoint in bf16 precision for OCR-to-LaTeX generation.

This is a custom TeXformer architecture checkpoint (model.pt) plus tokenizer assets. It is not a standard transformers AutoModel checkpoint.

Files

  • model.pt: TeXformer checkpoint
  • tokenizer/pdf_tokenizer.json: PDF-side tokenizer
  • tokenizer/latex_tokenizer.json: LaTeX-side tokenizer
  • tokenizer/pdf_tags.json: frequent PDF tag metadata
  • tokenizer/latex_commands.json: frequent LaTeX command metadata

Architecture

  • Parameters (deduplicated): 271,956,480
  • Parameters (state_dict entries): 308,820,480
  • Encoder layers: 12
  • Decoder layers: 12
  • Hidden size (d_model): 768
  • Attention heads: 12
  • Feed-forward size (d_ff): 3072
  • Max encoder length: 2560
  • Max decoder length: 2560

Usage

from pathlib import Path
import torch
from huggingface_hub import snapshot_download
from texformer.models.checkpoint_loader import load_texformer_model
from texformer.tokenization.tokenizer import TeXFormerTokenizer

repo_id = "aamingem/texformer-270m-bf16"
local_dir = Path(snapshot_download(repo_id=repo_id))
tokenizer_dir = local_dir / "tokenizer"

tokenizer = TeXFormerTokenizer(tokenizer_dir)
if torch.cuda.is_available():
    device = torch.device("cuda")
elif hasattr(torch.backends, "mps") and torch.backends.mps.is_available():
    device = torch.device("mps")
else:
    device = torch.device("cpu")
model, global_step, epoch, missing, unexpected = load_texformer_model(
    checkpoint_path=local_dir / "model.pt",
    tokenizer=tokenizer,
    device=device,
)
print("Loaded model:", model.__class__.__name__)
print("Missing keys:", len(missing), "Unexpected keys:", len(unexpected))

Intended Use

  • OCR-to-LaTeX / PDF-text-to-LaTeX sequence generation
  • Research and experimentation on scientific document conversion

Limitations

  • May produce incorrect or non-compiling LaTeX.
  • Performance depends on input extraction quality.
  • Not intended for high-stakes use without human verification.
Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support