question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Could not initialize class com.johnsnowlabs.util.ConfigHelper$

See original GitHub issue

Receiving an error when trying to load pretrained model from hdfs.

Description

In HDFS, loaded offline pre trained model file(s). Apply or use it in code e.g. bert = BertEmbeddings.load(<path>) throws an error “Could not initialize class com.JohnSnowLabs.util. ConfigHelper”

Expected Behavior

It should load pre trained model from the uncompressed file in HDFS.

Current Behavior

Receiving an error message: Py4JJavaError: An error occurred while calling None.com.johnsnowlabs.nlp.embeddings.BertEmbeddings. : java.lang.NoClassDefFoundError: Could not initialize class com.johnsnowlabs.util.ConfigHelper$

Possible Solution

Reference to the offline model might be wrong OR something needs to be updated in Config.

Steps to Reproduce

  1. Import all spark NLP libs from sparknlp.base import * from sparknlp.annotator import *
    from sparknlp.common import * import sparknlp
  2. Sparknlp.start() spark = sparknlp.start()
  3. document_assembler = DocumentAssembler()
    .setInputCol(“text”)
    .setOutputCol(“document”)
  4. Load the pretrained model from hdfs path. bert = BertEmbeddings.load(“/user/xxx/bert_base_cased_en_2.4.0_2.4_1580579557778”)
    .setInputCols([“document”])
    .setOutputCol(“bert”)
    .setCaseSensitive(False)
    .setPoolingLayer(0)

Context

Trying to apply ClassifierDL - word embedding and sentence Embeddings (USE). classiferDL is new for me, fixing this issue will enable it’s use for many different applications.

Your Environment

  • Spark NLP version sparknlp.version(): 2.4.5
  • Apache NLP version spark.version: 2.3.2.3.1.0.0-78
  • Java version java -version: openjdk version “1.8.0_282”, OpenJDK Runtime Environment (build 1.8.0_282-b08), OpenJDK 64-Bit Server VM (build 25.282-b08, mixed mode)
  • Setup and installation (Pypi, Conda, Maven, etc.): Pyspark
  • Operating System and version: Hadoop Cluster
  • Link to your project (if any):

Thank you for the help.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:22 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
beginneruser2021commented, Jul 16, 2021

@maziyarpanahi , truly appreciate your help with this. Thank you again. I will follow the steps you mentioned and will get back to you soon. Thank you.

1reaction
beginneruser2021commented, Jul 16, 2021

Thank you very much, @maziyarpanahi Getting the answers…in few minutes.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to load SparkNLP offline model in python - Stack Overflow
i am not able to find any python example. I am passing token as the inputcol for lemmatization and lemma as the outputcol....
Read more >
com.johnsnowlabs.util.ConfigHelper
Spark NLP 4.2.2 ScalaDoc - com.johnsnowlabs.util.ConfigHelper.
Read more >
org.apache.hadoop.fs.FileSystem Scala Example
Utils private[streaming] class DStreamCheckpointData[T: ... getOrElse { sys.error(s"Cannot read $path for schema; file contains no records") } record.
Read more >
Download spark-nlp_2.11 JAR 1.5.1 With all dependencies!
These are the files of the artifact spark-nlp_2.11 version 1.5.1 from the group com.johnsnowlabs.nlp. ... Dependencies scala-library, config, ...
Read more >
List of scanned packages - SourceCode.AI
... camxes can can-decoder can-filler can-isotp can-you-guess can4python cana ... class-registry class-serializer class-tools class-tree class-utils ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found