This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pickle | |
import os | |
import json | |
import faiss | |
import tqdm | |
import numpy as np | |
import pytrec_eval | |
import time | |
from typing import List, Tuple | |
from collections import defaultdict |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from matplotlib import pyplot as plt | |
plt.rcParams['font.family'] = 'serif' | |
plt.rcParams['font.serif'] = ['Times New Roman'] + plt.rcParams['font.serif'] | |
plt.rcParams['font.size'] = 20 | |
x = [1, 2, 3] | |
y1 = [1, 2, 3] | |
y2 = [2, 3, 4] | |
plt.plot(x, y1, label='y1') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from beir import util, LoggingHandler | |
from beir.retrieval import models | |
from beir.datasets.data_loader import GenericDataLoader | |
from beir.retrieval.evaluation import EvaluateRetrieval | |
from beir.retrieval.search.dense import DenseRetrievalExactSearch as DRES | |
import logging | |
import pathlib, os | |
import random | |
import json |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# coding=utf-8 | |
# Copyright 2019-present, the HuggingFace Inc. team, The Google AI Language Team and Facebook, Inc. | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# | |
# http://www.apache.org/licenses/LICENSE-2.0 | |
# | |
# Unless required by applicable law or agreed to in writing, software |