117 lines
3.4 KiB
Markdown
117 lines
3.4 KiB
Markdown
# qc-cli
|
|
|
|
A CLI for Qualcomm's MLOps pipeline — browse and download models from Qualcomm AI Hub, fine-tune them on custom datasets using SageMaker, validate inference, and prepare artifacts for Qualcomm hardware deployment.
|
|
|
|
## Requirements
|
|
|
|
- Python 3.13+
|
|
- [uv](https://docs.astral.sh/uv/getting-started/installation/)
|
|
- AWS account with credentials configured (`aws configure`) when using `qc-cli infra`
|
|
- AWS CDK CLI (`npm install -g aws-cdk`) when using `qc-cli infra setup` or `qc-cli infra destroy`
|
|
|
|
## Installation
|
|
|
|
```bash
|
|
git clone <repo>
|
|
cd qc-cli
|
|
uv sync
|
|
```
|
|
|
|
Run commands with `uv run qc-cli <command>` or activate the venv first:
|
|
|
|
```bash
|
|
source .venv/bin/activate
|
|
qc-cli --help
|
|
```
|
|
|
|
## Quick start
|
|
|
|
```bash
|
|
# 1. Create config.yaml in the current directory
|
|
qc-cli init
|
|
|
|
# 2. Edit config.yaml — at minimum set s3.bucket and sagemaker.role_name
|
|
|
|
# 3. Provision AWS infrastructure (S3 bucket + SageMaker IAM role).
|
|
# This is the step that requires the AWS CDK CLI.
|
|
qc-cli infra setup
|
|
```
|
|
|
|
## Configuration
|
|
|
|
`qc-cli init` writes a `config.yaml` in the current directory. The fields you must fill in before using the tool:
|
|
|
|
```yaml
|
|
aws:
|
|
region: us-east-1
|
|
profile: default # AWS CLI profile name
|
|
|
|
s3:
|
|
bucket: your-unique-bucket-name
|
|
|
|
sagemaker:
|
|
role_name: qc-cli-sagemaker-role
|
|
```
|
|
|
|
To provision an MLflow tracking server, set:
|
|
|
|
```yaml
|
|
mlflow:
|
|
mode: create
|
|
tracking_server_name: your-tracking-server-name
|
|
```
|
|
|
|
To use an existing MLflow tracking server, set:
|
|
|
|
```yaml
|
|
mlflow:
|
|
mode: existing
|
|
tracking_server_name: your-tracking-server-name
|
|
```
|
|
|
|
## Commands
|
|
|
|
### `init`
|
|
|
|
```
|
|
qc-cli init Write config.yaml
|
|
qc-cli init --output <path> Write config to a custom path
|
|
qc-cli init --force Overwrite an existing config file
|
|
```
|
|
|
|
### `infra`
|
|
|
|
```
|
|
qc-cli infra setup Deploy the CDK stack
|
|
qc-cli infra setup --no-bootstrap Deploy without running CDK bootstrap
|
|
qc-cli infra setup --cloudformation-execution-policy <arn> Set CDK bootstrap execution policy ARN
|
|
qc-cli infra status Show CDK stack/resource status
|
|
qc-cli infra destroy Destroy stack, retaining S3 data
|
|
qc-cli infra destroy --yes Destroy stack without confirmation
|
|
qc-cli infra destroy --delete-bucket-data Destroy stack and delete S3 data
|
|
```
|
|
|
|
### `upload`
|
|
|
|
```
|
|
qc-cli upload <file> Upload a single file to S3
|
|
qc-cli upload <dir> Upload all files in a directory tree to S3
|
|
qc-cli upload <file> --s3-key <key> Upload a file to a custom S3 key
|
|
```
|
|
|
|
Uploads use `s3.bucket` and `s3.data_prefix` from `config.yaml`. File uploads default to `s3://<bucket>/<data_prefix>/<filename>`. Directory uploads are recursive, preserve paths relative to the uploaded directory, and place files under `s3://<bucket>/<data_prefix>/`.
|
|
|
|
## AWS permissions required
|
|
|
|
The IAM user or role running the CLI needs:
|
|
|
|
| Action | Service |
|
|
|---|---|
|
|
| CreateBucket, DeleteBucket, PutObject, GetObject, ListBucket, DeleteObject | S3 |
|
|
| CreateRole, GetRole, DeleteRole, AttachRolePolicy, DetachRolePolicy | IAM |
|
|
| CreateStack, UpdateStack, DeleteStack, DescribeStacks, DescribeStackEvents | CloudFormation |
|
|
| GetCallerIdentity | STS |
|
|
| CreateMlflowTrackingServer, DescribeMlflowTrackingServer, DeleteMlflowTrackingServer | SageMaker AI, when `mlflow.mode` is `create` or `existing` |
|
|
|
|
`AdministratorAccess` covers all of the above.
|