Using HuggingFace on no-free-internet-access server

When loading a model from pretrained, you can pass the model’s name to be obtained from Hugging Face servers, or you can pass the path of the pretrained model.

On a computer with internet access, load a pretrained model by passing the name of the model to be downloaded, then save it and move it to the computer without internet access.

model.save_pretrained("./your_file_name")

In the computer without internet access, load the pretrained model by passing the path of the file you downloaded earlier and moved here.

BertModel.from_pretrained("./your_file_name")
2 Likes