-
Notifications
You must be signed in to change notification settings - Fork 101
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add monot5 tpu train doc * Update pygaggle/data/create_msmarco_t5_training_pairs.py Co-authored-by: Rodrigo Frassetto Nogueira <[email protected]> * update tpu experiment link to README and add trainning time info in tpu doc Co-authored-by: Rodrigo Frassetto Nogueira <[email protected]>
- Loading branch information
1 parent
5e1e0dd
commit da0fb61
Showing
3 changed files
with
81 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
""" | ||
This script creates monoT5 input files for training, | ||
Each line in the monoT5 input file follows the format: | ||
f'Query: {query} Document: {document} Relevant:\t{label}\n') | ||
""" | ||
import argparse | ||
from tqdm import tqdm | ||
|
||
parser = argparse.ArgumentParser() | ||
parser.add_argument("--triples_train", type=str, required=True, | ||
help="tsv file <query>, <positive_document>, <negative_document>") | ||
parser.add_argument("--output_to_t5", type=str, required=True, | ||
help="t5 train input file") | ||
args = parser.parse_args() | ||
|
||
with open(args.output_to_t5, 'w') as fout_t5: | ||
for line_num, line in enumerate(tqdm(open(args.triples_train))): | ||
query, positive_document, negative_document = line.strip().split('\t') | ||
fout_t5.write(f'Query: {query} Document: {positive_document} Relevant:\ttrue\n') | ||
fout_t5.write(f'Query: {query} Document: {negative_document} Relevant:\tfalse\n') | ||
print('Done!') |