Skip to content

Commit

Permalink
Passing parameters to batched requests from data-flow engine (#374)
Browse files Browse the repository at this point in the history
  • Loading branch information
Sachin Varghese authored Jul 29, 2022
1 parent 4bdcc6d commit 5550c43
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package io.seldon.dataflow.kafka

import io.klogging.noCoLogger
import io.seldon.mlops.inference.v2.V2Dataplane.InferParameter
import io.seldon.mlops.inference.v2.V2Dataplane.InferTensorContents
import io.seldon.mlops.inference.v2.V2Dataplane.ModelInferRequest
import io.seldon.mlops.inference.v2.V2Dataplane.ModelInferRequest.InferInputTensor
Expand Down Expand Up @@ -57,11 +58,13 @@ class BatchProcessor(private val threshold: Int) : Transformer<String, ModelInfe
val batchSize = v.sumOf { it.getShape(0) }
val dataShape = v.first().shapeList.drop(1)
val shape = mutableListOf(batchSize) + dataShape

val parameters = mutableMapOf<String, InferParameter>()
v.map { it.parametersMap }.forEach {parameters.putAll(it)}
InferInputTensor
.newBuilder()
.setName(k)
.addAllShape(shape)
.putAllParameters(parameters)
.setContents(
InferTensorContents
.newBuilder()
Expand All @@ -84,6 +87,7 @@ class BatchProcessor(private val threshold: Int) : Transformer<String, ModelInfe
.setId(batchReferenceRequest.id)
.setModelName(batchReferenceRequest.modelName)
.setModelVersion(batchReferenceRequest.modelVersion)
.putAllParameters(batchReferenceRequest.parametersMap)
.addAllInputs(tensorNames.values)
.build()
}
Expand Down

0 comments on commit 5550c43

Please sign in to comment.