4.2.1.5.2 Verify the Installation of OML4Py Slim Client

Verify the installation of the OML4Py slim client.

To verify that the OML4Py slim client is installed correctly, you can test its key features—such as loading ONNX model conversion utilities.

The following example demonstrates how to load ONNX model conversion methods from oml.utils, configure a pipeline, and export models as ONNX files:

from oml.utils import ONNXPipeline, ONNXPipelineConfig, MiningFunction

# Initialize the pipeline with a pre-trained model
em = ONNXPipeline(model_name="sentence-transformers/all-MiniLM-L6-v2")
em.export2file("your_preconfig_file_name", output_dir="my_dir")

# Configure the pipeline using a template and export a different model
config = ONNXPipelineConfig.from_template("text", max_seq_length=512)
em = ONNXPipeline(model_name="intfloat/e5-small-v2", config=config)
em.export2file("your_template_file_name", output_dir="my_dir")

If you are able to run the code successfully, your OML4Py slim client installation is verified for ONNX model conversion.