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-evaluation/code_templates/llmaaj_evaluator.py
View on GitHub# Cell 0 [markdown]: Model Evaluation
# Cell 1: Configuration
# Set AWS region before importing SageMaker SDK
import os
REGION = "[REGION]"
os.environ["AWS_DEFAULT_REGION"] = REGION
# %pip install --upgrade 'sagemaker>=3.7.1,<4.0' --quiet # NOTEBOOK_ONLY
import json
from pathlib import Path
from sagemaker.core import Attribution, set_attribution
from sagemaker.train.evaluate import LLMAsJudgeEvaluator
set_attribution(Attribution.SAGEMAKER_AGENT_PLUGIN)
# Suppress verbose logging from SageMaker SDK
import logging
logging.getLogger("sagemaker").setLevel(logging.WARNING)
logging.getLogger("botocore").setLevel(logging.WARNING)
# Evaluation configuration
MODEL = "[MODEL_ARN]"
DATASET = "[DATASET_S3_URI]"
EVALUATOR_MODEL = "[JUDGE_MODEL]"
BUILTIN_METRICS = [METRICS_LIST]
CUSTOM_METRICS = None
# NOTE FOR AGENT: If user wishes to use custom metrics,
# custom_metrics.json should have been generated previously in the project root.
# Uncomment this code to load the custom metrics from that file:
# CUSTOM_METRICS = json.loads((Path("[PROJECT_DIR]") / "custom_metrics.json").read_text())
S3_OUTPUT = "[S3_OUTPUT_PATH]"
EVALUATE_BASE = [TRUE_OR_FALSE]
# MLflow configuration
MLFLOW_EXPERIMENT_NAME = "[MLFLOW_EXPERIMENT_NAME]"
# Cell 2: Start Evaluation
# Build evaluator kwargs
evaluator_kwargs = dict(
model=MODEL,
evaluator_model=EVALUATOR_MODEL,
dataset=DATASET,
s3_output_path=S3_OUTPUT,
evaluate_base_model=EVALUATE_BASE,
region=REGION,
mlflow_experiment_name=MLFLOW_EXPERIMENT_NAME,
)
if BUILTIN_METRICS:
evaluator_kwargs["builtin_metrics"] = BUILTIN_METRICS
if CUSTOM_METRICS:
evaluator_kwargs["custom_metrics"] = json.dumps(CUSTOM_METRICS)
evaluator = LLMAsJudgeEvaluator(**evaluator_kwargs)
print("✅ Starting evaluation...")
print(f"Model: {MODEL}")
print(f"Dataset: {DATASET}")
print(f"Judge: {EVALUATOR_MODEL}")
if BUILTIN_METRICS:
print(f"Built-in metrics: {BUILTIN_METRICS}")
if CUSTOM_METRICS:
print(f"Custom metrics: {len(CUSTOM_METRICS)} defined")
execution = evaluator.evaluate()
print(f"\n✅ Evaluation job started!")
print(f"Job ARN: {execution.arn}")
print(f"Job Name: {execution.name}")
print(f"Status: {execution.status.overall_status}")
# Cell 3: Wait for Completion
execution.wait(target_status="Succeeded", poll=30)
# Cell 4: Show Results
# Display evaluation results
# If evaluate_base_model was True, this shows a comparison between base and custom model
execution.show_results()
# Save manifest
manifest_dir = Path("[PROJECT_DIR]") / "manifests"
manifest_dir.mkdir(parents=True, exist_ok=True)
manifest_path = manifest_dir / f"eval-{execution.name}.json"
manifest_path.write_text(
json.dumps(
{
"evaluation_arn": execution.arn,
},
indent=2,
)
)
print(f"Manifest saved: {manifest_path}")
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 |