This article shows how to use an Object Table with a MaxCompute AI Function to call a remote model for speech content extraction. After an upstream system stores unstructured data in a specified Object Storage Service (OSS) directory, MaxCompute maps the files by creating an Object Table. This feature supports both full and incremental metadata extraction to retrieve file metadata. This approach eliminates data migration from OSS to MaxCompute and uses metadata to improve the MaxCompute SQL engine's performance in data reads, file filtering, and distributed computing. You can then use the SQL engine with an AI Function to call a multimodal model that reads data from the Object Table to process and analyze unstructured data.
Prerequisites
Activate MaxCompute and Create a MaxCompute project. Skip if already done.
PAI-EAS (Elastic Algorithm Service) is activated. Skip if already done.
OSS is activated. Skip if already done.
Step 1: Create an OSS bucket and upload data
Log in to the OSS console.
Create a bucket named
ot-demoin OSS. For more information, see Quick start for the OSS console.In the new bucket, create a directory named
/object_table/voice_demo/and upload the audio data from voice_demo.zip.
Step 2: Create and deploy a PAI EAS model service
Log on to the PAI console, select a region in the upper-left corner, and create a workspace.
Go to the workspace details page, click Model Gallery on the left, select
Qwen2.5-Omni-3B, and click Deploy.Select an instance type with an L20 GPU (48 GB VRAM) and click Deploy. Check the deployment status in Task Management. The status shows Running when deployment completes.
In the left-side navigation pane, click Model Deployment to open EAS. Locate the deployed service, click View Call Information, and note the endpoint and token.
-- The following information is required for creating the remote model in Step 3. Model name (subject to the actual EAS service name):quickstart_deploy_*****_apdf Endpoint (VPC address):http://*****.cn-beijing.pai-eas.aliyuncs.com (use only the part before aliyuncs.com) apikey(Token):****************************************==
Step 3: Create an Object Table
Create an Object Table and view its metadata.
SET odps.sql.type.system.odps2=true;
SET odps.namespace.schema=true; -- Enable the tenant-level schema syntax.
CREATE OBJECT TABLE IF NOT EXISTS voice_demo
WITH SERDEPROPERTIES ('odps.properties.rolearn'='acs:ram::<uid>:role/aliyunodpsdefaultrole')
LOCATION 'oss://oss-cn-<region>-internal.aliyuncs.com/object-table/voice_demo/';
ALTER TABLE voice_demo REFRESH METADATA;
-- After you refresh the metadata, you can query the table and find five audio objects.
SET odps.namespace.schema=true;
SELECT COUNT(*) AS ROW_COUNT FROM voice_demo; Step 4: Create a network connection
Log in to the MaxCompute console and select a region in the upper-left corner.
In the left-side navigation pane, choose .
Create a network connection between MaxCompute and the target VPC. The VPC ID can be any VPC, and the vSwitch can be in any zone.
Step 5: Register the Omni multimodal remote model
When defining a model with Binary input, declare input parameters as INPUT(data BINARY, promt STRING).
When using a String URL as input, use the default values without declaring input parameters.
For more information about the syntax and parameters, see CREATE MODEL.
SET odps.namespace.schema=true;
SET odps.session.networklink=<your_vpc_name>;
CREATE MODEL PAI_EAS_Qwen25_Omni_3B WITH VERSION v1
OPTIONS(
MODEL_SOURCE_TYPE = 'REMOTE',
MODEL_TYPE = 'MLLM',
TASKS = 'text-generation',
PAI_EAS_MODEL_NAME = 'Qwen2.5-Omni-3B',
PAI_EAS_SERVICE_NAME = 'quickstart_deploy_*****',
ENDPOINT = 'https://*****.vpc.cn-beijing.pai-eas.aliyuncs.com/',
APIKEY = '*****==',
PAI_EAS_SYNC_MODE = 'true'
)
COMMENT "PAI EAS remote model";Step 6: Process speech data with AI_GENERATE
Use the MaxCompute AI_GENERATE function to extract text from the speech data and translate it into English.
SET odps.namespace.schema=true;
SET odps.mcqa.disable=true;
SET odps.session.networklink=<your_vpc_name>;
SELECT
key,
AI_GENERATE(
PAI_EAS_Qwen25_Omni_3B, v1, audio_url,
"Transcribe the audio content. Output only the transcribed text and no extra information.",
"AUDIO"
) AS voice2text,
AI_GENERATE(
PAI_EAS_Qwen25_Omni_3B, v1, audio_url,
"Translate the audio content into English. Do not output any extra information.",
"AUDIO"
) AS voice2text2english
FROM (
SELECT GET_SIGNED_URL_FROM_OSS(
'<project_name>.<schema>.voice_demo', key, 604800
) AS audio_url, key AS key
FROM <project_name>.<schema>.voice_demo
);