Traceback (most recent call last):
File "test.py", line 5, in <module>
tokenizer.save_pretrained('new_save')
File "/cluster/envs/mult/lib/python3.7/site-packages/transformers/tokenization_utils_base.py", line 1979, in save_pretrained
f.write(json.dumps(tokenizer_config, ensure_ascii=False))
File "/cluster/envs/mult/lib/python3.7/json/__init__.py", line 238, in dumps
**kw).encode(obj)
File "/cluster/envs/mult/lib/python3.7/json/encoder.py", line 199, in encode
chunks = self.iterencode(o, _one_shot=True)
File "/cluster/envs/mult/lib/python3.7/json/encoder.py", line 257, in iterencode
return _iterencode(o, 0)
File "/cluster/envs/mult/lib/python3.7/json/encoder.py", line 179, in default
raise TypeError(f'Object of type {o.__class__.__name__} '
TypeError: Object of type BertConfig is not JSON serializable
Expected behavior
Tokenizer should be saveable. I'm guessing this could be happening because the bit that's supposed to be saving the config is using the json library directly, instead of calling to_json_file on the BertConfig, but I'm not sure.
Environment info
transformers
version: 4.3.1Who can help
@LysandreJik
Information
Model I am using (Bert, XLNet ...): Bert
The problem arises when using:
Using a minimal example with loading/saving a tokenizer.
The tasks I am working on is:
Again, this is just a minimal example.
To reproduce
Steps to reproduce the behavior:
BertConfig
and aBertTokenizer
based on the config.save_pretrained
Minimal example:
Error:
Expected behavior
Tokenizer should be saveable. I'm guessing this could be happening because the bit that's supposed to be saving the config is using the
json
library directly, instead of callingto_json_file
on theBertConfig
, but I'm not sure.