I installed Oracle 23ai using the Windows native installer.
After that I converted a pretrained model using Oml4Py
python
>>> from oml.utils import EmbeddingModelConfig
>>> from oml.utils import EmbeddingModel
>>> em = EmbeddingModel(model_name="sentence-transformers/distiluse-base-multilingual-cased-v2")
>>> em.export2file("distiluse-base-multilingual-cased-v2", output_dir=".")
this resulted in the following output:
/home/dennis/python/lib/python3.12/site-packages/huggingface_hub/file_download.py:1150: FutureWarning: `resume_download` is deprecated and will be removed in version 1.0.0. Downloads always resume when possible. If you want to force a new download, use `force_download=True`.
warnings.warn(
tokenizer_config.json: 100%|███████████████████| 531/531 [00:00<00:00, 2.97MB/s]
config.json: 100%|█████████████████████████████| 610/610 [00:00<00:00, 4.93MB/s]
vocab.txt: 100%|█████████████████████████████| 996k/996k [00:00<00:00, 2.61MB/s]
special_tokens_map.json: 100%|█████████████████| 112/112 [00:00<00:00, 1.36MB/s]
tokenizer.json: 100%|██████████████████████| 1.96M/1.96M [00:00<00:00, 4.11MB/s]
model.safetensors: 100%|█████████████████████| 539M/539M [00:23<00:00, 23.2MB/s]
/home/dennis/python/lib/python3.12/site-packages/transformers/models/distilbert/modeling_distilbert.py:246: TracerWarning: torch.tensor results are registered as constants in the trace. You can safely ignore this warning if you use this function to create tensors out of constant variables that would be the same every time you call this function. In any other case, this might cause the trace to be incorrect.
mask, torch.tensor(torch.finfo(scores.dtype).min)
I copied the “distiluse-base-multilingual-cased-v2.onnx” file to the windows machine with Oracle 23ai Free installed and put it into this folder: C:\dbfree\DM_DUMP
I ran the following as sys user on the pluggable database:
GRANT DB_DEVELOPER_ROLE, CREATE MINING MODEL TO dennis;
CREATE OR REPLACE DIRECTORY DM_DUMP AS 'C:\dbfree\DM_DUMP';
GRANT READ ON DIRECTORY DM_DUMP TO dennis;
GRANT WRITE ON DIRECTORY DM_DUMP TO dennis;
exit
I then ran the following as dennis user on the pluggable database:
EXECUTE DBMS_VECTOR.LOAD_ONNX_MODEL('DM_DUMP','distiluse-base-multilingual-cased-v2.onnx','doc_multi');
This gives me the following errors:
SQL> EXECUTE DBMS_VECTOR.LOAD_ONNX_MODEL('DM_DUMP','distiluse-base-multilingual-cased-v2.onnx','doc_multi');
BEGIN DBMS_VECTOR.LOAD_ONNX_MODEL('DM_DUMP','distiluse-base-multilingual-cased-v2.onnx','doc_multi'); END;
*
ERROR at line 1:
ORA-40216: feature not supported
ORA-06512: at "SYS.DBMS_VECTOR", line 879
ORA-06512: at "SYS.DBMS_DATA_MINING", line 5767
ORA-06512: at "SYS.DBMS_VECTOR", line 874
ORA-06512: at line 1
Help: https://docs.oracle.com/error-help/db/ora-40216/
I then tried to download the “Pre-built embedding Generation model” as per this blog (to test if was something wrong with my converted onnx file):
https://blogs.oracle.com/machinelearning/post/use-our-prebuilt-onnx-model-now-available-for-embedding-generation-in-oracle-database-23ai
Extracted the zip file and copied the “all_MiniLM_L12_v2.onnx” file to C:\dbfree\DM_DUMP and ran the following as dennis user on the pluggable database:
BEGIN
DBMS_VECTOR.LOAD_ONNX_MODEL(
directory => 'DM_DUMP',
file_name => 'all_MiniLM_L12_v2.onnx',
model_name => 'ALL_MINILM_L12_V2');
END;
/
This, again, gives me the same errors:
SQL> BEGIN
2 DBMS_VECTOR.LOAD_ONNX_MODEL(
3 directory => 'DM_DUMP',
4 file_name => 'all_MiniLM_L12_v2.onnx',
5 model_name => 'ALL_MINILM_L12_V2',
6 metadata => JSON('{"function" : "embedding", "embeddingOutput" : "embedding", "input": {"input": ["DATA"]}}'));
7 END;
8 /
BEGIN
*
ERROR at line 1:
ORA-40216: feature not supported
ORA-06512: at "SYS.DBMS_VECTOR", line 879
ORA-06512: at "SYS.DBMS_DATA_MINING", line 5767
ORA-06512: at "SYS.DBMS_VECTOR", line 874
ORA-06512: at line 2
Help: https://docs.oracle.com/error-help/db/ora-40216/
Question: Is there some dependencies not documented, that needs to be installed on the Windows machine where Oracle 23ai is installed?