# Tongjilibo/bert4torch

An elegent pytorch implement of transformers

Repository: https://github.com/Tongjilibo/bert4torch
Canonical: https://ross.abutalabs.com/products/bert4torch
Homepage: https://bert4torch.readthedocs.io/
Language: Python
License: MIT
License Family: permissive
Topics: bert, nlp, pytorch, bert4keras, named-entity-recognition, relation-extraction, seq2seq, text-classification, transformers, bert4torch, belle, chatglm, llama, llm, large-language-models
Last push: 2026-05-16T12:38:37+00:00

## Health v2 (maintenance only)
Score: 82/100 (v2, computed 2026-09-02T17:46:02.011165+00:00)
- activity 82, release rhythm 71, longevity 100
- inputs: {"age_days": 1635, "days_push": 109, "days_rel": 112, "gap_med": 55.5, "n_releases_24m": 9}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 1328, forks 166 (observed 2026-08-28T04:04:23.682676+00:00)

## What it is
bert4torch is a PyTorch library providing an elegant reimplementation of transformer models (BERT, RoBERTa, T5, GPT, ChatGLM, LLaMA, etc.) for inference, fine-tuning, and building custom NLP models. It includes rich examples for tasks like text classification, sequence labeling, and LLM deployment via a one-line command-line service.

## Use cases
- fine-tune bert models for text classification in pytorch
- run inference with chatglm or llama weights
- train a named entity recognition model
- deploy a large language model service from the command line
- load pretrained transformer weights and customize the model architecture
- train a seq2seq model for text generation

## When to choose
- you want a lightweight, readable PyTorch alternative to HuggingFace transformers for BERT-style models
- you need to fine-tune Chinese LLMs like ChatGLM, Baichuan, or BELLE
- you prefer bert4keras-style APIs but work in PyTorch

## When to avoid
- you need the broadest model hub coverage and ecosystem integrations of HuggingFace transformers
- you require production-grade multi-GPU serving at scale
- your team depends on TensorFlow rather than PyTorch

## Facets
- artifact type: library
- maturity: active
- function: machine-learning, llm-inference, llm-training, nlp, transformers
- domain: large-language-models, machine-learning, deep-learning
- platform: python
- tags: bert, pytorch, transformers, fine-tuning, named-entity-recognition, text-classification, seq2seq, chatglm, llama, pretrained-models, natural-language-processing

## Member repositories
- Tongjilibo/bert4torch (main) score 82

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:04:23.682676+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T04:45:48.690445+00:00, confidence not recorded.
  - readme: https://github.com/Tongjilibo/bert4torch (fetched 2026-08-28T04:04:23.682676+00:00, sha ed91b33a6cd7)
  - registry_pypi: https://pypi.org/pypi/bert4torch/json (fetched 2026-08-29T12:05:21.181664+00:00, sha 08750ddd60f6)
- Data as of 2026-08-30T08:39:29.467469+00:00.
