from transformers import AutoConfig from modeling.modeling_gpt2 import GPT2CustomLMHeadModel cfg = AutoConfig.from_pretrained("hf-internal-testing/tiny-random-gpt2") GPT2CustomLMHeadModel.register_for_auto_class("AutoModelForCausalLM") model = GPT2CustomLMHeadModel(cfg) model.save_pretrained("/home/fxmarty/hf_internship/tiny-testing-gpt2-remote-code")