$npx skillfedfor your agent

tf2crf

a crf layer for tensorflow 2 keras

With conditionsPyPI Artificial IntelligenceReleased Sep 2021202.0K downloads / moMIT LicensePure Python

Decision gist · record as of 2026-08-14

pure-Python wheel — tf2crf-0.1.33-py2.py3-none-any.whl
v0.1.33 · released 2021-09-10 · 2 runtime deps: tensorflow, tensorflow-addons

Yes-with-conditions. The package solves a real problem (CRF in Keras) and has low install friction, but it is abandoned and last tested with TensorFlow versions from 2021. Install only if you can verify compatibility with your TensorFlow and tensorflow-addons versions, and accept the risk that bugs or incompatibilities will not be fixed upstream. For active projects, consider whether a maintained alternative or a custom CRF implementation is safer.AI-flagged interpretation of the facts on this page — verify before relying

Before you install

  • Requires TensorFlow >= 2.1.0 and compatible tensorflow-addons version; you must manage version alignment yourself.
  • Low install friction; pure Python wheel.
  • However, the package is abandoned—last release was 2021-09-10 and last commit 2023-03-25.

License · maintenance · safety

MIT License (permissive) — MIT License permits commercial and private use with minimal restrictions, making it safe to adopt from a licensing standpoint.

last release 2021-09-10 (1799 days) · last repo commit 2023-03-25 · 69 stars

0 known vulnerabilities (OSV.dev, 2026-08-14) · 201,989 downloads/mo, #9,654 on PyPI

Verify before relying

pip install tf2crf

import tensorflow as tf
from tf2crf import CRF, ModelWithCRFLoss
from tensorflow.keras.layers import Input, Embedding, Bidirectional, GRU
from tensorflow.keras.models import Model

inputs = Input(shape=(None,), dtype='int32')
output = Embedding(100, 40, mask_zero=True)(inputs)
output = Bidirectional(GRU(64, return_sequences=True))(output)
crf = CRF(units=9, type='float32')
output = crf(output)
base_model = Model(inputs, output)
model = ModelWithCRFLoss(base_model, sparse_target=True)
model.compile(optimizer='adam')
model.fit(x=x, y=y, epochs=2, batch_size=2)
  • Whether the package works with current TensorFlow versions (last tested 2021-09-10)
  • Compatibility status with recent tensorflow-addons releases
  • Performance or correctness issues discovered since abandonment
Same gist for agents: .md · .json

What it is and what it does

tf2crf wraps a CRF (Conditional Random Field) layer into TensorFlow 2 Keras, allowing you to add sequence-level constraints to neural sequence labeling models. It handles masking automatically and supports mixed precision training. The package includes a ModelWithCRFLoss wrapper that decouples the loss function from the layer itself, and offers an optional DSC (Dice) loss variant for imbalanced datasets.

The layer is designed to sit at the end of a sequence model (typically after a BiLSTM or BiGRU) and learns transition probabilities between output labels. You build a standard Keras model, wrap it with ModelWithCRFLoss, and train normally. However, the package has been abandoned since mid-2021, so you should verify compatibility with your TensorFlow and tensorflow-addons versions before relying on it in production.

Use it for

  • Named entity recognition (NER) tasks where label transitions matter and you want CRF constraints
  • Part-of-speech tagging or other sequence labeling where forbidden transitions should be penalized
  • Imbalanced NLP classification using the DSC loss variant to improve F1 scores
  • Prototyping sequence models with Keras when you need CRF without building it from scratch

Worth the install?

AI-flagged interpretation of the facts on this page. Verify before relying on it.

With conditions

Yes-with-conditions.

The package solves a real problem (CRF in Keras) and has low install friction, but it is abandoned and last tested with TensorFlow versions from 2021. Install only if you can verify compatibility with your TensorFlow and tensorflow-addons versions, and accept the risk that bugs or incompatibilities will not be fixed upstream. For active projects, consider whether a maintained alternative or a custom CRF implementation is safer.

Install

tf2crf on PyPI

Before you install

Low install friction; pure Python wheel. However, the package is abandoned—last release was 2021-09-10 and last commit 2023-03-25. Depends on tensorflow and tensorflow-addons, which are large dependencies; you'll need to manage compatibility between them yourself.

Requires TensorFlow >= 2.1.0 and compatible tensorflow-addons version; you must manage version alignment yourself.

License in practice

MIT License permits commercial and private use with minimal restrictions, making it safe to adopt from a licensing standpoint.

