Loading...
Loading...
Compare original and translation side by side
pip install "skypilot[aws,gcp,azure,kubernetes]"pip install "skypilot[aws,gcp,azure,kubernetes]"undefinedundefinedhello.yamlresources:
accelerators: T4:1
run: |
nvidia-smi
echo "Hello from SkyPilot!"sky launch -c hello hello.yamlhello.yamlresources:
accelerators: T4:1
run: |
nvidia-smi
echo "Hello from SkyPilot!"sky launch -c hello hello.yamlundefinedundefinedundefinedundefinedundefinedundefined| Command | Purpose |
|---|---|
| Launch cluster and run task |
| Run task on existing cluster |
| Show cluster status |
| Stop cluster (preserve state) |
| Terminate cluster |
| View task logs |
| Show job queue |
| Launch managed job |
| Deploy serving endpoint |
| 命令 | 用途 |
|---|---|
| 启动集群并运行任务 |
| 在已有集群上运行任务 |
| 查看集群状态 |
| 停止集群(保留状态) |
| 终止集群 |
| 查看任务日志 |
| 查看作业队列 |
| 启动托管作业 |
| 部署服务端点 |
undefinedundefinedundefinedundefinedresources:
accelerators:
H100: 8
A100-80GB: 8
A100: 8
any_of:
- cloud: gcp
- cloud: aws
- cloud: azureresources:
accelerators:
H100: 8
A100-80GB: 8
A100: 8
any_of:
- cloud: gcp
- cloud: aws
- cloud: azureresources:
accelerators: A100:8
use_spot: true
spot_recovery: FAILOVER # Auto-recover on preemptionresources:
accelerators: A100:8
use_spot: true
spot_recovery: FAILOVER # Auto-recover on preemptionundefinedundefinedundefinedundefinedresources:
accelerators: A100:4
autostop:
idle_minutes: 30
down: true # Terminate instead of stopundefinedresources:
accelerators: A100:4
autostop:
idle_minutes: 30
down: true # Terminate instead of stopundefinedundefinedundefinedundefinedundefinedundefinedundefinedresources:
accelerators: A100:8
num_nodes: 4 # 4 nodes × 8 GPUs = 32 GPUs total
setup: |
pip install torch torchvision
run: |
torchrun \
--nnodes=$SKYPILOT_NUM_NODES \
--nproc_per_node=$SKYPILOT_NUM_GPUS_PER_NODE \
--node_rank=$SKYPILOT_NODE_RANK \
--master_addr=$(echo "$SKYPILOT_NODE_IPS" | head -n1) \
--master_port=12355 \
train.pyresources:
accelerators: A100:8
num_nodes: 4 # 4 nodes × 8 GPUs = 32 GPUs total
setup: |
pip install torch torchvision
run: |
torchrun \
--nnodes=$SKYPILOT_NUM_NODES \
--nproc_per_node=$SKYPILOT_NUM_GPUS_PER_NODE \
--node_rank=$SKYPILOT_NODE_RANK \
--master_addr=$(echo "$SKYPILOT_NODE_IPS" | head -n1) \
--master_port=12355 \
train.py| Variable | Description |
|---|---|
| Node index (0 to num_nodes-1) |
| Newline-separated IP addresses |
| Total number of nodes |
| GPUs per node |
| 变量 | 说明 |
|---|---|
| 节点索引(0到num_nodes-1) |
| 换行分隔的IP地址列表 |
| 总节点数 |
| 每节点GPU数量 |
run: |
if [ "${SKYPILOT_NODE_RANK}" == "0" ]; then
python orchestrate.py
firun: |
if [ "${SKYPILOT_NODE_RANK}" == "0" ]; then
python orchestrate.py
fiundefinedundefinedundefinedundefinedname: training-job
file_mounts:
/checkpoints:
name: my-checkpoints
store: s3
mode: MOUNT
resources:
accelerators: A100:8
use_spot: true
run: |
python train.py \
--checkpoint-dir /checkpoints \
--resume-from-latestname: training-job
file_mounts:
/checkpoints:
name: my-checkpoints
store: s3
mode: MOUNT
resources:
accelerators: A100:8
use_spot: true
run: |
python train.py \
--checkpoint-dir /checkpoints \
--resume-from-latestundefinedundefinedundefinedundefinedworkdir: ./my-project # Synced to ~/sky_workdir
file_mounts:
/data/config.yaml: ./config.yaml
~/.vimrc: ~/.vimrcworkdir: ./my-project # Synced to ~/sky_workdir
file_mounts:
/data/config.yaml: ./config.yaml
~/.vimrc: ~/.vimrcfile_mounts:
# Mount S3 bucket
/datasets:
source: s3://my-bucket/datasets
mode: MOUNT # Stream from S3
# Copy GCS bucket
/models:
source: gs://my-bucket/models
mode: COPY # Pre-fetch to disk
# Cached mount (fast writes)
/outputs:
name: my-outputs
store: s3
mode: MOUNT_CACHEDfile_mounts:
# Mount S3 bucket
/datasets:
source: s3://my-bucket/datasets
mode: MOUNT # Stream from S3
# Copy GCS bucket
/models:
source: gs://my-bucket/models
mode: COPY # Pre-fetch to disk
# Cached mount (fast writes)
/outputs:
name: my-outputs
store: s3
mode: MOUNT_CACHED| Mode | Description | Best For |
|---|---|---|
| Stream from cloud | Large datasets, read-heavy |
| Pre-fetch to disk | Small files, random access |
| Cache with async upload | Checkpoints, outputs |
| 模式 | 说明 | 适用场景 |
|---|---|---|
| 从云存储流式读取 | 大型数据集、读密集型场景 |
| 预取到本地磁盘 | 小型文件、随机访问场景 |
| 缓存并异步上传 | 检查点、输出文件场景 |
undefinedundefined
```bash
```bashundefinedundefinedservice:
replica_policy:
min_replicas: 1
max_replicas: 10
target_qps_per_replica: 2.0
upscale_delay_seconds: 60
downscale_delay_seconds: 300
load_balancing_policy: round_robinservice:
replica_policy:
min_replicas: 1
max_replicas: 10
target_qps_per_replica: 2.0
upscale_delay_seconds: 60
downscale_delay_seconds: 300
load_balancing_policy: round_robinundefinedundefined
```bash
```bashundefinedundefinedresources:
accelerators: A100:8
any_of:
- cloud: gcp
region: us-central1
- cloud: aws
region: us-east-1
- cloud: azureresources:
accelerators: A100:8
any_of:
- cloud: gcp
region: us-central1
- cloud: aws
region: us-east-1
- cloud: azureenvs:
HF_TOKEN: $HF_TOKEN # Inherited from local env
WANDB_API_KEY: $WANDB_API_KEYenvs:
HF_TOKEN: $HF_TOKEN # Inherited from local env
WANDB_API_KEY: $WANDB_API_KEYundefinedundefinedname: llm-finetune
file_mounts:
/checkpoints:
name: finetune-checkpoints
store: s3
mode: MOUNT_CACHED
resources:
accelerators: A100:8
use_spot: true
setup: |
pip install transformers accelerate
run: |
python train.py \
--checkpoint-dir /checkpoints \
--resumename: llm-finetune
file_mounts:
/checkpoints:
name: finetune-checkpoints
store: s3
mode: MOUNT_CACHED
resources:
accelerators: A100:8
use_spot: true
setup: |
pip install transformers accelerate
run: |
python train.py \
--checkpoint-dir /checkpoints \
--resumename: hp-sweep-${RUN_ID}
envs:
RUN_ID: 0
LEARNING_RATE: 1e-4
BATCH_SIZE: 32
resources:
accelerators: A100:1
use_spot: true
run: |
python train.py \
--lr $LEARNING_RATE \
--batch-size $BATCH_SIZE \
--run-id $RUN_IDundefinedname: hp-sweep-${RUN_ID}
envs:
RUN_ID: 0
LEARNING_RATE: 1e-4
BATCH_SIZE: 32
resources:
accelerators: A100:1
use_spot: true
run: |
python train.py \
--lr $LEARNING_RATE \
--batch-size $BATCH_SIZE \
--run-id $RUN_IDundefinedundefinedundefinedundefinedundefinedundefinedundefined| Issue | Solution |
|---|---|
| Quota exceeded | Request quota increase, try different region |
| Spot preemption | Use |
| Slow file sync | Use |
| GPU not available | Use |
| 问题 | 解决方案 |
|---|---|
| Quota exceeded | 申请配额提升,尝试其他区域 |
| Spot preemption | 使用 |
| Slow file sync | 对输出文件使用 |
| GPU not available | 使用 |