yeandy commented on code in PR #21795:
URL: https://github.com/apache/beam/pull/21795#discussion_r894767368


##########
sdks/python/apache_beam/ml/inference/sklearn_inference.py:
##########
@@ -41,36 +40,20 @@ class ModelFileType(enum.Enum):
   JOBLIB = 2
 
 
-class SklearnInferenceRunner(InferenceRunner[numpy.ndarray,
-                                             PredictionResult,
-                                             BaseEstimator]):
-  def run_inference(
-      self, batch: List[numpy.ndarray], model: BaseEstimator,
-      **kwargs) -> Iterable[PredictionResult]:
-    # vectorize data for better performance
-    vectorized_batch = numpy.stack(batch, axis=0)
-    predictions = model.predict(vectorized_batch)
-    return [PredictionResult(x, y) for x, y in zip(batch, predictions)]
-
-  def get_num_bytes(self, batch: List[numpy.ndarray]) -> int:
-    """Returns the number of bytes of data for a batch."""
-    return sum(sys.getsizeof(element) for element in batch)
-
-
-class SklearnModelLoader(ModelLoader[numpy.ndarray,
-                                     PredictionResult,
-                                     BaseEstimator]):
-  """ Implementation of the ModelLoader interface for scikit learn.
+class SklearnModelHandler(ModelHandler[numpy.ndarray,
+                                       PredictionResult,
+                                       BaseEstimator]):
+  """ Implementation of the ModelHandler interface for scikit learn.

Review Comment:
   nit
   ```suggestion
     """ Implementation of the ModelHandler interface for scikit-learn.
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to