It’s to find the right config in the Transformers library. In your case, you might have to use two steps:
config = CustomConfig.from_pretrained(path_to_folder_with_config_and_weights)
model = CustomModel.from_pretrained(path_to_folder_with_config_and_weights, config)