# Steps to reproduce:
import trax
trax.models.bert.BERT(init_checkpoint="bert-base-uncased")
# Error logs:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/manifest/essential/utils/python/env/lib/python3.8/site-packages/trax/models/research/bert.py", line 160, in BERT
bert = PretrainedBERT(
File "/Users/manifest/essential/utils/python/env/lib/python3.8/site-packages/trax/models/research/bert.py", line 178, in __init__
self.init_checkpoint = None
File "/Users/manifest/essential/utils/python/env/lib/python3.8/site-packages/trax/layers/base.py", line 703, in __setattr__
raise ValueError(
ValueError: Trax layers only allow to set ('weights', 'state', 'rng') as public attribues, not init_checkpoint.
In the PR above, I've overridden the _settable_attrs function of the PretrainedBERT to allow setting init_checkpoint attribute required for loading the model from its checkpoints.
Description
PretrainedBERT model fails on its initialization.
Environment information
For bugs: reproduction and error logs