Fixed: "BertForTokenClassification LOAD REPORT from: dslim/bert-base-NER"
A named entity recognition (NER) pipeline with dslim/bert-base-NER printed BertForTokenClassification LOAD REPORT from: dslim/bert-base-NER, with two weights marked UNEXPECTED, before finding the right names. The two weights belong to a part the model doesn't have on purpose, so the report is harmless. logging.set_verbosity_error() hides it once you know that.
What I Was Doing
I was finding the names of people, organizations and places in a sentence, with a token-classification (NER) pipeline in Transformers 5.26.0, on Python 3.14:
from transformers import pipeline
ner = pipeline(
"ner",
model="dslim/bert-base-NER",
revision="d1a3e8f13f8c3566299d95fcfc9a8d2382a9affc",
aggregation_strategy="simple",
)
print(ner("Grace Hopper joined the United States Navy in New York."))
uv run python ner.py
What I Expected
The names in the sentence, each with its type and score, and nothing else.
What I Got
Loading weights: 100%|██████████████████████████████████████████| 199/199 [00:00<00:00, 5603.07it/s]
[transformers] BertForTokenClassification LOAD REPORT from: dslim/bert-base-NER
Key | Status | Details
-------------------------+------------+--------
bert.pooler.dense.bias | UNEXPECTED |
bert.pooler.dense.weight | UNEXPECTED |
Notes:
- UNEXPECTED: can be ignored when loading from different task/architecture; not ok if you expect identical arch.
[{'entity_group': 'PER', 'score': np.float32(0.99951303), 'word': 'Grace Hopper', 'start': 0, 'end': 12}, {'entity_group': 'ORG', 'score': np.float32(0.98393327), 'word': 'United States Navy', 'start': 24, 'end': 42}, {'entity_group': 'LOC', 'score': np.float32(0.99934256), 'word': 'New York', 'start': 46, 'end': 54}]

The entities are right: Grace Hopper is a person (PER), the United States Navy an organization (ORG) and New York a place (LOC). The report came first, with two weights the loader didn't expect.
What I Checked
What the report means. The report's own note says: "UNEXPECTED: can be ignored when loading from different task/architecture; not ok if you expect identical arch." An unexpected weight is one that's in the model's file on the Hub but has no place in the model that loads it.
Whether the weights are in the file. I listed the weights in the model's model.safetensors whose names contain pooler:
['bert.pooler.dense.bias', 'bert.pooler.dense.weight']
They are: the file holds a pooler, a small layer named bert.pooler.dense.
Whether the model has a pooler. In transformers/models/bert/modeling_bert.py, the token-classification model builds its BERT body without one:
class BertForTokenClassification(BertPreTrainedModel):
def __init__(self, config: BertConfig):
super().__init__(config)
self.num_labels = config.num_labels
self.bert = BertModel(config, add_pooling_layer=False)
and BertModel sets self.pooler = BertPooler(config) if add_pooling_layer else None. The pooler turns the first token's vector into one vector for the whole text ("We "pool" the model by simply taking the hidden state corresponding to the first token", says its code), and BertForSequenceClassification, which classifies whole texts, builds its BERT body with one. Token classification labels every token instead, so it has no use for it. Printing the pipeline's pooler confirmed it:
from transformers import pipeline
ner = pipeline(
"ner",
model="dslim/bert-base-NER",
revision="d1a3e8f13f8c3566299d95fcfc9a8d2382a9affc",
aggregation_strategy="simple",
)
print(ner.model.bert.pooler)
Loading weights: 100%|█████████████████████████████████████████| 199/199 [00:00<00:00, 13213.86it/s]
[transformers] BertForTokenClassification LOAD REPORT from: dslim/bert-base-NER
Key | Status | Details
-------------------------+------------+--------
bert.pooler.dense.weight | UNEXPECTED |
bert.pooler.dense.bias | UNEXPECTED |
Notes:
- UNEXPECTED: can be ignored when loading from different task/architecture; not ok if you expect identical arch.
None
None: no pooler. The report appeared again, since the model was loaded again.
Where the report comes from. log_state_dict_report in transformers/utils/loading_report.py builds the table and logs it with logger.warning(...). It's a warning from Transformers' logging, so Transformers' logging level decides whether it shows.
Why It Happens
The dslim/bert-base-NER file contains the weights of a pooler. The BertForTokenClassification model that loads it is built without a pooler, because labelling tokens doesn't use one. Transformers 5 lists the two weights it leaves unused as UNEXPECTED. Nothing is missing, and the results are correct.
The Fix
Nothing in the model needs fixing. Once you've read the report and know the unexpected weights are only the pooler, you can stop Transformers from printing warnings. Its logging documentation says "the default verbosity of the library is WARNING", and set_verbosity_error() changes it so that it reports only errors:
from transformers import logging, pipeline
logging.set_verbosity_error()
ner = pipeline(
"ner",
model="dslim/bert-base-NER",
revision="d1a3e8f13f8c3566299d95fcfc9a8d2382a9affc",
aggregation_strategy="simple",
)
print(ner("Grace Hopper joined the United States Navy in New York."))

logging here is Transformers' own logging module, imported from transformers. The call has to come before the pipeline is created, because the report is printed while the model loads.
After the Fix
uv run python ner.py
Loading weights: 100%|█████████████████████████████████████████| 199/199 [00:00<00:00, 13712.73it/s]
[{'entity_group': 'PER', 'score': np.float32(0.99951303), 'word': 'Grace Hopper', 'start': 0, 'end': 12}, {'entity_group': 'ORG', 'score': np.float32(0.98393327), 'word': 'United States Navy', 'start': 24, 'end': 42}, {'entity_group': 'LOC', 'score': np.float32(0.99934256), 'word': 'New York', 'start': 46, 'end': 54}]

The report is gone, and the entities and scores are exactly the same. The commands work unchanged in PowerShell.
Common Mistakes
| Mistake | What happens | Do this instead |
|---|---|---|
| Hiding warnings before reading the report | You'd also hide a report that matters, such as MISSING weights in a model you expected to be complete | Read it once, then decide |
Calling set_verbosity_error() after creating the pipeline | The report has already been printed | Call it before loading any model |
| Expecting only this report to disappear | Every Transformers warning disappears, such as the one about texts longer than the model's maximum | Turn the level back with logging.set_verbosity_warning() where you need warnings |
Troubleshooting
| Symptom | Likely cause | Fix |
|---|---|---|
A MISSING row in the report | The model needs weights its file doesn't have. The report's note says "those params were newly initialized because missing from the checkpoint. Consider training on your downstream task." | Use a model trained for your task, or train it |
A load report with other UNEXPECTED keys | Another model whose file has parts the loading class doesn't use | Check the keys' names against the class's code before ignoring them |
FAQ
Can I hide it without changing the code?
Yes. The logging documentation describes an environment variable, TRANSFORMERS_VERBOSITY, that sets the same level when you run a script. Running the original ner.py with TRANSFORMERS_VERBOSITY=error in front of the command printed no report.
Does the report appear every time?
Every time the model loads. Printing the pooler loaded the model a second time, and the report came again.
Conclusion
BertForTokenClassification LOAD REPORT from: dslim/bert-base-NER listed bert.pooler.dense.weight and bert.pooler.dense.bias as UNEXPECTED because the model's file has a pooler that the token-classification model doesn't use. The entities were right all along; logging.set_verbosity_error() before creating the pipeline hid the report.
Additional Resources
- Logging — verbosity levels,
set_verbosity_error()andTRANSFORMERS_VERBOSITY. - dslim/bert-base-NER — the model's card.
