java tensorflow and maven version is org.tensorflow:libtensorflow:1.15.0 after session.runner.run() for many times, the memory grow higher and higher then oom
オープン
まだ誰も着手していません。
- 主要言語
- Java
- スター
- 928
- フォーク
- 227
- PR マージ指標
- 30日以内にマージされた PR はありません
説明
my test code with language scala ,this is one predict, we will predict 100 QPS for a docker
val config = ConfigProto.newBuilder
.putDeviceCount("CPU", Runtime.getRuntime.availableProcessors)
.setInterOpParallelismThreads(8)
.setIntraOpParallelismThreads(8)
.setOperationTimeoutInMs(3000)
.build
val options = RunOptions.newBuilder
.setTimeoutInMs(5000)
.build
val modelBundle = SavedModelBundle
.loader(s"$path")
.withTags("serve")
.withConfigProto(config.toByteArray)
.withRunOptions(options.toByteArray)
.load
val kernel = modelBundle.session
val data = Map("tensor1" -> Seq(0.1f,0.122f),……)
val runner = kernel.runner()
val inputTensorList: util.ArrayList[Tensor[java.lang.Float]] = new util.ArrayList[Tensor[java.lang.Float]]()
data.map{
case (tensorName, featureId) => {
val dataInput:FloatBuffer = FloatBuffer.allocate(featureId.size)
featureId.foreach(featureValue => {
dataInput.put(featureValue)
})
dataInput.asInstanceOf[Buffer].flip()
val tensorShape:Array[Long] = Array(1,featureId.size)
val tensor = Tensor.create(tensorShape,dataInput)
runner.feed(tensorName,tensor)
inputTensorList.add(tensor)
}
}
for(i <- 0 until 2 ){
runner.fetch("StatefulPartitionedCall",i)
}
val output = runner.run.asScala
val scores:Array[Float] = output.map(ten => {
val tensorData: Array[Array[Float]] = ten.copyTo(Array.ofDim[Float](ten.shape()(0).toInt, ten.shape()(1).toInt))
tensorData(0).head
}).toArray
inputTensorList.asScala.foreach(_.close())
output.foreach(_.close())
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
まず、SavedModelBundle、session.runner()、runner.run() と、issue に示されている 100-QPS の予測を繰り返すパターンを使って、報告されたワークロードを再現します。メモリを監視しながら、渡された入力テンソルと返された出力テンソルの所有権とクローズを追跡します。完了の条件は、予測を繰り返してもメモリ使用量が増加して OOM に至らなくなることです。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- java, tensorflow
- 領域
- machine-learning
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- 説明が足りない
- 初心者へのやさしさ
- 25/100