raw2md
Copyright (c) the raw2md authors
License: GPL-3.0-or-later (see LICENSE)

The package `raw2md_engine` in this distribution is a modified copy of the
software below. Datalab wrote the original packages. Datalab does not
endorse or support raw2md.

Original packages
-----------------

marker-pdf (package `marker`)
  Author:     Datalab
  Repository: https://github.com/datalab-to/marker
  Tag:        v1.10.2
  Commit:     5a41cdbac6232a10aaf4fad29f8e6c1a0c2a0808
  License:    GPL-3.0-or-later
  Copy:       src/raw2md_engine/marker/ (license text in LICENSE there)

surya-ocr (package `surya`)
  Author:     Datalab
  Repository: https://github.com/datalab-to/surya
  Tag:        v0.17.1
  Commit:     411fb1895a02ed629928d5ae59df96f44ac9dc41
  License:    GPL-3.0-or-later
  Copy:       src/raw2md_engine/surya/ (license text in LICENSE there)

pdftext
  Author:     Datalab
  Repository: https://github.com/datalab-to/pdftext
  Tag:        v0.6.3
  Commit:     d76a57535d33e9467fd92c5d3c42d80d8c84f686
  License:    Apache-2.0
  Copy:       src/raw2md_engine/pdftext/ (license text in LICENSE there)

Changes
-------

The copy differs from the original packages in the ways below. The history
of the repository holds each change with its diff.

- The import paths `marker.`, `surya.`, and `pdftext.` are rewritten to
  `raw2md_engine.marker.`, `raw2md_engine.surya.`, and
  `raw2md_engine.pdftext.`.
- The parts that raw2md does not call are removed: the LLM pass, the
  extraction converter, the config parser, the input formats other than
  PDF, the output formats other than Markdown, and the command-line and
  browser applications.
- The PDF converter builds its provider and its Markdown renderer
  directly.
- The settings are fixed values. They do not load from environment
  variables or from a `local.env` file.
- The copy downloads nothing: no font when the converter starts and no
  model weights. `marker/models.py` takes the folder of the weights from
  its caller.
- The models build their non-persistent buffers on the CPU, and the
  loaders build them again after the load of the weights, before the move
  to the device (2026-10-19). Changed files, under
  src/raw2md_engine/surya/: `common/load.py`, `common/adetr/decoder.py`,
  `common/surya/decoder/__init__.py`, `common/surya/encoder/__init__.py`,
  `ocr_error/model/encoder.py`, `foundation/loader.py`,
  `table_rec/loader.py`, and `ocr_error/loader.py`.
- The copy follows the API of transformers 5 (2026-10-19): the tied
  weights as a mapping, `post_init` in every model, the default rotary
  frequencies and the head mask in the copy itself, the tokenizer helpers
  from their new module, and no head pruning or ONNX configuration.
  Changed files, under src/raw2md_engine/surya/: `common/pretrained.py`,
  `common/adetr/decoder.py`, `common/donut/encoder.py`,
  `common/surya/__init__.py`, `common/surya/decoder/__init__.py`,
  `common/surya/decoder/config.py`, `ocr_error/model/config.py`,
  `ocr_error/model/encoder.py`, `ocr_error/tokenizer.py`,
  `table_rec/model/encoder.py`, and `table_rec/model/encoderdecoder.py`.

Each changed file of `pdftext/` carries a notice at its top.

Last change: 2026-10-19.
