(model_path: str)
| 62 | |
| 63 | ########################### utils start ############################# |
| 64 | def load_model(model_path: str): |
| 65 | config = RobertaConfig.from_pretrained( |
| 66 | model_path, |
| 67 | finetuning_task="MSMarco", |
| 68 | ) |
| 69 | tokenizer = RobertaTokenizer.from_pretrained( |
| 70 | model_path, |
| 71 | do_lower_case=True |
| 72 | ) |
| 73 | model = ANCE.from_pretrained(model_path, config=config).to('cuda') |
| 74 | return tokenizer, model |
| 75 | |
| 76 | def build_faiss_index(index_path: str, n_gpu: int, faiss_gpu: bool=True): |
| 77 | gpu_resources = [] |
no test coverage detected