Skip to content

Commit

Permalink
Minor inference fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
zeynepakkalyoncu committed Aug 21, 2019
1 parent 0b89d8c commit 6caaf2e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,11 @@ For BERT(MB):
```
export CUDA_VISIBLE_DEVICES=0; experiment=${experiment}; \
nohup python -u src/main.py --mode training --experiment ${experiment} --collection mb \
--local_model <models/bert-large-uncased.tar.gz> \
--local_model models/bert-large-uncased.tar.gz \
--local_tokenizer models/bert-large-uncased-vocab.txt --batch_size 16 \
--data_path data --predict_path data/predictions/predict.${experiment} \
--model_path models/saved.${experiment} --eval_steps 1000 --qrels_file qrels.microblog.txt \
--device cuda --output_path logs/out.${experiment} --qrels_file qrels.microblog.txt > logs/${experiment}.log 2>&1 &
--device cuda --output_path logs/out.${experiment} > logs/${experiment}.log 2>&1 &
```

For BERT(CAR -> MB) and BERT(MS MARCO -> MB):
Expand All @@ -67,7 +67,7 @@ nohup python -u src/main.py --mode training --experiment ${experiment} --collect
--local_tokenizer models/bert-large-uncased-vocab.txt --batch_size 16 \
--data_path data --predict_path data/predictions/predict.${experiment} \
--model_path models/saved.${experiment} --eval_steps 1000 --qrels_file qrels.microblog.txt \
--device cuda --output_path logs/out.${experiment} --qrels_file qrels.microblog.txt > logs/${experiment}.log 2>&1 &
--device cuda --output_path logs/out.${experiment} > logs/${experiment}.log 2>&1 &
```

## Inference
Expand Down
6 changes: 3 additions & 3 deletions src/args.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,22 @@ def get_args():
parser.add_argument('--mode', default='retrieval', help='[training, inference, retrieval]')
parser.add_argument('--output_path', default='out.tmp', help='Name of log file')
parser.add_argument('--data_path', default='data')
parser.add_argument('--anserini_path', default='../Anserini', help='Path to Anserini root')
parser.add_argument('--collection', default='robust04', help='[mb, robust04, core17, core18]')
parser.add_argument('--trec_eval_path', default='eval/trec_eval.9.0.4/trec_eval')

# Interactive
parser.add_argument('--interactive', action='store_true', default=False, help='Batch evaluation if not set')
parser.add_argument('--query', default='hubble space telescope', help='Query string')
parser.add_argument('--interactive_path', default='data/datasets/query_sents.csv', help='Path to output sentence results from query')

# Retrieval
parser.add_argument('--experiment', default='base_mb_robust04', help='Experiment name for logging')
parser.add_argument('--anserini_path', default='../Anserini', help='Path to Anserini root')
parser.add_argument('--experiment', default=None, help='Experiment name for logging')
parser.add_argument('--index_path', default='lucene-index.robust04.pos+docvectors+rawdocs', help='Path to Lucene index')
parser.add_argument('--cv_fold', default=5)

# Training
parser.add_argument('--device', default='cpu', help='[cuda, cpu]')
parser.add_argument('--trec_eval_path', default='eval/trec_eval.9.0.4/trec_eval')
parser.add_argument('--model_path', default='models/saved.tmp', help='Path to pretrained model')
parser.add_argument('--predict_path', default='predict.tmp')
parser.add_argument('--batch_size', default=16, type=int)
Expand Down
2 changes: 1 addition & 1 deletion src/model/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,5 +83,5 @@ def test(args, split='test', model=None, test_dataset=None):
model.train()

map, p20, ndcg20 = evaluate(args.trec_eval_path, predictions_file=args.predict_path, \
qrels_file=os.path.join(args.data_path, 'qrels', args.qrels_file))
qrels_file=os.path.join(args.data_path, 'qrels', 'qrels.{}.txt'.format(args.collection)))
return [['map', 'p20', 'ndcg20'], [map, p20, ndcg20]]

0 comments on commit 6caaf2e

Please sign in to comment.