I'm trying to use the ESG model from johnsnowlabs according to this
I have the following code:
import sparknlpfrom johnsnowlabs import nlp, financespark = sparknlp.start()sparknlp.version(), spark.versionsequenceClassifier = finance.BertForSequenceClassification.pretrained("finclf_augmented_esg", "en", "finance/models").setInputCols(["document",'token']).setOutputCol("class")
On the last line of the given code, I get the following error:
AttributeError: module 'johnsnowlabs.finance' has no attribute 'BertForSequenceClassification'
I have been searching the internet for a while now and haven't found any solution that helped me to solve this problem.
I'm using Databricks with the following cluster:
- Runtime: 14.2 ML (includes Apache Spark 3.5.0, Scala 2.12)
- Worker & Driver type: Standard_DS3_v2 14 GB Memory, 4 Cores
Added libraries to the cluster are according to here:
- PyPi: spark-nlp
- Maven: com.johnsnowlabs.nlp:spark-nlp_2.12:5.2.2
Spark NLP Version: 5.2.2
Spark Version: 3.5.0
"Fix" in order to get other error
If I use the following:
from sparknlp.base import *from sparknlp.annotator import *
and then
sequenceClassifier = BertForSequenceClassification.pretrained("finclf_augmented_esg", "en", "finance/models").setInputCols(["document",'token']).setOutputCol("class")
I get the following error:
finclf_augmented_esg download started this may take some time.com.amazonaws.services.s3.model.AmazonS3Exception: Access Denied (Service: Amazon S3; Status Code: 403; Error Code: AccessDenied; Request ID: QPXGHC9NC091CGM7; S3 Extended Request ID: HJ7dgcIfpGdE4bQANraV01XpA5ZKUgMPXIkcudZaDxmo9mu4k/lbdbHO5fjjeHI7DqFxLgNHbmA=; Proxy: null), S3 Extended Request ID: HJ7dgcIfpGdE4bQANraV01XpA5ZKUgMPXIkcudZaDxmo9mu4k/lbdbHO5fjjeHI7DqFxLgNHbmA=