What is difference between Model.register_for_auto_class and AutoModel.register?
I have created some new model and want to register it, so I can use AutoModelFor…() to call it.I have readSharing custom models, but I can’t tell the difference betweenResnetConfig.register_for_auto_class()
ResnetModel.register_for_auto_class("AutoModel")
ResnetModelForImageClassification.register_for_auto_class("AutoModelForImageClassification")andAutoConfig.register("resnet", ResnetConfig)
AutoModel.register(ResnetConfig, ResnetModel)
AutoModelForImageClassification.register(ResnetConfig, ResnetModelForImageClassification)Can anyone tell me the difference and which one I should use?
2023-01-17T16:55:04Z
The first one makes it so that the code of your model is also saved when you domodel.save_pretrainedso it can be re-used by another user (it’s the code on the Hub feature).The second one allows you to use your custom model with the auto-API (but doesn’t share any custom code with other users).