Using Trainer to save a Bartforsequenceclassification model
trainer.train()
trainer.save_model()It gives me the error:modeling_utils.py", line 2546, in save_pretrainedraise 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 usingsafe_serialization=Falseor remove this tensor sharing.Could anyone please tell me why is it happening? and how to solve it without using that safe_serialization=False?
2024-08-12T19:26:02Z
How were you abe to resolve it? I’m facing a similar error!
2024-08-13T02:22:38Z
It seems to be an issue with compatibility? There is a brief explanation on the HuggingFaceSafeTensors pagewhich seems to suggest that shared tensors is a torch-specific feature that isn’t compatible with HuggingFace.Asimilar problemwas resolved by settingsafe_serialization=Falsebut 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.
2024-08-13T08:14:35Z
It looks like you have introduced a new layer in your model. Is it so?