trainer.train()
trainer.save_model()
It gives me the error:
modeling_utils.py", line 2546, in save_pretrained
raise RuntimeError(
RuntimeError: The weights trying to be saved contained shared tensors [{‘model.shared.weight’, ‘model.encoder.embed_tokens.weight’, ‘model.decoder.embed_tokens.weight’}] that are mismatching the transformers base configuration. Try saving using safe_serialization=False
or remove this tensor sharing.
Could anyone please tell me why is it happening? and how to solve it without using that safe_serialization=False?
2 Likes
How were you abe to resolve it? I’m facing a similar error!
It seems to be an issue with compatibility? There is a brief explanation on the HuggingFace SafeTensors page which seems to suggest that shared tensors is a torch-specific feature that isn’t compatible with HuggingFace.
A similar problem was resolved by setting safe_serialization=False
but I couldn’t find any other work around and the SafeTensors page seems to suggest that unless HuggingFace addresses this, there really isn’t any other approach.
It looks like you have introduced a new layer in your model. Is it so?