使用 SkyPilot 运行 DeepSeek 的 Janus#
SkyPilot 是一个用于在任何基础设施上运行 AI 和批量工作负载的框架,提供统一的执行、高成本节约和高 GPU 可用性。
DeepSeek AI 于 2025 年 1 月 27 日发布了 Janus。它在性能上超越了 最先进的视觉语言模型,如 LLaVA,支持多种视觉语言任务,例如图像生成和问答。
本指南将详细介绍如何在任何基础设施上运行和托管模型,包括本地 GPU 工作站、Kubernetes 集群和公共云(支持超过 15 种云服务)。
步骤 0:准备任何基础设施#
在本地机器上安装 SkyPilot
pip install 'skypilot-nightly[all]'
根据您希望运行的基础设施类型,选择以下之一
如果您的本地机器/集群有 GPU:您可以直接在现有机器上运行 SkyPilot。
如果您想使用云服务(支持超过 15 种云服务):请参阅文档了解详细信息。
步骤 1:使用 SkyPilot 运行#
现在是时候使用 SkyPilot 运行 Janus 了。命令可能因您可用的 GPU 而异。
运行 Janus (1.5B),使用
sky launch janus_1.5b.yaml \
-c janus \
--env HF_TOKEN=YOUR_HUGGING_FACE_API_TOKEN
或运行 Janus Pro (7B),使用
sky launch januspro_7b.yaml \
-c janus \
--env HF_TOKEN=YOUR_HUGGING_FACE_API_TOKEN
它将显示您拥有的所有可用机器及定价
...
Considered resources (1 node):
-----------------------------------------------------------------------------------------------------------------
CLOUD INSTANCE vCPUs Mem(GB) ACCELERATORS REGION/ZONE COST ($) CHOSEN
-----------------------------------------------------------------------------------------------------------------
Kubernetes 4CPU--16GB--1L4 4 16 L4:1 gke-cluster 0.00 ✔
RunPod 1x_L4_SECURE 4 24 L4:1 CA 0.44
GCP g2-standard-4 4 16 L4:1 us-east4-a 0.70
AWS g6.xlarge 4 16 L4:1 us-east-1 0.80
AWS g5.xlarge 4 16 A10G:1 us-east-1 1.01
Fluidstack A100_PCIE_80GB::1 28 120 A100-80GB:1 ARIZONA_USA 1.80
RunPod 1x_A100-80GB_SECURE 8 80 A100-80GB:1 CA 1.99
Paperspace A100-80G 12 80 A100-80GB:1 East Coast (NY2) 3.18
Azure Standard_NV36ads_A10_v5 36 440 A10:1 eastus 3.20
Azure Standard_NC24ads_A100_v4 24 220 A100-80GB:1 eastus 3.67
GCP a2-ultragpu-1g 12 170 A100-80GB:1 us-central1-a 5.03
Azure Standard_ND96asr_v4 96 900 A100:8 eastus 27.20
GCP a2-highgpu-8g 96 680 A100:8 us-central1-a 29.39
AWS p4d.24xlarge 96 1152 A100:8 us-east-1 32.77
-----------------------------------------------------------------------------------------------------------------
步骤 2:访问已部署的服务#
您应该能够通过终端提示直接访问,使用
Running on public URL: https://xxxxxx.gradio.live
或者您可以通过获取已部署实例的 IP 地址来访问,使用
echo `sky status --ip janus`
示例提示#
A blue sky, vast fluffy clouds surrounding, enchanting, immortal, dynamic motion, cinematic, Unreal Engine 5 and Octane Render, highly detailed, photorealistic, natural colors, epic atmosphere, and breathtaking realism
包含的文件#
janus_1.5b.yaml
envs:
HF_TOKEN: # TODO: Fill with your own huggingface token, or use --env to pass.
resources:
accelerators: {L4:1, A10G:1, A10:1, A100:8, A100-80GB:1}
ports:
- 8000
disk_tier: best
memory: 32+
setup: |
git clone https://github.com/deepseek-ai/Janus.git
pip install -e Janus[gradio]
pip install diffusers==0.32.2
python -c "import huggingface_hub; huggingface_hub.login('${HF_TOKEN}')"
run: |
cd Janus && python demo/app.py
januspro_7b.yaml
envs:
HF_TOKEN: # TODO: Fill with your own huggingface token, or use --env to pass.
resources:
accelerators: {L4:1, A10G:1, A10:1, A100:8, A100-80GB:1}
ports:
- 8000
disk_tier: best
memory: 64+
setup: |
git clone https://github.com/deepseek-ai/Janus.git
pip install -e Janus[gradio]
pip install diffusers==0.32.2
python -c "import huggingface_hub; huggingface_hub.login('${HF_TOKEN}')"
run: |
cd Janus && python demo/app_januspro.py