How to load model without pretrained weight
I can do ( with internet connection)TFViTModel.from_pretrained(
  'google/vit-base-patch16-224'
)now, without internet, and without requiring the pretrained weight, how to load this model?Until now, it givesOSError: We couldn't connect to 'https://huggingface.co' to load this file, couldn't find it in the cached files and it looks like google/vit-base-patch16-224 is not the path to a directory containing a file named config.json.
Checkout your internet connection or see how to run the library in offline mode at 'https://huggingface.co/docs/transformers/installation#offline-mode'.
2023-03-19T11:06:18Z
Tried this but stillpytorch - Make sure BERT model does not load pretrained weights? - Stack Overflowfrom transformers import AutoConfig
config = AutoConfig.from_pretrained('google/vit-base-patch16-224')
model =  AutoModel.from_config(config)
2023-03-19T11:40:04Z
This worksconfig =  AutoConfig.from_pretrained('..config.json', local_files_only=True)
model = TFViTModel.from_config(config)For my particular model, the config.json file is fromconfig.json · google/vit-base-patch16-224 at main
2023-11-02T01:21:21Z
Hi. Do you mean you downloaded the config.json file on the local environment?