Skip to content
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

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

Closed
1 task done
alilafzi opened this issue Mar 7, 2024 · 7 comments · Fixed by #14206 or #14211
Closed
1 task done
Assignees
Labels

Comments

@alilafzi
Copy link

alilafzi commented Mar 7, 2024

Is there an existing issue for this?

  • I have searched the existing issues and did not find a match.

Who can help?

No response

What are you working on?

I am working on the T5 Question Generation model (https://sparknlp.org/2022/07/05/t5_question_generation_small_en_3_0.html).

Current Behavior

When I try to load the model, I get the following error:

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

Expected Behavior

I am able to load T5 on a system with Spark 3.3.1 and SparkNLP 4.4.2 without any problem, but on my current system with Spark 3.5.0 and SparkNLP 5.2.2, I am facing the above issue.

Steps To Reproduce

from sparknlp.annotator import T5Transformer
T5_qg = T5Transformer.load(model)
Where model is the path to a file I already downloaded from the aforementioned link and am now trying to load from the disk.

Spark NLP version and Apache Spark

sparknlp_ver="5.2.2"
spark_version="3.5.0"

Type of Spark Application

spark-submit

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

@DevinTDHa
Copy link
Member

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.

@maziyarpanahi
Copy link
Member

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

@alilafzi
Copy link
Author

alilafzi commented Mar 11, 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

@maziyarpanahi
Copy link
Member

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)

@alilafzi
Copy link
Author

alilafzi commented Mar 13, 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.

@DevinTDHa
Copy link
Member

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!

@alilafzi
Copy link
Author

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

@maziyarpanahi maziyarpanahi linked a pull request Mar 20, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
3 participants