Skip to main content

Documentation Status Build PyPI version SWH License Downloads

DeLFT

DeLFT (Deep Learning Framework for Text) is a deep-learning framework for text processing, focusing on sequence labeling (e.g. named entity tagging, information extraction) and text classification (e.g. comment classification). This library re-implements standard state-of-the-art Deep Learning architectures relevant to text processing tasks.

DeLFT has three main purposes:

  1. Covering text and rich texts: most of the existing Deep Learning works in NLP only consider simple texts as input. In addition to simple texts, we also target rich text where tokens are associated to layout information (font. style, etc.), positions in structured documents, and possibly other lexical or symbolic contextual information. Text is usually coming from large documents like PDF or HTML, and not just from segments like sentences or paragraphs, and contextual features appear very useful. Rich text is the most common textual content used by humans to communicate and work.

  2. Reproducibility and benchmarking: by implementing several references/state-of-the-art models for both sequence labeling and text classification tasks, we want to offer the capacity to easily validate reported results and to benchmark several methods under the same conditions and criteria.

  3. Production level, by offering optimzed performance, robustness and integration possibilities, we aim at supporting better engineering decisions/trade-off and successful production-level applications.

Some contributions include:

  • A variety of modern NLP architectures and tasks to be used following the same API and input formats, including RNN and transformers.

  • Reduction of the size of RNN models, in particular by removing word embeddings from them. For instance, the model for the toxic comment classifier went down from a size of 230 MB with embeddings to 1.8 MB. In practice the size of all the models of DeLFT is less than 2 MB, except for Ontonotes 5.0 NER model which is 4.7 MB.

  • Implementation of a generic support of categorical features, available in various architectures.

  • Usage of dynamic data generator so that the training data do not need to stand completely in memory.

  • Efficient loading and management of an unlimited volume of static pre-trained embeddings.

  • A comprehensive evaluation framework with the standard metrics for sequence labeling and classification tasks, including n-fold cross validation.

  • Native integration of HuggingFace transformers (including recent models such as ModernBERT).

A native Java integration of the library has been realized in GROBID via JEP.

The DeLFT 1.0.x release line is built on PyTorch and has been tested successfully with Python 3.10/3.11 (see the PyPI badge above for the exact current version). As always, GPU(s) are required for decent training time. For example, a GeForce GTX 1050 Ti (4GB) is working very well for running RNN models and BERT or RoBERTa base models. Using BERT large model is no problem with a GeForce GTX 1080 Ti (11GB), including training with modest batch size. Using multiple GPUs (training and inference) is supported.

Migrating to PyTorch (0.4.x → 1.0.x)

The 1.0.x release line replaces the TensorFlow/Keras backend (used up to 0.4.x) with PyTorch. The public API, CLI entrypoints, architecture names and data formats are unchanged, but the runtime and saved weights are not. See the Upgrading section of the installation guide for the full step-by-step. Highlights:

  • PyTorch backend: torch 2.11, transformers 5.7 (native, no Keras-layer wrapping), and pytorch-crf replace TensorFlow / tf_keras / tensorflow-addons. Newer transformers such as ModernBERT are supported.
  • Retrain custom models: TensorFlow weights cannot be loaded into the PyTorch models and there is no automatic converter (the previous convert_model utility was removed). Bundled application models have been regenerated for PyTorch; custom models must be retrained with their original train / train_eval command.
  • GPU / CUDA 12.8: GPU builds target CUDA 12.8 via the [gpu] extra (see installation below). Reinstall into a fresh virtual environment to avoid leftover tensorflow packages.
  • ELMo support removed: the --use-ELMo flag and use_ELMo parameter are gone. Use transformer-based models (BERT, SciBERT, …) or static embeddings (GloVe, fastText) instead.
  • LMDB embedding caches built before 0.4.x use the legacy pickle format; convert them once with python -m delft.utilities.convert_lmdb_embeddings --input <old> --output <new> (or simply rebuild).

Other changes

  • Weights & Biases integration for experiment tracking, with resume support (--wandb flag) — see Experiment tracking (W&B)
  • Distributed / multi-GPU training support via SLURM scripts and accelerate — see Training on a cluster (SLURM)
  • ONNX export for BidLSTM_CRF / BidLSTM_CRF_FEATURES models (see below)
  • Additional checks for avoiding empty embeddings

DeLFT Documentation

Visit the DELFT documentation for detailed information on installation, usage and models.

Using DeLFT

PyPI packages are available for stable versions:

# macOS or Linux CPU
pip install delft

