BertEmbeddings Error
geo47 opened this issue · 3 comments
In "3.NER_with_BERT.ipynb"
When i run the following code with setPoolingLayer attribute
bert_annotator = BertEmbeddings.pretrained('bert_base_cased', 'en') \
.setInputCols(["sentence",'token'])\
.setOutputCol("bert")\
.setCaseSensitive(False)\
.setPoolingLayer(0)
it gives me this error:
AttributeError Traceback (most recent call last)
<ipython-input-7-af673ae4eec4> in <module>()
----> 1 bert_annotator = BertEmbeddings.pretrained('bert_base_cased', 'en') .setInputCols(["sentence",'token']) .setOutputCol("bert") .setCaseSensitive(False) .setPoolingLayer(0)
AttributeError: 'BertEmbeddings' object has no attribute 'setPoolingLayer'
without setPoolingLayer attribute it works...
Kindly suggest me the solution, if i am going to utilize the last layer and want to user setPoolingLayer, how should it work.
Thanks
Your Environment
- Spark-NLP version: 2.6.2
- Apache Spark version: 2.4.7
- Operating System and version: Ubuntu 20.04
- Deployment (Docker, Jupyter, Scala, pip, conda, etc.):Jupyter conda
We have deprecated poolingLayer in 2.6.0 release. You need to remove that parameter.
Thanks for your reply @maziyarpanahi
Removing that parameter works fine but I am curious what effects BertEmbedding will have with or without setPoolingLayer parameter, Why it was added and then deprecated from algorithm point of view. Is there any documentation for this parameter.
Thanks...
It is explained in the release notes. We follow the TF Hub style as they no more provide access to the hidden layers. Only the last one.
https://github.com/JohnSnowLabs/spark-nlp/releases/tag/2.6.0