Update inference.py
Browse files38 unmodified lines39404142434445464738 unmodified linesdef load_model():"""Load the model and tokenizer"""tokenizer = AutoTokenizer.from_pretrained("YoungDSMLKZ/UnixCoder-MIL")model = MilUnixCoder("microsoft/unixcoder-base")model.load_state_dict(load_file("YoungDSMLKZ/UnixCoder-MIL/model.safetensors"))model.to(DEVICE).eval()return model, tokenizer38 unmodified lines39404142434445464748495038 unmodified linesdef load_model():"""Load the model and tokenizer"""from huggingface_hub import hf_hub_downloadrepo = "YoungDSMLKZ/UnixCoder-MIL"tokenizer = AutoTokenizer.from_pretrained(repo)model = MilUnixCoder("microsoft/unixcoder-base")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