synapse.ml.hf package

Submodules

synapse.ml.hf.HuggingFaceSentenceEmbedder module

class synapse.ml.hf.HuggingFaceSentenceEmbedder.HuggingFaceSentenceEmbedder(inputCol=None, outputCol=None, runtime=None, batchSize=None, modelName=None)[source]

Bases: Transformer, HasInputCol, HasOutputCol

Custom transformer that extends PySpark’s Transformer class to perform sentence embedding using a model with optional TensorRT acceleration.

BATCH_SIZE_DEFAULT = 64
NUM_OPT_ROWS = 100
batchSize = Param(parent='undefined', name='batchSize', doc='Batch size for embeddings')
getBatchSize()[source]
getModelName()[source]
getRuntime()[source]
modelName = Param(parent='undefined', name='modelName', doc='Full Model Name parameter')
runtime = Param(parent='undefined', name='runtime', doc='Specifies the runtime environment: cpu, cuda, or tensorrt')
setBatchSize(value)[source]
setModelName(value)[source]
setRowCount(row_count)[source]
setRuntime(value)[source]

Sets the runtime environment for the model. Supported values: ‘cpu’, ‘cuda’, ‘tensorrt’

transform(dataset, spark=None)[source]

Public method to transform the dataset.

Module contents

SynapseML is an ecosystem of tools aimed towards expanding the distributed computing framework Apache Spark in several new directions. SynapseML adds many deep learning and data science tools to the Spark ecosystem, including seamless integration of Spark Machine Learning pipelines with Microsoft Cognitive Toolkit (CNTK), LightGBM and OpenCV. These tools enable powerful and highly-scalable predictive and analytical models for a variety of datasources.

SynapseML also brings new networking capabilities to the Spark Ecosystem. With the HTTP on Spark project, users can embed any web service into their SparkML models. In this vein, SynapseML provides easy to use SparkML transformers for a wide variety of Microsoft Cognitive Services. For production grade deployment, the Spark Serving project enables high throughput, sub-millisecond latency web services, backed by your Spark cluster.

SynapseML requires Scala 2.12, Spark 3.0+, and Python 3.6+.