From 465e76b009823705408892c6e9b37794b9747b17 Mon Sep 17 00:00:00 2001 From: antoniogois Date: Wed, 13 Jan 2021 20:09:27 +0000 Subject: [PATCH] fix instructions to load triviaqa checkpoint #134 --- scripts/cheatsheet.txt | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/scripts/cheatsheet.txt b/scripts/cheatsheet.txt index 34ba1ec..4eb6925 100644 --- a/scripts/cheatsheet.txt +++ b/scripts/cheatsheet.txt @@ -60,10 +60,15 @@ python -m scripts.triviaqa \ --dev_dataset squad-wikipedia-dev-4096.json \ --gpus 0 --num_workers 4 \ --max_seq_len 4096 --doc_stride -1 \ - --save_prefix triviaqa-longformer-large \ # pretrained pytorch-lighting checkpoint - --model_path path/to/pretrained/longformer-large-4096 \ # loaded but not used + --saved_prefix choose-a-name-for-output-dir + --model_path path/to/pretrained/longformer-large-4096 # path to folder of downloaded model pretrained with Masked LM, creating your own roberta-large-4096 following "convert_model_to_long.ipynb" will not work here + --resume_ckpt path/to/triviaqa-longformer-large/checkpoints/fixed_ckpt_epoch_4_v2.ckpt # path to downloaded model finetuned for triviaqa --test # predictions will be saved into `predictions.json` +Note: if "fixed_ckpt_epoch_4_v2.ckpt" fails to load, use python console to add these 2 values: +checkpoint["state_dict"]["model.embeddings.position_ids"] = torch.arange(4098).to('cuda').unsqueeze(0) +checkpoint["checkpoint_callback_best_model_path"]="" # some versions of pytorch lightning may not need this + # then run the official evaluation scripts python -m scripts.triviaqa_utils.evaluation_utils \ --dataset_file path/to/qa/wikipedia-dev.json \