# Linux with CUDA 12.8 (adds PyTorch GPU support)
pip install "delft[gpu]" --extra-index-url https://download.pytorch.org/whl/cu128

Note: The base install pulls the standard PyTorch wheel from PyPI — that's a CPU build on Linux, and a native build on macOS arm64 that includes MPS (Apple Silicon GPU) support automatically. The [gpu] extra is for NVIDIA CUDA 12.8 on Linux.

DeLFT Installation

To work from source (current master), clone the repo, set up a virtual environment, and install in editable mode:

git clone https://github.com/kermitt2/delft
cd delft
uv venv --python=3.11
source .venv/bin/activate
uv pip install pip
uv pip install -e .          # macOS or Linux CPU (torch is included automatically)

For NVIDIA GPU (CUDA) wheels, older pre-Turing GPUs (V100/P100), the [dev] extras required for training, and upgrading from a TensorFlow-based build, follow the full Install DeLFT guide. See the DeLFT documentation for usage.

Experiment tracking and distributed training

  • Weights & Biases — pass --wandb to any train / train_eval / eval command to log the run. Setup (WANDB_API_KEY, project selection, resuming a run for evaluation) is in Experiment tracking (W&B).
  • SLURM clusters — multi-GPU training and the cluster submitter scripts are documented in Training on a cluster (SLURM).

ONNX Export

DeLFT supports exporting trained sequence labeling models (BidLSTM_CRF and BidLSTM_CRF_FEATURES) to ONNX format for inference in Java or other runtimes.

Export a model:

python -m delft.applications.onnx_export \
    --model grobid-date-BidLSTM_CRF_FEATURES \
    --output exported_models/date-features

This creates:

  • encoder.onnx - BiLSTM encoder model
  • crf_params.json - CRF transition matrices
  • vocab.json - Character and label vocabularies
  • config.json - Model configuration

Java inference:

A Java inference library is available in java/delft-onnx/. Build and run:

cd java/delft-onnx
./gradlew build
./gradlew run --args="--model ../../exported_models/date-features \
    --embeddings ../../data/db/glove-840B-raw \
    --input 'December 25, 2024'"

Note: For feature models, sample features are auto-generated for demo purposes.

License and contact

Distributed under Apache 2.0 license. The dependencies used in the project are either themselves also distributed under Apache 2.0 license or distributed under a compatible license.

If you contribute to DeLFT, you agree to share your contribution following these licenses.

Contact: Patrice Lopez (patrice.lopez@science-miner.com) and Luca Foppiano (@lfoppiano).

How to cite

If you want to this work, please refer to the present GitHub project, together with the Software Heritage project-level permanent identifier. For example, with BibTeX:

@misc{DeLFT,
    title = {DeLFT},
    howpublished = {\url{https://github.com/kermitt2/delft}},
    publisher = {GitHub},
    year = {2018--2026},
    archivePrefix = {swh},
    eprint = {1:dir:54eb292e1c0af764e27dd179596f64679e44d06e}
}

Metadata

Release files for delft 1.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for delft 1.1.0
File Size Uploaded
delft-1.1.0.tar.gz 165.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for delft 1.1.0
File Interpreter ABI Platform
delft-1.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 364.1 kB

Release files / delft-1.1.0.tar.gz

Download URL delft-1.1.0.tar.gz
Size 165.7 kB
Tags Source
SHA-256 checksum
How to use checksums
08866172703ccce429cc597ecfa66312d909d7a67dde9516216782a24d694c32
BLAKE2b-256 checksum
How to use checksums
ba6cba60bf44bc5a04a8f07073f063311843f636b767b19139fa14239ea59985
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 28, 2026.

Transparency log

Release files / delft-1.1.0-py3-none-any.whl

Download URL delft-1.1.0-py3-none-any.whl
Size 198.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5fe1b073831918da590e4fbb74d8a514c84f000c61028865846cade56d1d1695
BLAKE2b-256 checksum
How to use checksums
a950121b0e62758d697f2ccafcbe81a408dce06c59b3011f2947f57f824699ae
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 28, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

1.1.0 This release

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.4.6

2 release files

0.4.5

2 release files

0.4.4

2 release files

0.4.3

2 release files

0.4.2

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.5

2 release files

0.3.4

2 release files

0.3.3

2 release files

0.3.2

1 release file

0.3.1

1 release file

0.3.0

1 release file

0.2.8

2 release files

0.2.7

2 release files

0.2.6

1 release file

0.2.5

2 release files

0.2.4

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page