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

Fixing onnx saving path bug #13959

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions src/main/scala/com/johnsnowlabs/ml/onnx/OnnxWrapper.scala
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,12 @@ class OnnxWrapper(var onnxModel: Array[Byte]) extends Serializable {
.toString

// 2. Save onnx model
val onnxFile = Paths.get(tmpFolder, file).toString
maziyarpanahi marked this conversation as resolved.
Show resolved Hide resolved
FileUtils.writeByteArrayToFile(new File(onnxFile), onnxModel)
val fileName = Paths.get(file).getFileName.toString
val onnxFile = Paths
.get(tmpFolder, fileName)
.toString

FileUtils.writeByteArrayToFile(new File(onnxFile), onnxModel)
// 4. Zip folder
if (zip) ZipArchiveUtil.zip(tmpFolder, file)

Expand Down Expand Up @@ -163,5 +166,4 @@ object OnnxWrapper {
encoder: OnnxWrapper,
decoder: OnnxWrapper,
decoderWithPast: OnnxWrapper)

}
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class WhisperForCTCTest extends AnyFlatSpec with WhisperForCTCBehaviors {

// Needs to be added manually
lazy val modelTf: WhisperForCTC = WhisperForCTC
.pretrained("asr_whisper_tiny")
.pretrained("asr_whisper_tiny", "xx")
.setInputCols("audio_assembler")
.setOutputCol("document")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ package com.johnsnowlabs.nlp.embeddings

import com.johnsnowlabs.nlp.base.DocumentAssembler
import com.johnsnowlabs.nlp.util.io.ResourceHelper
import com.johnsnowlabs.tags.{SlowTest, FastTest}
import com.johnsnowlabs.tags.{SlowTest}
import org.apache.spark.ml.Pipeline
import org.scalatest.flatspec.AnyFlatSpec

Expand Down