Instructions to use kerasformers/bert_large_uncased with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- KerasFormers
How to use kerasformers/bert_large_uncased with KerasFormers:
# No code snippets available yet for this library. # To use this model, check the repository files and the library's documentation. # Want to help? PRs adding snippets are welcome at: # https://github.com/huggingface/huggingface.js
- Keras
How to use kerasformers/bert_large_uncased with Keras:
# Available backend options are: "jax", "torch", "tensorflow". import os os.environ["KERAS_BACKEND"] = "jax" import keras model = keras.saving.load_model("hf://kerasformers/bert_large_uncased") - Notebooks
- Google Colab
- Kaggle
pipeline_tag: fill-mask
license: apache-2.0
base_model: google-bert/bert-large-uncased
library_name: kerasformers
tags:
- keras
- kerasformers
- bert
- uncased
- fill-mask
- text-encoder
- arxiv:1810.04805
- pytorch
- jax
- tf
See our collection for all versions of BERT.
Run BERT with Keras 3: JAX, PyTorch, or TensorFlow
kerasformers/bert_large_uncased
Paper: BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding (arXiv:1810.04805) · HF Papers
BERT is Google's bidirectional transformer text encoder, pretrained with masked LM and next-sentence prediction. WordPiece tokenizer; mask token [MASK]. Uncased variants lower-case the input; cased variants preserve case.
For more details on the model, please go to the upstream model card.
Pure-Keras 3 conversion of google-bert/bert-large-uncased for kerasformers. One implementation runs unmodified on TensorFlow / Torch / JAX.
This is a fill-mask / encoder checkpoint (BertMaskedLM, large uncased). Task heads (sequence/token classify, QA, NSP, …) load via hf: fine-tunes.
✨ Quick start (fill-mask)
import os
os.environ["KERAS_BACKEND"] = "torch" # or "jax" / "tensorflow"
from kerasformers.models.bert import BertMaskedLM, BertTokenizer
mlm = BertMaskedLM.from_weights("kerasformers/bert_large_uncased")
tokenizer = BertTokenizer.from_weights("kerasformers/bert_large_uncased")
inputs = tokenizer("the capital of france is [MASK].")
logits = mlm(inputs) # (1, L, vocab_size)
mask = int((inputs["input_ids"][0] == tokenizer.mask_token_id).argmax())
print(tokenizer.ids_to_tokens[int(logits[0, mask].argmax())])
Load any BERT variant the same way with from_weights("kerasformers/<variant>"):
| Variant | Hub | Casing |
|---|---|---|
bert_base_uncased |
kerasformers/bert_base_uncased |
uncased |
bert_large_uncased |
kerasformers/bert_large_uncased |
uncased |
bert_base_cased |
kerasformers/bert_base_cased |
cased |
bert_large_cased |
kerasformers/bert_large_cased |
cased |
Tips
- Set
KERAS_BACKENDbefore importing Keras / kerasformers. - Prefer
BertTokenizer.from_weights(...)so WordPiece casing matches. - Use
[MASK](not<mask>). - See BERT docs and Loading Weights.
- Community / upstream safetensors still work via the
hf:prefix, e.g.BertMaskedLM.from_weights("hf:google-bert/bert-large-uncased").
Special Thanks
A huge thank you to the Google BERT authors for creating and releasing these models.
License: Apache 2.0.