-
Notifications
You must be signed in to change notification settings - Fork 191
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP] Add XLNet support for Reader #205
base: master
Are you sure you want to change the base?
Conversation
Codecov Report
@@ Coverage Diff @@
## master #205 +/- ##
==========================================
- Coverage 31.23% 23.22% -8.01%
==========================================
Files 7 9 +2
Lines 1508 2032 +524
==========================================
+ Hits 471 472 +1
- Misses 1037 1560 +523
Continue to review full report at Codecov.
|
Traceback (most recent call last):
File "tutorial-train-xlnet-squad.py", line 39, in <module>
out_eval, final_prediction = reader.evaluate(X='dev-v2.0.json')
ValueError: too many values to unpack (expected 2) |
To use the XLNet reader with a pretrained import wget
from cdqa.reader.reader_sklearn import Reader
wget.download(url='https://github.com/cdqa-suite/cdQA/releases/download/XLNet_cased_vCPU/pytorch_model.bin', out='.')
# cast Reader class with train params
reader = Reader(model_type='xlnet',
model_name_or_path='xlnet-base-cased',
output_dir='.',
evaluate_during_training=False,
no_cuda=False,
fp16=False,
pretrained_model_path='.')
# make some predictions
reader.predict(X='dev-v2.0-small.json') |
|
from #196 |
Any progress with this? |
Hi @alex-movila You can follow our progress on this PR here. We described all the steps to achieve in order to be synced with the latest changes made by @huggingface. At the moment we depend on the pytorch-transformers repository as a backend for our QA system. The @huggingface community is progressively implementing new models. They are now in the process of adding RoBERTa (see this). They don't have plan to add ERNIE a the moment (see this). Their new API should allow the user to use any transformer to do QA. We are looking to provide the same thing with cdQA. |
I could not replicate results of official SQuAD 2.0 with our trained XLNet model: from cdqa.reader.reader_sklearn import Reader
reader = Reader(model_type='xlnet',
model_name_or_path='xlnet-base-cased',
fp16=False,
output_dir='.',
no_cuda=False,
pretrained_model_path='.')
reader.evaluate(X='dev-v2.0.json') See my colab notebook for reproducibility: https://colab.research.google.com/github/cdqa-suite/cdQA/blob/sync-huggingface/examples/tutorial-eval-xlnet-squad2.0.ipynb
It might be an not optimzed hyperparameters issue (see this: huggingface/transformers#822). @andrelmfarias can you confirm the params you used during training? (https://github.com/cdqa-suite/cdQA/blob/sync-huggingface/examples/tutorial-train-xlnet-squad.py) |
I had to reduce some parameters ( |
This issue is being discussed here: huggingface/transformers#947 (comment) |
.bin
file instead of pickling class object, ensuring compatibility with HF and avoiding confusionverbose
parameterQAPipeline()
log_prob
(softmax probs) by the raw logits to select best answer among paragrahscdQA/cdqa/reader/utils_squad.py
Lines 873 to 876 in 993ac5e
cdQA
pipelinecdQA-annotator
andcdQA-ui
to supportno answer