File size: 1,669 Bytes
07eb921
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
from dataclasses import dataclass, field
from typing import Optional, List


@dataclass
class QueryEncoderArgs:
    model_name_or_path: str = field(
        default="facebook/dpr-question_encoder-single-nq-base",
        metadata={
            "help": "Path to pretrained model or model identifier from huggingface.co/models"
        },
    )
    cache_dir: str = field(
        default="/share/LMs",
        metadata={"help": "The path to save pretrain model."},
    )
    device: str = field(
        default="cuda:0",
        metadata={"help": "The device to run query encoder."},
    )


@dataclass
class SearcherArgs:
    index_dir: str = field(
        default="/share/ninglu_shao/code/Citation/faiss.wikipedia-dpr-100w.dpr_single-nq.20200115.cd5034",
        metadata={"help": "The path to index."},
    )
    doc_path: str = field(
        default="/share/ninglu_shao/data/Citation/psgs_w100.jsonl",
        metadata={"help": "The path to document."},
    )


@dataclass
class DataArgs:
    dataset_list: List[str] = field(
        default_factory=lambda: ["asqa"],
        metadata={"help": "The name of dataset."},
    )
    dataset_dir: str = field(
        default="/share/ninglu_shao/data/Citation",
        metadata={"help": "The path to dataset."},
    )
    save_dir: str = field(
        default="data/output",
        metadata={"help": "The path to save retrieved dataset."},
    )


@dataclass
class RetrieveArgs:
    k: int = field(
        default=5,
        metadata={"help": "The number of retrieved results."},
    )


@dataclass
class Args:
    trial_num: int = field(
        default=5,
        metadata={"help": "The number of trial."},
    )