Downloading to my machine

At my workplace we have access to transformers and pytorch library but cannot connect to internet from our python environment. Could anyone help with how we could get the script working after manually downloading files to my machine? thanks

what I am trying to do is similar to Load a pre-trained model from disk with Huggingface Transformers - Stack Overflow

my specific questions are -

  1. should i go to the location bert-base-uncased at main and download all the files?

  2. How should i change the below code

    # Load pre-trained model tokenizer (vocabulary)
    tokenizer = BertTokenizer.from_pretrained('bert-base-uncased')
    # Tokenize our sentence with the BERT tokenizer.
    tokenized_text = tokenizer.tokenize(marked_text)
  3. How should I change the below code

# Load pre-trained model (weights)
model = BertModel.from_pretrained('bert-base-uncased',

                                  output_hidden_states = True, # Whether the model returns all hidden-states.


Please let me know if anyone has done this…thanks