Managing Low-Rank Adaptation adapters
Upload or delete Low-Rank Adaptation (LoRA) adapters in the Cloudera AI Registry S3 bucket for Cloudera AI Inference service to deploy custom model variants.
Cloudera AI Inference service expects fine-tuned Low-Rank Adaptation (LoRA) adapters stored in the Cloudera AI Registry S3 bucket under the peft-adapters/<adapter-name>/ directory structure.
- You have access to a Cloudera AI session.
- The AWS Command Line Interface (CLI) is installed in your environment.
-
Locate Cloudera AI Registry credentials
Cloudera AI Registry S3 credentials and endpoint details are available as environment variables in any Cloudera AI session running on the cluster. To locate your credentials, run the following command in a Cloudera AI session terminal:
env | grep -i MODEL_REGISTRYThe command returns an output, similar to the following example:
MODEL_REGISTRY_AWS_ACCESS_KEY_ID=<service-principal> MODEL_REGISTRY_AWS_SECRET_ACCESS_KEY=<credential> MODEL_REGISTRY_BUCKET=<bucket-name> MODEL_REGISTRY_ENDPOINT=https://<ozone-host>:9879 MODEL_REGISTRY_REGION=auto
To ensure successful deployment, your local adapter directory must follow the required structure before uploading.
| File | Requirement | Description |
|---|---|---|
| adapter_config.json | Required | Contains PEFT configuration settings, including PEFT type, rank, base model, and target modules. |
| adapter_model.safetensors | Required | Contains LoRA weight matrices for A and B decompositions. |
| tokenizer_config.json | Optional | Specifies tokenizer settings. Cloudera recommends including this file if the adapter modified the base tokenizer. |
| tokenizer.json | Optional | Contains the full tokenizer vocabulary definitions. |
| special_tokens_map.json | Optional | Defines special token mappings for the tokenizer. |
Do not include checkpoint directories, such as checkpoint-*/, training arguments, such as training_args.bin, optimizer states, such as optimizer.pt, backup files, such as *.bak, or README.md files in your adapter directory.
Deleting an adapter from Model Registry
If the adapter is no longer needed, delete the adapter from the Cloudera AI Registry S3 bucket.
-
To remove an adapter directory, run the aws s3 rm command:
aws s3 rm s3://${MR_BUCKET}/peft-adapters/<adapter-name>/ \ --endpoint-url ${S3_ENDPOINT} \ --no-verify-ssl \ --region auto \ --recursive
