跳至内容

快速入门

安装脚本

GPUStack提供了一个脚本,可在Linux上将其安装为默认端口80的systemd服务。要使用此方法安装GPUStack,只需运行:

curl -sfL https://get.gpustack.ai | sh -s -

GPUStack提供了一个脚本,可在macOS上将其安装为默认端口80的launchd服务。要使用此方法安装GPUStack,只需运行:

curl -sfL https://get.gpustack.ai | sh -s -

以管理员身份运行PowerShell(避免使用PowerShell ISE),然后运行以下命令以默认端口80安装GPUStack:

Invoke-Expression (Invoke-WebRequest -Uri "https://get.gpustack.ai" -UseBasicParsing).Content

其他安装方法

如需Docker安装、pip安装或详细配置选项,请参阅安装文档

快速入门

  1. 运行并与llama3.2模型对话:
gpustack chat llama3.2 "tell me a joke."
  1. 使用stable-diffusion-v3-5-large-turbo模型运行并生成图像:

提示

该命令从Hugging Face下载模型(约12GB)。下载时间取决于您的网络速度。请确保您有足够的磁盘空间和显存(12GB)来运行该模型。如果遇到问题,您可以跳过此步骤并继续下一步。

gpustack draw hf.co/gpustack/stable-diffusion-v3-5-large-turbo-GGUF:stable-diffusion-v3-5-large-turbo-Q4_0.gguf \
"A minion holding a sign that says 'GPUStack'. The background is filled with futuristic elements like neon lights, circuit boards, and holographic displays. The minion is wearing a tech-themed outfit, possibly with LED lights or digital patterns. The sign itself has a sleek, modern design with glowing edges. The overall atmosphere is high-tech and vibrant, with a mix of dark and neon colors." \
--sample-steps 5 --show

命令执行完成后,生成的图像将显示在默认查看器中。您可以通过调整提示词和命令行选项来定制输出效果。

Generated Image

  1. 在浏览器中打开http://your_host_ip访问GPUStack界面。使用用户名admin和默认密码登录GPUStack。您可以通过运行以下命令获取默认设置的密码:
cat /var/lib/gpustack/initial_admin_password
cat /var/lib/gpustack/initial_admin_password
Get-Content -Path "$env:APPDATA\gpustack\initial_admin_password" -Raw
  1. 点击导航菜单中的Playground - Chat。现在您可以在UI playground中与LLM进行对话。

Playground Screenshot

  1. 在导航菜单中点击API Keys,然后点击New API Key按钮。

  2. 填写Name并点击Save按钮。

  3. 复制生成的API密钥并妥善保存。请注意,该密钥仅在创建时显示一次。

  4. 现在您可以使用API密钥访问与OpenAI兼容的API。例如,使用curl命令如下:

export GPUSTACK_API_KEY=your_api_key
curl http://your_gpustack_server_url/v1-openai/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $GPUSTACK_API_KEY" \
  -d '{
    "model": "llama3.2",
    "messages": [
      {
        "role": "system",
        "content": "You are a helpful assistant."
      },
      {
        "role": "user",
        "content": "Hello!"
      }
    ],
    "stream": true
  }'

清理

完成使用已部署模型后,您可以前往GPUStack UI中的Models页面删除模型以释放资源。