I don’t understand your code very well. To my understanding, you are:

Create a class named BertEmbedding and train an instance of this class
You use AutoModel which somehow automatically guess the class from the path of a pre-trained weight and load it to a new model instance.

I think there must be some rules to name the file for AutoModel to be able to guess the class of your saved model. I suggest that you directly create an instance from BertEmbedding and load the model in a normal way, or you change the name of the file path to the rule of AutoModel