• Database Repositories
  • Oracle Machine Learning for Python client package for Oracle AI Database, enabling in-database machine learning, analytics, embedded Python execution, ONNX model conversion, and OML4Py Datastore management from Python.

Breadcrumb

Description

Oracle Machine Learning for Python Client Container =================================================== Oracle Machine Learning for Python, also known as OML4Py, is part of the Oracle Machine Learning product family for Oracle AI Database. OML4Py enables data scientists, analysts, and statisticians to perform machine learning and advanced analytics directly in Oracle AI Database using Python APIs. The OML4Py client provides the Python oml module and supporting client-side packages required to connect to Oracle AI Database and use OML4Py capabilities. It supports database-centric analytical workflows that minimize data movement while taking advantage of Oracle AI Database performance, scalability, security, backup, and recovery capabilities. OML4Py supports Oracle AI Database 26ai, with features including: • Transparent access to database-resident data from Python • In-database machine learning algorithms • Embedded Python execution in Oracle AI Database • Python object and script management using OML4Py Datastore and script repository • ONNX model conversion for use with in-database ONNX Runtime, including support for models larger than 2 GB using ONNX external initializer support with memory-sharing capabilities in Oracle AI Database 23.10 • Datastore import and export support for migrating OML4Py objects across database instances This release 2.1.1 enables users to convert ONNX models larger than 2 GB and migrate OML4Py Datastores between database environments, such as development and production instances, using Python APIs including oml.export_ds and oml.import_ds. Installation Instructions ========================= Prerequisites ------------- The OML4Py 2.1.1 client container runs on Oracle Linux 8, 9, and 10 (x86_64) and includes Python 3.13.5 along with a preconfigured set of supporting packages including pandas, NumPy, Scikit-Learn, PyTorch, ONNX Runtime, and Transformers. It is designed to work with OML4Py on both Oracle AI Database 26ai (on-premises and in the cloud) and Oracle Autonomous AI Database 26ai. A free Oracle account is required to pull the container image from the Oracle Container Registry (OCR). If your host does not have internet access, see the air-gapped installation option in Step 2. Rootless Podman Prerequisites ----------------------------- Rootless Podman requires /etc/subuid and /etc/subgid files to map user IDs inside a container to unprivileged IDs on the host, ensuring security and isolation. These files must define a range of IDs (usually at least 65,536) for users on the host to create user namespaces without root privileges. • **Configuration:** Each user must have a unique range in /etc/subuid and /etc/subgid (e.g., user:100000:65536). • **Setting up:** Use `sudo usermod --add-subuids 100000-165535 --add-subgids 100000-165535 $USER` to configure these files if they are not already set. • **Apply Changes:** Run `podman system migrate` after updating the files to apply the new mappings. • **Verification:** Run `grep $USER /etc/subuid` to confirm entries exist. Step 1: Install Podman ---------------------- Verify Podman is installed: ``` podman version ``` If not installed: On Linux 8 ``` sudo dnf module install -y container-tools:ol8 ``` On Linux 9 or 10 ``` sudo dnf install -y container-tools ``` Step 2: Pull the container image -------------------------------- Sign into the Oracle Container Registry using your Oracle SSO credentials, accept the license agreement, and generate an authentication token. Log in via Podman: ``` podman login container-registry.oracle.com ``` Pull the image: ``` podman pull container-registry.oracle.com/database/oml4py-client:2.1.1.0.0 ``` Optionally, if you want to use the container in an air-gapped host that lacks internet access, save the image on a connected machine and transfer it: ``` podman save -o oml4py-client_2.1.1.0.0.tar container-registry.oracle.com/database/oml4py-client:2.1.1.0.0 ``` Then load it on the air-gapped host: ``` podman load -i oml4py-client_2.1.1.0.0.tar ``` Step 3: Launch the container ---------------------------- Without a wallet: ``` podman run -it --name container-registry.oracle.com/database/oml4py-client:2.1.1.0.0 ``` **Note:** Use */u01/oml_home* for any files you need to write inside the container (such as exported models or output files). This is the designated writable directory within the container environment. With a wallet located at /home/opc/wallet on the host, first update *sqlnet.ora*, then launch: ``` sed -i.bak 's|?/network/admin|/u01/oml_home/wallet|g' /home/opc/wallet/sqlnet.ora podman run -it --name -v /home/opc/wallet:/u01/oml_home/wallet:U,Z -e TNS_ADMIN=/u01/oml_home/wallet container-registry.oracle.com/database/oml4py-client:2.1.1.0.0 ``` Step 4: Convert and either load the model to the database or export the model to container file system ------------------------------------------------------------------------ Inside the container, start Python and convert your model: ``` import oml from oml.utils import ONNXPipeline, ONNXPipelineConfig pipeline = ONNXPipeline(model_name="sentence-transformers/all-MiniLM-L6-v2") ``` Export model directly to the database: Use username/password to connect database instance ``` oml.connect(user="", password="", dsn="") pipeline.export2db("YOUR_MODEL_NAME") ``` Or connect database instance by wallet ``` oml.connect(user="", password="", dsn="") pipeline.export2db("YOUR_MODEL_NAME") ``` Alternatively, export to a file in the container. The output is a single .onnx file, or a zip archive if the model uses external data (models over 1 GB automatically, or smaller models configured with use_external_data = True): ``` pipeline.export2file("YOUR_MODEL_NAME") ``` If you exported the model to a file, load it into the database with DBMS_VECTOR.LOAD_ONNX_MODEL. First move the .onnx file to a location the database server can read. Then, as a DBA, create a directory object, grant your OML user access, and load the model: CREATE DIRECTORY ONNX_IMPORT AS '/path/to/models'; GRANT READ ON DIRECTORY ONNX_IMPORT TO YOUR_USER; GRANT CREATE MINING MODEL TO YOUR_USER; BEGIN DBMS_VECTOR.LOAD_ONNX_MODEL( directory => 'ONNX_IMPORT', file_name => 'YOUR_MODEL_NAME.onnx', model_name => 'YOUR_MODEL_NAME'); END; / Step 5: Copy the model to the host ---------------------------------- ``` podman cp : ``` Key Benefits ============ OML4Py helps users: • Run Python functions on database-resident data • Use Oracle AI Database as a high-performance computing environment for Python workloads • Reduce or eliminate unnecessary data movement • Perform scalable exploratory data analysis on large data sets • Build and use predictive analytics and machine learning models, including auto-ML • Operationalize Python scripts and user-defined Python functions in production applications • Use Python packages from the open source ecosystem • Manage Python objects and scripts in the database • Leverage Oracle AI Database backup, recovery, security, and resource management capabilities Support Links and Information ============================= For support, use the standard Oracle Support channels associated with Oracle AI Database and Oracle Machine Learning. Recommended support information to include: **Product:** Oracle Machine Learning for Python **Component:** OML4Py Client **Supported Oracle Database versions:** Oracle Database 26ai **Client Python requirement:** Python 3.13 **Support channel:** My Oracle Support **Support link:** https://support.oracle.com/ **Container registry:** Oracle Container Registry **Repository category:** Database Documentation Links =================== Include the following documentation links: **Oracle Machine Learning Documentation** https://docs.oracle.com/en/database/oracle/machine-learning/ **Oracle Machine Learning User’s Guide for Python** https://docs.oracle.com/en/database/oracle/machine-learning/oml4py/ **Oracle AI Database Documentation** https://docs.oracle.com/en/database/ **My Oracle Support** https://support.oracle.com/

Short URL for Repo

https://container-registry.oracle.com/ords/ocr/ba/database/oml4py-client

License Agreement (Not Logged In)

Please sign in using your Oracle Account to accept the license agreement for the Oracle container you have selected.

Tags

TagOS/ArchitectureSizePull CommandLast UpdatedImage ID
2.1.1.0.0linux/amd642.9 GBdocker pull container-registry.oracle.com/database/oml4py-client:2.1.1.0.05 weeks ago03f866a6cb75