Quickstart

pip install tf2crf

import tensorflow as tf
from tf2crf import CRF, ModelWithCRFLoss
from tensorflow.keras.layers import Input, Embedding, Bidirectional, GRU
from tensorflow.keras.models import Model

inputs = Input(shape=(None,), dtype='int32')
output = Embedding(100, 40, mask_zero=True)(inputs)
output = Bidirectional(GRU(64, return_sequences=True))(output)
crf = CRF(units=9, type='float32')
output = crf(output)
base_model = Model(inputs, output)
model = ModelWithCRFLoss(base_model, sparse_target=True)
model.compile(optimizer='adam')
model.fit(x=x, y=y, epochs=2, batch_size=2)

Verify before relying

  • Whether the package works with current TensorFlow versions (last tested 2021-09-10)
  • Compatibility status with recent tensorflow-addons releases
  • Performance or correctness issues discovered since abandonment

Package facts

LicenseMIT License permissive
Python supportNot specified
Install frictionLow. Pure-Python wheel
Runtime dependencies
2 packages
tensorflowtensorflow-addons
MaintenanceAbandoned 1,799 days since the last release
Last repo commit
First released
Downloads201,989 / month, #9,654 on PyPI 30-day window, as of 2026-08-14
Known vulnerabilitiesNone known OSV.dev, checked 2026-08-14

Evidence: tf2crf-0.1.33-py2.py3-none-any.whl

Tags

Capabilities
CRF layer tensorflow kerassequence labeling tensorflowconditional random field kerasNLP sequence tagging tensorflowtensorflow CRF implementationkeras masking CRFnamed entity recognition tensorflow
Topics
sequence-labelingnlpabandoned

Let your AI agent find packages like this

Example. Real query, live index.

You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.

wish › “CRF layer tensorflow keras”

  • tf2crfProvides a Conditional Random Field (CRF) layer for TensorFlow 2…
  • netronNetron is a viewer for neural network and machine learning models…
  • keras-hubKerasHub provides Keras 3 implementations of pretrained model…

Give your agent the search over MCP, or paste the wish link into any chat.

More Artificial Intelligence packages

litellm With conditions
PyPI · Artificial Intelligence · released Aug 2026

LiteLLM provides a unified Python interface to call 100+ LLM providers (OpenAI, Anthropic, Gemini, Bedrock, Azure, and others) using OpenAI-compatible API format, available as both a Python SDK and a self-hosted AI Gateway proxy server.

Install it if you need to work with multiple LLM providers or want to centralize LLM routing in your organization.

MITcompiled wheel
682.8Mdownloads / mo
huggingface-hub Worth it
PyPI · Artificial Intelligence · released Aug 2026

Client library and CLI tool for downloading, uploading, and managing models, datasets, and repositories on the Hugging Face Hub platform.

Install it if you work with Hugging Face Hub models or datasets.

Apache-2.0pure Python · 3.10.0+
442.4Mdownloads / mo
langchain Worth it
PyPI · Python Modules · released Aug 2026

LangChain provides a framework for building agents and LLM-powered applications by composing language models, tools, and memory through a unified API that abstracts over multiple model providers.

MITpure Python
315.4Mdownloads / mo
hf-xet With conditions
PyPI · Artificial Intelligence · released Aug 2026

hf-xet provides chunk-based deduplication and efficient file transfer for the Hugging Face Hub, enabling faster uploads and downloads of large files with local disk caching.

Apache-2.0compiled wheel · 3.8+
258.4Mdownloads / mo
tokenizers Worth it
PyPI · Artificial Intelligence · released Apr 2026

Tokenizers converts raw text into token sequences for NLP models, with support for training custom vocabularies and using pre-built tokenizers (BPE, WordPiece) optimized for speed via Rust.

Apache-2.0compiled wheel · 3.10+
222.9Mdownloads / mo
transformers Worth it
PyPI · Artificial Intelligence · released Aug 2026

Transformers provides a unified framework for loading, fine-tuning, and running state-of-the-art pretrained models across text, vision, audio, video, and multimodal tasks using PyTorch, JAX, or TensorFlow.

Install it if you need to run or train any transformer-based model for NLP, vision, audio, or multimodal tasks.

permissive licensepure Python · 3.10.0+
186.6Mdownloads / mo

See also sklearn-crfsuite · python-crfsuite · keras-nlp · tf-slim · tf-keras-nightly · seqeval · keras · tf-keras · keras-nightly · seqio-nightly

Further reading