from huggingface_hub import hf_hub_download from transformers import AutoModelForPreTraining, AutoTokenizer # Download model and tokenizer model_path = hf_hub_download("law-ai/InLegalBERT", filename="pytorch_model.bin") tokenizer_path = hf_hub_download("law-ai/InLegalBERT", filename="tokenizer_config.json") # Load locally downloaded model and tokenizer tokenizer = AutoTokenizer.from_pretrained(tokenizer_path) model = AutoModelForPreTraining.from_pretrained(model_path)