-
Notifications
You must be signed in to change notification settings - Fork 717
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
812 implement de berta for zero shot classification annotator #14151
812 implement de berta for zero shot classification annotator #14151
Conversation
@DevinTDHa Could you please have a look and see why the predictions are different from HuggingFace? |
Hi @maziyarpanahi @ahmedlone127, I encountered this issue before and propose a solution: Underlying CauseI believe the issue could be part of the following. Note that this might be specific to implementations that I looked at, namely RoBertaForQA and MPNetForQA. It might differ for different models.
FixI fixed these issues for RobertaForQA and the upcoming MPNetForQA by overriding the base functions in the specific implementation file (RobertaClassification.scala and MPNetForClassification.scala). They are included in the respective PR: #14147 I chose not to fix the So going forward, I'd suggest looking at my implementation and checking if the scores are better than before. The implementation is here: spark-nlp/src/main/scala/com/johnsnowlabs/ml/ai/MPNetClassification.scala Lines 429 to 477 in a2d08d6
Just as a note, the tolerance for the scores of my implementation are not that low (0.01 float tolerance). Close enough I suppose but I believe there might be some numerical issues for the implementation in general. It can be tested like so: Line 103 in a2d08d6
|
|
Thanks for the detailed explanation @DevinTDHa ! I will implement these steps and get back to you @maziyarpanahi |
Hello @maziyarpanahi , I took another look at the source code and found that by changing the offset value for the tokenizations (from 1 to 0 ) the predictions from the model became a lot more accurate. |
…taForZeroShotClassification-annotator
Pull Request Test Coverage Report for Build 7799480957Warning: This coverage report may be inaccurate.We've detected an issue with your CI configuration that might affect the accuracy of this pull request's coverage report.
💛 - Coveralls |
…date * fixed all sbt warnings * remove file system url prefix (#14132) * SPARKNLP-942: MPNet Classifiers (#14147) * SPARKNLP-942: MPNetForSequenceClassification * SPARKNLP-942: MPNetForQuestionAnswering * SPARKNLP-942: MPNet Classifiers Documentation * Restore RobertaforQA bugfix * adding import notebook + changing default model + adding onnx support (#14158) * Sparknlp 876: Introducing LLAMA2 (#14148) * introducing LLAMA2 * Added option to read model from model path to onnx wrapper * Added option to read model from model path to onnx wrapper * updated text description * LLAMA2 python API * added method to save onnx_data * added position ids * - updated Generate.scala to accept onnx tensors - added beam search support for LLAMA2 * updated max input length * updated python default params changed test to slow test * fixed serialization bug * Doc sim rank as retriever (#14149) * Added retrieval interface to the doc sim rank approach * Added Python interface as retriever in doc sim ranker --------- Co-authored-by: Stefano Lori <s.lori@izicap.com> * 812 implement de berta for zero shot classification annotator (#14151) * adding code * adding notebook for import --------- Co-authored-by: Maziyar Panahi <maziyar.panahi@iscpif.fr> * Add notebook for fine tuning sbert (#14152) * [SPARKNLP-986] Fixing optional input col validations (#14153) * [SPARKNLP-984] Fixing Deberta notebooks URIs (#14154) * SparkNLP 933: Introducing M2M100 : multilingual translation model (#14155) * introducing LLAMA2 * Added option to read model from model path to onnx wrapper * Added option to read model from model path to onnx wrapper * updated text description * LLAMA2 python API * added method to save onnx_data * added position ids * - updated Generate.scala to accept onnx tensors - added beam search support for LLAMA2 * updated max input length * updated python default params changed test to slow test * fixed serialization bug * Added Scala code for M2M100 * Documentation for scala code * Python API for M2M100 * added more tests for scala * added tests for python * added pretrained * rewording * fixed serialization bug * fixed serialization bug --------- Co-authored-by: Maziyar Panahi <maziyar.panahi@iscpif.fr> * SPARKNLP-985: Add flexible naming for onnx_data (#14165) Some annotators might have different naming schemes for their files. Added a parameter to control this. * Add LLAMA2Transformer and M2M100Transformer to annotator * Add LLAMA2Transformer and M2M100Transformer to ResourceDownloader * bump version to 5.3.0 [skip test] * SPARKNLP-999: Fix remote model loading for some onnx models * used filesystem to check for the onnx_data file (#14169) * [SPARKNLP-940] Adding changes to correctly copy cluster index storage… (#14167) * [SPARKNLP-940] Adding changes to correctly copy cluster index storage when defined * [SPARKNLP-940] Moving local mode control to its right place * [SPARKNLP-940] Refactoring sentToCLuster method * [SPARKNLP-988] Updating EntityRuler documentation (#14168) * [SPARKNLP-940] Adding changes to support storage temp directory (cluster_tmp_dir) * SPARKNLP-1000: Disable init_all_tables for GPT2 (#14177) Fixes `java.lang.IllegalArgumentException: No Operation named [init_all_tables] in the Graph` when model needs to be deserialized. The deserialization is skipped when the modelis already loaded (so it will only appear on the worker nodes and not the driver) GPT2 does not contain tables and so does not require this command. * fixes python documentation (#14172) * revert MarianTransformer.scala * revert HasBatchedAnnotate.scala * revert Preprocessor.scala * Revert ViTClassifier.scala * disable hard exception * Replace hard exception with soft logs (#14179) This reverts commit eb91fde. * move the example from root to examples/ [skip test] * Cleanup some code [skip test] * Update onnxruntime to 1.17.0 [skip test] * Fix M2M100 default model's name [skip test] * Update docs [run doc] * Update Scala and Python APIs --------- Co-authored-by: ahmedlone127 <ahmedlone127@gmail.com> Co-authored-by: Jiamao Zheng <jiamaozheng@users.noreply.github.com> Co-authored-by: Devin Ha <33089471+DevinTDHa@users.noreply.github.com> Co-authored-by: Prabod Rathnayaka <prabod@rathnayaka.me> Co-authored-by: Stefano Lori <wolliq@users.noreply.github.com> Co-authored-by: Stefano Lori <s.lori@izicap.com> Co-authored-by: Danilo Burbano <37355249+danilojsl@users.noreply.github.com> Co-authored-by: Devin Ha <t.ha@tu-berlin.de> Co-authored-by: Danilo Burbano <danilo@johnsnowlabs.com> Co-authored-by: github-actions <action@github.com>
adding DeBertaForZeroShotClassification ( note needs to be reviewed to see why predictions( Very different from huggingface predictions and largely incorrect ) are not being made correctly , same as BartForZeroShotClassifications