GithubHelp home page GithubHelp logo

Comments (7)

DevinTDHa avatar DevinTDHa commented on May 26, 2024 2

Hi @alilafzi,

I believe I have found the root cause of your issue and how to replicate it.

Spark NLP requires the KryoSerializer to be used as the serializer for Spark. When using sparknlp.start() this is automatically set. As you are manually creating a Spark Session, we need to manually set some configs:

spark = (
    SparkSession.builder.appName("Spark NLP T5")
    .master("spark://spark-master:7077") # change to your address
    .config("spark.driver.memory", "16G")
    .config("spark.serializer", "org.apache.spark.serializer.KryoSerializer")
    .config("spark.kryoserializer.buffer.max", "2000M")
    .config("spark.driver.maxResultSize", "0")
    .config("spark.jars.packages", "com.johnsnowlabs.nlp:spark-nlp_2.12:5.2.2")
    .getOrCreate()
)

Could you try this and see if it works for you?

I have identified, that some of our docs are not consistent (the serializer setting seems to be missing) and will fix this!

from spark-nlp.

alilafzi avatar alilafzi commented on May 26, 2024 2

Adding the KryoSerializer to the config completely resolved the issue. Thank you very much for your help. I greatly appreciate your consideration.

from spark-nlp.

DevinTDHa avatar DevinTDHa commented on May 26, 2024 1

Hi @alilafzi,

Thanks for reporting this.

I'm having trouble reproducing this error. Could you share more information about your setup and the specific steps (for example a script) to reproduce this issue? I tried the following things but haven't encountered any issues:

  1. Local setup with 1 Master and 2 Worker node,
  2. Databricks cluster with 2 workers

I also tried building the session with SparkSession.builder, spark-submitting the script and a Scala jar. All execute without problems with Spark NLP 5.2.2 and Spark 3.5.0.

from spark-nlp.

maziyarpanahi avatar maziyarpanahi commented on May 26, 2024

Since this didn't fail in our test, it could be many reasons regarding your ENV and use case. In this case, we do need the following information, and possibly as much additional information you can provide:

Java Version

No response

Java Home Directory

No response

Setup and installation

No response

Operating System and Version

No response

Link to your project (if available)

No response

Additional Information

No response

from spark-nlp.

alilafzi avatar alilafzi commented on May 26, 2024

Thank you for your responses. I am also using SparkSession.builder, spark-submitting the script and a Scala jar to create the Spark session and run the Python script. The script itself is as simple as below:
from pyspark.sql import SparkSession
from sparknlp.annotator import T5Transformer
spark = SparkSession.builder\
.appName("question_generator")\
.getOrCreate()
spark.sparkContext.setLogLevel("WARN")
T5_qg = T5Transformer.load(<path to t5_question_generation_small_en_4.0.0_3.0_1657032292222>)

Some setup information are:
Spark version 3.5.0
OS info Linux, 6.2.0-1018-aws, amd64
Java version 11.0.22

from spark-nlp.

maziyarpanahi avatar maziyarpanahi commented on May 26, 2024

Since you are using Scala, I can offer this started project: https://github.com/maziyarpanahi/spark-nlp-starter?tab=readme-ov-file#spark-submit

I am also interested to know what would happen if you do T5Transformer.pretrained()? (it is a different model by default, but I am just interested to see if it's the model or the setup)

from spark-nlp.

alilafzi avatar alilafzi commented on May 26, 2024

I am getting the same error after doing T5Transformer.pretrained():

ERROR TorrentBroadcast: Store broadcast broadcast_5 fail, remove all pieces of the broadcast

An error occurred while calling z:com.johnsnowlabs.nlp.pretrained.PythonResourceDownloader.downloadModel.
: java.io.NotSerializableException: com.johnsnowlabs.ml.ai.seq2seq.TensorflowT5EncoderDecoder
Serialization stack:
- object not serializable (class: com.johnsnowlabs.ml.ai.seq2seq.TensorflowT5EncoderDecoder, value: com.johnsnowlabs.ml.ai.seq2seq.TensorflowT5EncoderDecoder@353cfe4f)

Also, I am not sure how the starter project you recommended is applicable to my case because I am using a Python script. I appreciate further clarification. Additionally, the Spark version there is 3.1.1 while mine is 3.5.0.

from spark-nlp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.