JohnSnowLabs / spark-nlp

State of the Art Natural Language Processing
https://sparknlp.org/
Apache License 2.0
3.77k stars 705 forks source link

NerDLModel don't load a pretrained NerDLAproach #14237

Closed Arierref46 closed 3 months ago

Arierref46 commented 3 months ago

Is there an existing issue for this?

Who can help?

No response

What are you working on?

I amd developing a pipeline to do NER in custom data.

Current Behavior

When loading a pretrained NerDLModel, it shows a error Py4JJavaError: An error occurred while calling o152.load. : java.lang.ClassCastException: com.johnsnowlabs.nlp.annotators.ner.dl.NerDLApproach cannot be cast to com.johnsnowlabs.nlp.annotators.ner.dl.NerDLModel at com.johnsnowlabs.nlp.ParamsAndFeaturesReadable.$anonfun$onRead$1(ParamsAndFeaturesReadable.scala:50)

Expected Behavior

It should load the model normally.

Steps To Reproduce

https://colab.research.google.com/drive/1vwkMo6MGPBMGpERLOVtjrJv4dAd0edjq?usp=sharing

Spark NLP version and Apache Spark

spark 3.3.1 spark-nlp 5.3.2

Type of Spark Application

No response

Java Version

openjdk version "1.8.0_402"

Java Home Directory

No response

Setup and installation

No response

Operating System and Version

windows 11

Link to your project (if available)

No response

Additional Information

No response

maziyarpanahi commented 3 months ago

Hi,

Could you please make that notebook public?

com.johnsnowlabs.nlp.annotators.ner.dl.NerDLApproach cannot be cast to com.johnsnowlabs.nlp.annotators.ner.dl.NerDLModel

You must not be saving the correct trained annotator. Should be a small fix in your code when we see it.

Arierref46 commented 3 months ago

Sorry, it is now public