Comments (7)
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.
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.
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:
- Local setup with 1 Master and 2 Worker node,
- Databricks cluster with 2 workers
I also tried building the session with SparkSession.builder, spark-submitt
ing the script and a Scala jar. All execute without problems with Spark NLP 5.2.2 and Spark 3.5.0.
from spark-nlp.
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.
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.
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.
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)
- Scala 2.13 support HOT 1
- org.apache.spark.SparkException: [FAILED_EXECUTE_UDF] HOT 3
- DependencyParserApproach throws "IllegalArgumentException: For input string: "_"" when training with CONLLU dataset HOT 5
- When Attempting to loadSavedModel, I Encountered 'java.lang.Exception: Could Not Retrieve the SavedModelBundle + () HOT 16
- Importing models into Spark NLP in TensorFlow and ONNX formats
- MultiClassifierDLApproach not transforming every row of my dataset HOT 1
- An error occurred while calling z:com.johnsnowlabs.nlp.pretrained.PythonResourceDownloader.downloadModel. : java.lang.UnsatisfiedLinkError: no jnitensorflow in java.library.path: /Users/alexc./Library/Java/Extensions:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java:. HOT 1
- KMeans throws “Column features must be of type equal to one of the following types” HOT 1
- Cache mechanism is not working related to metadata.json in s3 HOT 3
- XLMRoberta embeddings not differentiating between different sentences
- It seems the model is downloaded every time the program starts - any way to cache? HOT 1
- NerDLModel don't load a pretrained NerDLAproach HOT 2
- BartTransformer - Import to SparkNLP HOT 1
- Can not find the model to download bge-m3 HOT 1
- java.util.NoSuchElementException: Param doSample does not exist
- It's too slow to download a model HOT 1
- allow configurable M2Resolvers HOT 2
- A fatal error has been detected by the Java Runtime Environment when I load model from hdfs HOT 8
- org.tensorflow.exceptions.TFInvalidArgumentException: indices[0,11] = 28937 is not in [0, 21128) HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from spark-nlp.