|
| 1 | +--- |
| 2 | +name: aqua-cli |
| 3 | +description: Complete CLI reference for the ADS AQUA command-line interface (ads aqua). Covers all model, deployment, evaluation, and fine-tuning commands with full parameter documentation. Triggered when user asks about CLI commands, wants to run AQUA operations from terminal, or needs command syntax. |
| 4 | +user-invocable: true |
| 5 | +disable-model-invocation: false |
| 6 | +--- |
| 7 | + |
| 8 | +# ADS AQUA CLI Reference |
| 9 | + |
| 10 | +The `ads aqua` CLI provides command-line access to all AI Quick Actions operations. It uses Python Fire under the hood. |
| 11 | + |
| 12 | +## Installation |
| 13 | + |
| 14 | +```bash |
| 15 | +pip install oracle-ads[aqua] |
| 16 | +# OR for development |
| 17 | +pip install -e ".[aqua]" |
| 18 | +``` |
| 19 | + |
| 20 | +## Authentication Setup |
| 21 | + |
| 22 | +```bash |
| 23 | +# For OCI Notebook Sessions (Resource Principal) |
| 24 | +# No setup needed - automatic |
| 25 | + |
| 26 | +# For local development with security token |
| 27 | +export OCI_IAM_TYPE="security_token" |
| 28 | +export OCI_CONFIG_PROFILE=<your-profile> |
| 29 | + |
| 30 | +# For local development with API key |
| 31 | +export OCI_IAM_TYPE="api_key" |
| 32 | +export OCI_CONFIG_PROFILE=DEFAULT |
| 33 | +``` |
| 34 | + |
| 35 | +--- |
| 36 | + |
| 37 | +## Model Commands |
| 38 | + |
| 39 | +### List Models |
| 40 | + |
| 41 | +```bash |
| 42 | +ads aqua model list \ |
| 43 | + --compartment_id "ocid1.compartment.oc1..xxx" |
| 44 | +``` |
| 45 | + |
| 46 | +### Get Model Details |
| 47 | + |
| 48 | +```bash |
| 49 | +ads aqua model get \ |
| 50 | + --model_id "ocid1.datasciencemodel.oc1.iad.xxx" |
| 51 | +``` |
| 52 | + |
| 53 | +### Register Model from HuggingFace |
| 54 | + |
| 55 | +```bash |
| 56 | +ads aqua model register \ |
| 57 | + --model "meta-llama/Llama-3.1-8B-Instruct" \ |
| 58 | + --os_path "oci://my-bucket@my-namespace/models/llama-3.1-8b/" \ |
| 59 | + --compartment_id "ocid1.compartment.oc1..xxx" \ |
| 60 | + --project_id "ocid1.datascienceproject.oc1.iad.xxx" \ |
| 61 | + --inference_container "odsc-vllm-serving" \ |
| 62 | + --download_from_hf True |
| 63 | +``` |
| 64 | + |
| 65 | +Full parameter reference: `references/params.md` |
| 66 | + |
| 67 | +### Register from Object Storage |
| 68 | + |
| 69 | +```bash |
| 70 | +ads aqua model register \ |
| 71 | + --model "my-custom-model" \ |
| 72 | + --os_path "oci://my-bucket@my-namespace/models/custom-model/" \ |
| 73 | + --inference_container "odsc-vllm-serving" |
| 74 | +``` |
| 75 | + |
| 76 | +### Register GGUF Model |
| 77 | + |
| 78 | +```bash |
| 79 | +ads aqua model register \ |
| 80 | + --model "TheBloke/Llama-2-7B-Chat-GGUF" \ |
| 81 | + --os_path "oci://my-bucket@my-namespace/models/llama2-gguf/" \ |
| 82 | + --inference_container "odsc-llama-cpp-serving" \ |
| 83 | + --download_from_hf True |
| 84 | +``` |
| 85 | + |
| 86 | +### Register with BYOC (Bring Your Own Container) |
| 87 | + |
| 88 | +```bash |
| 89 | +ads aqua model register \ |
| 90 | + --model "my-custom-model" \ |
| 91 | + --os_path "oci://my-bucket@my-namespace/models/custom/" \ |
| 92 | + --inference_container_uri "<region>.ocir.io/<namespace>/<repo>:<tag>" |
| 93 | +``` |
| 94 | + |
| 95 | +### Convert Legacy Fine-Tuned Model |
| 96 | + |
| 97 | +```bash |
| 98 | +ads aqua model convert_fine_tune \ |
| 99 | + --model_id "ocid1.datasciencemodel.oc1.iad.xxx" |
| 100 | +``` |
| 101 | + |
| 102 | +--- |
| 103 | + |
| 104 | +## Deployment Commands |
| 105 | + |
| 106 | +### Create Single Model Deployment |
| 107 | + |
| 108 | +```bash |
| 109 | +ads aqua deployment create \ |
| 110 | + --model_id "ocid1.datasciencemodel.oc1.iad.xxx" \ |
| 111 | + --instance_shape "VM.GPU.A10.2" \ |
| 112 | + --display_name "my-deployment" \ |
| 113 | + --compartment_id "ocid1.compartment.oc1..xxx" \ |
| 114 | + --project_id "ocid1.datascienceproject.oc1.iad.xxx" \ |
| 115 | + --log_group_id "ocid1.loggroup.oc1.iad.xxx" \ |
| 116 | + --log_id "ocid1.log.oc1.iad.xxx" |
| 117 | +``` |
| 118 | + |
| 119 | +Full parameter reference: `references/params.md` |
| 120 | + |
| 121 | +### Create with Custom vLLM Parameters |
| 122 | + |
| 123 | +```bash |
| 124 | +ads aqua deployment create \ |
| 125 | + --model_id "ocid1.datasciencemodel.oc1.iad.xxx" \ |
| 126 | + --instance_shape "VM.GPU.A10.2" \ |
| 127 | + --display_name "my-deployment" \ |
| 128 | + --env_var '{"MODEL_DEPLOY_PREDICT_ENDPOINT": "/v1/chat/completions", "PARAMS": "--max-model-len 8192 --gpu-memory-utilization 0.95"}' |
| 129 | +``` |
| 130 | + |
| 131 | +### Create Multi-Model Deployment |
| 132 | + |
| 133 | +```bash |
| 134 | +ads aqua deployment create \ |
| 135 | + --models '[ |
| 136 | + {"model_id": "ocid1...model1", "model_name": "llama-8b", "gpu_count": 1}, |
| 137 | + {"model_id": "ocid1...model2", "model_name": "mistral-7b", "gpu_count": 1} |
| 138 | + ]' \ |
| 139 | + --instance_shape "VM.GPU.A10.2" \ |
| 140 | + --display_name "multi-model-deployment" |
| 141 | +``` |
| 142 | + |
| 143 | +### Create Stacked Deployment |
| 144 | + |
| 145 | +```bash |
| 146 | +ads aqua deployment create \ |
| 147 | + --models '[ |
| 148 | + { |
| 149 | + "model_id": "ocid1...base_model", |
| 150 | + "model_name": "llama-3.1-8b", |
| 151 | + "fine_tune_weights": [ |
| 152 | + {"model_id": "ocid1...ft1", "model_name": "ft-customer-support"}, |
| 153 | + {"model_id": "ocid1...ft2", "model_name": "ft-summarization"} |
| 154 | + ] |
| 155 | + } |
| 156 | + ]' \ |
| 157 | + --instance_shape "VM.GPU.A10.2" \ |
| 158 | + --display_name "stacked-deployment" \ |
| 159 | + --deployment_type "STACKED" |
| 160 | +``` |
| 161 | + |
| 162 | +### Deploy with Tool Calling |
| 163 | + |
| 164 | +```bash |
| 165 | +ads aqua deployment create \ |
| 166 | + --model_id "ocid1.datasciencemodel.oc1.iad.xxx" \ |
| 167 | + --instance_shape "VM.GPU.A10.2" \ |
| 168 | + --display_name "tool-calling-deployment" \ |
| 169 | + --env_var '{"MODEL_DEPLOY_PREDICT_ENDPOINT": "/v1/chat/completions", "PARAMS": "--enable-auto-tool-choice --tool-call-parser llama3_json --max-model-len 4096"}' |
| 170 | +``` |
| 171 | + |
| 172 | +### Deploy GGUF Model on CPU |
| 173 | + |
| 174 | +```bash |
| 175 | +ads aqua deployment create \ |
| 176 | + --model_id "ocid1.datasciencemodel.oc1.iad.xxx" \ |
| 177 | + --instance_shape "VM.Standard.A1.Flex" \ |
| 178 | + --display_name "cpu-gguf-deployment" \ |
| 179 | + --env_var '{"PARAMS": "--quantization Q4_0"}' |
| 180 | +``` |
| 181 | + |
| 182 | +### Shape Recommendation |
| 183 | + |
| 184 | +```bash |
| 185 | +# Table output (human-friendly default) |
| 186 | +ads aqua deployment recommend_shape \ |
| 187 | + --model_id "meta-llama/Llama-3.3-70B-Instruct" |
| 188 | + |
| 189 | +# By model OCID |
| 190 | +ads aqua deployment recommend_shape \ |
| 191 | + --model_id "ocid1.datasciencemodel.oc1.iad.xxx" |
| 192 | + |
| 193 | +# JSON output (programmatic use) |
| 194 | +ads aqua deployment recommend_shape \ |
| 195 | + --model_id "meta-llama/Llama-3.3-70B-Instruct" \ |
| 196 | + --generate_table False |
| 197 | +``` |
| 198 | + |
| 199 | +Full parameter reference: `references/params.md` |
| 200 | + |
| 201 | +### List Deployments |
| 202 | + |
| 203 | +```bash |
| 204 | +ads aqua deployment list \ |
| 205 | + --compartment_id "ocid1.compartment.oc1..xxx" |
| 206 | +``` |
| 207 | + |
| 208 | +### Get Deployment Details |
| 209 | + |
| 210 | +```bash |
| 211 | +ads aqua deployment get \ |
| 212 | + --model_deployment_id "ocid1.datasciencemodeldeployment.oc1.iad.xxx" |
| 213 | +``` |
| 214 | + |
| 215 | +--- |
| 216 | + |
| 217 | +## Fine-Tuning Commands |
| 218 | + |
| 219 | +### Create Fine-Tuning Job |
| 220 | + |
| 221 | +```bash |
| 222 | +ads aqua fine_tuning create \ |
| 223 | + --ft_source_id "ocid1.datasciencemodel.oc1.iad.xxx" \ |
| 224 | + --ft_name "llama-3.1-8b-custom" \ |
| 225 | + --dataset_path "oci://my-bucket@my-namespace/datasets/train.jsonl" \ |
| 226 | + --report_path "oci://my-bucket@my-namespace/ft-output/" \ |
| 227 | + --shape_name "VM.GPU.A10.2" \ |
| 228 | + --replica 1 \ |
| 229 | + --compartment_id "ocid1.compartment.oc1..xxx" \ |
| 230 | + --project_id "ocid1.datascienceproject.oc1.iad.xxx" \ |
| 231 | + --log_group_id "ocid1.loggroup.oc1.iad.xxx" \ |
| 232 | + --log_id "ocid1.log.oc1.iad.xxx" \ |
| 233 | + --ft_parameters '{"epochs": 3, "learning_rate": 0.00002}' |
| 234 | +``` |
| 235 | + |
| 236 | +Full parameter reference: `references/params.md` |
| 237 | + |
| 238 | +### Advanced Hyperparameters |
| 239 | + |
| 240 | +```bash |
| 241 | +ads aqua fine_tuning create \ |
| 242 | + --ft_source_id "ocid1.datasciencemodel.oc1.iad.xxx" \ |
| 243 | + --ft_name "llama-custom-advanced" \ |
| 244 | + --dataset_path "oci://bucket@ns/train.jsonl" \ |
| 245 | + --report_path "oci://bucket@ns/output/" \ |
| 246 | + --shape_name "BM.GPU.A10.4" \ |
| 247 | + --replica 1 \ |
| 248 | + --ft_parameters '{ |
| 249 | + "epochs": 5, |
| 250 | + "learning_rate": 1e-5, |
| 251 | + "batch_size": 4, |
| 252 | + "sequence_len": 2048, |
| 253 | + "pad_to_sequence_len": true, |
| 254 | + "sample_packing": "auto", |
| 255 | + "lora_r": 64, |
| 256 | + "lora_alpha": 32, |
| 257 | + "lora_dropout": 0.1, |
| 258 | + "lora_target_linear": true |
| 259 | + }' |
| 260 | +``` |
| 261 | + |
| 262 | +--- |
| 263 | + |
| 264 | +## Evaluation Commands |
| 265 | + |
| 266 | +### Create Evaluation |
| 267 | + |
| 268 | +```bash |
| 269 | +ads aqua evaluation create \ |
| 270 | + --evaluation_source_id "ocid1.datasciencemodeldeployment.oc1.iad.xxx" \ |
| 271 | + --evaluation_name "llama-eval-bertscore" \ |
| 272 | + --dataset_path "oci://my-bucket@my-namespace/datasets/eval.jsonl" \ |
| 273 | + --report_path "oci://my-bucket@my-namespace/eval-reports/" \ |
| 274 | + --model_parameters '{"max_tokens": 500, "temperature": 0.7}' \ |
| 275 | + --shape_name "VM.Standard.E4.Flex" \ |
| 276 | + --block_storage_size 50 \ |
| 277 | + --compartment_id "ocid1.compartment.oc1..xxx" \ |
| 278 | + --project_id "ocid1.datascienceproject.oc1.iad.xxx" \ |
| 279 | + --metrics '[{"name": "bertscore"}, {"name": "rouge"}]' |
| 280 | +``` |
| 281 | + |
| 282 | +Full parameter reference: `references/params.md` |
| 283 | + |
| 284 | +### Evaluate Specific Model in Multi/Stacked Deployment |
| 285 | + |
| 286 | +```bash |
| 287 | +ads aqua evaluation create \ |
| 288 | + --evaluation_source_id "ocid1.datasciencemodeldeployment.oc1.iad.xxx" \ |
| 289 | + --evaluation_name "stacked-ft1-eval" \ |
| 290 | + --dataset_path "oci://bucket@ns/eval.jsonl" \ |
| 291 | + --report_path "oci://bucket@ns/eval-reports/" \ |
| 292 | + --model_parameters '{"max_tokens": 500, "temperature": 0.7, "model": "ft-customer-support"}' \ |
| 293 | + --shape_name "VM.Standard.E4.Flex" \ |
| 294 | + --block_storage_size 50 \ |
| 295 | + --metrics '[{"name": "bertscore"}]' |
| 296 | +``` |
| 297 | + |
| 298 | +### List Evaluations |
| 299 | + |
| 300 | +```bash |
| 301 | +ads aqua evaluation list \ |
| 302 | + --compartment_id "ocid1.compartment.oc1..xxx" |
| 303 | +``` |
| 304 | + |
| 305 | +### Get Evaluation Details |
| 306 | + |
| 307 | +```bash |
| 308 | +ads aqua evaluation get \ |
| 309 | + --eval_id "ocid1.datasciencemodel.oc1.iad.xxx" |
| 310 | +``` |
| 311 | + |
| 312 | +--- |
| 313 | + |
| 314 | +## Policy Verification |
| 315 | + |
| 316 | +```bash |
| 317 | +ads aqua verify_policies |
| 318 | +``` |
| 319 | + |
| 320 | +--- |
| 321 | + |
| 322 | +## Watching Logs |
| 323 | + |
| 324 | +```bash |
| 325 | +# Model deployment logs |
| 326 | +ads opctl watch <model_deployment_ocid> --auth resource_principal |
| 327 | + |
| 328 | +# Job run logs (fine-tuning / evaluation) |
| 329 | +ads opctl watch <job_run_ocid> --auth resource_principal |
| 330 | +``` |
| 331 | + |
| 332 | +## Key Source Files |
| 333 | + |
| 334 | +- `ads/aqua/cli.py` — `AquaCommand` entry point (model, deployment, evaluation, fine_tuning) |
| 335 | +- `ads/aqua/app.py` — `CLIBuilderMixin` for CLI parameter handling |
0 commit comments