Instructions to use answerdotai/ModernBERT-base with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use answerdotai/ModernBERT-base with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("fill-mask", model="answerdotai/ModernBERT-base")# Load model directly from transformers import AutoTokenizer, AutoModelForMaskedLM tokenizer = AutoTokenizer.from_pretrained("answerdotai/ModernBERT-base") model = AutoModelForMaskedLM.from_pretrained("answerdotai/ModernBERT-base") - Notebooks
- Google Colab
- Kaggle
Encountering Error: cannot import name 'shard_checkpoint' from 'transformers.modeling_utils'
#44
by rkabir - opened
I was attempting to use ModernBERT, and made sure to download the transformer files from the github repo (I did this manually). After doing so and attempting to load the model, however, I came across the following error message:
"cannot import name 'shard_checkpoint' from 'transformers.modeling_utils'"
It seems that this import is attempted in awq/models/base.py.
Any suggestions to fix this?
Never mind, I fixed it. I had to update PEFT and torch, as well as use reference_compile=False.
I had to update autoawq, then it worked