Skip to content

setConfigProtoBytes does not work for NerDLModel #14471

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

Closed
1 task done
fxu36 opened this issue Dec 3, 2024 · 1 comment
Closed
1 task done

setConfigProtoBytes does not work for NerDLModel #14471

fxu36 opened this issue Dec 3, 2024 · 1 comment
Assignees

Comments

@fxu36
Copy link

fxu36 commented Dec 3, 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 have an NER mode in lightweight pipeline and try to configure the TensorFlow parameters through setConfigProtoBytes before inference. The SparkNLP version is 5.2.3

Current Behavior

The TensorFlow parameters set by setConfigProtoBytes are not applied to the TensorFlow session because the load function in NerDLModel already created a session with hard coded configuraion

Expected Behavior

The TensorFlow parameters set by setConfigProtoBytes are not applied to the TensorFlow session because the load function in NerDLModel already created a session with hard coded configuration TensorflowWrapper.TFSessionConfi

Steps To Reproduce

// Load the model
val model = NerDLModel.load()
// The os information
val os = ManagementFactory.getOperatingSystemMXBean()
val cpu = os.getAvailableProcessors()
// ConfigProto
val config = ConfigProto.newBuilder()
.putDeviceCount("GPU", 0)
.putDeviceCount("CPU", cpu)
.setInterOpParallelismThreads(cpu)
.setIntraOpParallelismThreads(cpu)
.setAllowSoftPlacement(true)
.setIsolateSessionState(true)
.setUsePerSessionThreads(true)
.build()
val ner = model.setInputCols("sentence", "token", "embeddings")
.setOutputCol("ner")
.setBatchSize(cpu * 2)
.setConfigProtoBytes(config.toByteArray.map(_.toInt))

Spark NLP version and Apache Spark

SparkNLP 5.2.3
Spache Apark 3.1.2

Type of Spark Application

Scala Application

Java Version

java version "1.8.0_411"

Java Home Directory

C:\Program Files\Java\jdk-1.8

Setup and installation

sbt

Operating System and Version

Windows 2019

Link to your project (if available)

No response

Additional Information

No response

Copy link

github-actions bot commented Jun 2, 2025

This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 5 days

@github-actions github-actions bot added the Stale label Jun 2, 2025
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Jun 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants