.pt PyTorch Model ->PreTrainedModel

Similar to (How can I share a pytorch saved model on huggingFace hub), I am attempting to convert/utilize a PyTorch model with the .pt extension with Huggingface.

I have been reading through the docs on the ‘PreTrainedModel’ class, but have Not found a one-for-one solution. The model is a GPT based on this repository (GitHub - karpathy/nanoGPT: The simplest, fastest repository for training/finetuning medium-sized GPTs.).

You can’t use model written in other libraries inside Transformers.

1 Like

Ah okay, thank you !

But is there no way to convert at all?

Technically you can convert models to the Transformers format, if the model exists in the Transformers library and all parameters can be converted.

e.g. to convert llama from the original repository to the Transformers format => transformers/src/transformers/models/llama/convert_llama_weights_to_hf.py at main · huggingface/transformers · GitHub. Each model folder in the Transformers library has this so-called conversion script to convert weights from the original format to the Transformers format.