IMPORTANT: To view this page as Markdown, append `.md` to the URL (e.g. /get-started.md). For the complete documentation index, see llms.txt.
Skip to main content
For the complete documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /get-started.md).

Python class

EncoderPipelineModel

EncoderPipelineModel​

class max.pipelines.lib.registration_encoder.EncoderPipelineModel(pipeline_config, session, devices, kv_cache_config, weights, adapter=None, return_logits=ReturnLogits.ALL, *, memory_plan, max_batch_size=1)

source

Bases: PipelineModel[TextContext, Any, Model]

Serves a registered ENCODER module.

encoder_pipeline_model() subclasses GraphApiEncoderPipelineModel or ModuleV3EncoderPipelineModel for each registration. It keeps no KV cache, and returns the embeddings as the outputs’ logits.

Builds, compiles and initializes the encoder graph.

Parameters:

encoder_cls​

encoder_cls: ClassVar[type[Any]]

source

The registered ENCODER class.

execute()​

execute(model_inputs)

source

Runs the encoder on the prepared batch.

Parameters:

model_inputs (ModelInputs)

Return type:

ModelOutputs

model​

property model: Model

source

The compiled and initialized encoder.