Update inference.py
Browse files38 unmodified lines394041424342444544464748495038 unmodified lines
def load_model(): """Load the model and tokenizer""" from huggingface_hub import hf_hub_download repo = "YoungDSMLKZ/UnixCoder-MIL" tokenizer = AutoTokenizer.from_pretrained("YoungDSMLKZ/UnixCoder-MIL") tokenizer = AutoTokenizer.from_pretrained(repo) model = MilUnixCoder("microsoft/unixcoder-base") model.load_state_dict(load_file("YoungDSMLKZ/UnixCoder-MIL/model.safetensors")) weights_path = hf_hub_download(repo_id=repo, filename="model.safetensors") model.load_state_dict(load_file(weights_path)) model.to(DEVICE).eval() return model, tokenizer
inference.py+5-2