How can I download the model architecture of my AutoTrain mode to be able to use outside of the transformers library?

Hi,

I trained several models using AutoTrain, in the resultant repo I see a pytorch_model.bin file which I’m guessing is the weights? If so, where can I download the main model architecture file? I assume it will have a .pt extension.

Currently I can load and use the model fine using the transformers library, but I want to be able to use it outside transformers, by loading it using pytorch’s model.load() function…

Additional info:

  • In the config.json for the architectures value I see “SwinForImageClassification”
  • my specific repo is a privae one (tkpop777/autotrain-meowbuddy-61144134682)

The weights are contained in the pytorch_model.bin file, so you can just do

import torch

state_dict = torch.load("path_to_pytorch_model.bin", map_location="cpu")

and then for your custom model:

model = CustomModel.load_state_dict(state_dict)

Note that .bin and .pt are just different extensions: What are the difference between .bin and .pt pytorch saved model types? - Stack Overflow