opensite-ai/opensite-skills / aws-ai-ml
aws-ai-ml
VerifiedSelects, deploys, and customizes AI models on Amazon SageMaker. Training or Processing jobs, fine-tuning (SFT/DPO/RLVR/RLAIF), model selection, dataset preparation, evaluation, SageMaker or Bedrock deployment, inference optimization and endpoint diagnostics. Covers the full lifecycle from planning through production. Use when fine-tuning models on SageMaker, choosing which base model to customize, fine-tune, or deploy from SageMaker JumpStart or Hub, SageMakerPublicHub, or the SageMaker public model catalog, transforming or validating training data, evaluating model quality, deploying or optimizing endpoints, configuring IAM/S3 for training, or managing SageMaker Managed MLflow. Use for endpoint health, failures, latency, logs, metrics, errors. Covers Serverless Model Customization, Nova and OSS deployment paths, and PySDK v3. NOT for Ground Truth labeling, Feature Store, or general-purpose AWS infrastructure.
references/model-deployment/references/optimization/huggingface-to-s3.md
View on GitHub# Deploying / Optimizing a HuggingFace Hub Model (not on JumpStart)
Use this when the user wants to deploy or optimize a model that lives on the **HuggingFace Hub** (e.g. `mistralai/Mistral-7B-Instruct-v0.3`) rather than SageMaker JumpStart / the SageMaker Hub.
The AI recommendation job needs the model weights in **S3** (`ModelBuilder(model_path="s3://...")`). So the flow is: **download from HuggingFace → upload to S3 → run a recommendation job on the S3 model → deploy the top recommendation.**
## Step 1: Confirm the model + license
- Confirm the exact HuggingFace repo id with the user (e.g. `mistralai/Mistral-7B-Instruct-v0.3`).
- Surface the model's license and get acceptance before downloading (gated models — Llama, Mistral, etc. — require accepting terms on HuggingFace and a HF token).
- If the model is gated, ask the user for a HuggingFace access token (store it securely; never echo it back).
## Step 2: Download the model to S3
Generate a Jupyter notebook or a Python script — read `../code_output_guide.md` for the mode choice and output format rules (the template's `# NOTEBOOK_ONLY` markers make it dual-mode). The code comes from `../../code_templates/optimize-huggingface-to-s3.py` (split on the `# Cell N:` comments). Cell 3 calls the SDK's `download_huggingface_model(...)` helper, which pulls the HuggingFace snapshot from the Hub and stages it to the session's default S3 bucket in one call, returning `MODEL_S3_URI`.
Placeholders to fill in Cell 2:
- `[REGION]` — the AWS region for the run (e.g. `us-west-2`).
- `[HF_MODEL_ID]` — the HuggingFace repo id confirmed in Step 1 (e.g. `mistralai/Mistral-7B-Instruct-v0.3`).
- `[HF_TOKEN_OR_NONE]` — a HuggingFace access token for gated models, or `None` for public models.
Requirements/notes:
- Requires `sagemaker>=3.20.0` (carries `download_huggingface_model`); Cell 1 installs it in notebook mode.
- Large models take time/disk to download; use an instance/host with enough space, and warn the user for big models (70B+ can be >100 GB).
- The helper stages HuggingFace-format artifacts (`config.json` + weight files) to S3 — exactly what the recommendation job expects.
## Step 3: Run the recommendation job on the S3 model
Feed `MODEL_S3_URI` into the recommendation workflow — this is identical to the standard recommendation path (`recommendation-workflow.md`), just with the S3 URI you produced above:
```python
model_builder = ModelBuilder(model_path=MODEL_S3_URI, role_arn=ROLE_ARN)
job = model_builder.generate_deployment_recommendations(workload=workload, performance_target=PERFORMANCE_TARGET, wait=True)
recommendations = model_builder.recommendations
```
## Step 4: Deploy the best recommendation
```python
# index 0 (the best/top-ranked row) is the default — no need to pass it explicitly
endpoint = model_builder.deploy(role=ROLE_ARN, auto_approve=True, wait=True)
```
## Applies to
- Same as `recommendation-workflow.md` → Applies to (it runs a recommendation job on the S3 model).
- The model must be a text-generation LLM compatible with the recommender's serving containers (vLLM / LMI).
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| writing-skillsobra/superpowersUse when creating new skills, editing existing skills, or verifying skills work before deployment | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| xlsxanthropics/skillsUse this skill any time a spreadsheet file is the primary input or output. This means any task where the user wants to: open, read, edit, or fix an existing .xlsx, .xlsm, .xltx, .csv, or .tsv file (e.g., adding columns, computing formulas, formatting, charting, cleaning messy data); create a new spreadsheet from scratch or from other data sources; or convert between tabular file formats. Trigger especially when the user references a spreadsheet file by name or path — even casually (like "the xlsx in my downloads") — and wants something done to it or produced from it. Also trigger for cleaning or restructuring messy tabular data files (malformed rows, misplaced headers, junk data) into proper spreadsheets. The deliverable must be a spreadsheet file. Do NOT trigger when the primary deliverable is a Word document, HTML report, standalone Python script, database pipeline, or Google Sheets API integration, even if tabular data is involved. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| shipping-and-launchaddyosmani/agent-skillsPrepares production launches. Use when preparing to deploy to production, or when asking what needs to be in place before shipping. Use when you need a pre-launch checklist, when setting up monitoring, when planning a staged rollout, or when you need a rollback strategy. | Stars: 119k | Updated | Claude CodeCodex | Verified | Install |
| childhoodthedotmack/claude-memBabysit a shipped release after merge, publication, or deployment. Verify published packages, production behavior, installed plugins, and late CI or user reports until the observation window is clean; use babysit for PR readiness before release. | Stars: 118k | Updated | Claude CodeCodex | Verified | Install |