> For the complete documentation index, see [llms.txt](https://docs.clore.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.clore.ai/guides/guides_v2-zh/tu-xiang-sheng-cheng/fooocus-simple-sd.md).

# Fooocus

在 Clore.ai 上使用 Fooocus 轻松生成 Stable Diffusion 图像

使用 Fooocus 生成图像——使用 Stable Diffusion 的最简单方式。

{% hint style="success" %}
所有示例都可以在通过以下方式租用的 GPU 服务器上运行 [CLORE.AI 市场](https://clore.ai/marketplace).
{% endhint %}

## 在 CLORE.AI 上租用

1. 访问 [CLORE.AI 市场](https://clore.ai/marketplace)
2. 按 GPU 类型、VRAM 和价格筛选
3. 选择 **按需** （固定费率）或 **竞价** （出价）
4. 配置你的订单：
   * 选择 Docker 镜像
   * 设置端口（SSH 用 TCP，Web UI 用 HTTP）
   * 如有需要，添加环境变量
   * 输入启动命令
5. 选择支付方式： **CLORE**, **BTC**，或 **USDT/USDC**
6. 创建订单并等待部署

### 访问你的服务器

* 在以下位置查找连接信息 **我的订单**
* Web 界面：使用 HTTP 端口 URL
* SSH： `ssh -p <port> root@<proxy-address>`

## 什么是 Fooocus？

Fooocus 是一个精简的 Stable Diffusion 界面，具备：

* 无需任何配置
* 默认使用 SDXL
* 内置风格和预设
* 自动处理所有优化

## 需求

| 质量  | 最低显存  | 推荐            |
| --- | ----- | ------------- |
| 基础  | 4GB   | RTX 3060      |
| 标准  | 8GB   | RTX 3070      |
| 高质量 | 12GB+ | RTX 3090/4090 |

## 快速部署

**Docker 镜像：**

```
pytorch/pytorch:2.11.0-cuda12.8-cudnn9-devel
```

**端口：**

```
22/tcp
7865/http
```

**命令：**

```bash
apt-get update && apt-get install -y git libgl1 libglib2.0-0 && \\
cd /workspace && \
git clone https://github.com/lllyasviel/Fooocus.git && \\
cd Fooocus && \\
pip install -r requirements_versions.txt && \\
python launch.py --listen 0.0.0.0 --port 7865
```

## 访问你的服务

部署后，找到你的 `http_pub` URL 在 **我的订单**:

1. 前往 **我的订单** 页面
2. 点击你的订单
3. 找到 `http_pub` URL（例如， `abc123.clorecloud.net`)

使用 `https://YOUR_HTTP_PUB_URL` 替代 `localhost` 在下面的示例中。

## 首次启动

首次运行时，Fooocus 会自动下载：

* SDXL 基础模型（约 6.5GB）
* SDXL 精炼器（约 6GB）
* 所需嵌入

首次启动需要 10-15 分钟。

## 使用 Fooocus

### 基础生成

1. 打开 `http://<proxy>:<port>`
2. 输入你的提示词
3. 点击“生成”

就这么简单！无需任何设置。

### 风格

Fooocus 包含 200+ 内置风格：

**热门风格：**

* Fooocus Enhance - 更好的细节
* Fooocus Sharp - 清晰边缘
* Cinematic - 电影质感
* Anime - 日本动画
* Photographic - 真实照片

### 质量预设

| 预设   | 速度 | 质量 |
| ---- | -- | -- |
| 速度   | 快  | 好  |
| 质量   | 中等 | 很高 |
| 极致速度 | 最快 | 基础 |

## 高级功能

### 启用高级模式

点击“高级”复选框可访问：

* 负向提示词
* 宽高比
* 图片数量
* 随机种子控制

### 图生图

1. 启用“输入图像”选项卡
2. 上传源图像
3. 选择模式：
   * **放大** - 提升分辨率
   * **变体** - 创建变体
   * **局部重绘** - 编辑部分

### 局部重绘

```
1. 上传图像
2. 点击“局部重绘或扩展”
3. 在要更改的区域上绘制蒙版
4. 描述要生成的内容
5. 点击生成
```

### 图像扩展

将图像扩展到边界之外：

1. 上传图像
2. 选择“局部重绘或扩展”
3. 勾选方向框（左、右、上、下）
4. 生成以扩展画布

## 使用 LoRA

### 下载 LoRA

```bash
cd /workspace/Fooocus/models/loras
wget https://civitai.com/api/download/models/<model_id> -O my_lora.safetensors
```

### 应用 LoRA

1. 转到“模型”选项卡
2. 在下拉菜单中选择 LoRA
3. 调整权重（0.5-1.0）

## 自定义模型

### 添加自定义检查点

```bash
cd /workspace/Fooocus/models/checkpoints

# 下载模型
wget https://huggingface.co/model/file.safetensors
```

刷新界面或重启以查看新模型。

### 推荐模型

| 模型             | 风格   | 大小    |
| -------------- | ---- | ----- |
| Juggernaut XL  | 照片写实 | 6.5GB |
| DreamShaper XL | 艺术风格 | 6.5GB |
| RealVisXL      | 真实   | 6.5GB |
| Animagine XL   | 动漫   | 6.5GB |

## 换脸

内置换脸功能：

1. 启用“图像提示”选项卡
2. 上传人脸图像
3. 将类型设为“FaceSwap”
4. 使用人脸提示生成

## 放大

### 内置放大器

1. 将图像上传到“放大或变体”
2. 选择“放大（2x）”
3. 生成

### 变体选项

* **变体（轻微）** - 小幅更改
* **变体（强烈）** - 大幅更改

## 描述图像

反向提示词工程：

1. 转到“描述”选项卡
2. 上传图像
3. 获取提示词建议

## 性能优化

### 适用于 8GB 显存

```bash
python launch.py --listen 0.0.0.0 --always-offload-from-vram
```

### 适用于 6GB 显存

```bash
python launch.py --listen 0.0.0.0 --always-low-vram
```

### 适用于 4GB 显存

```bash
python launch.py --listen 0.0.0.0 --always-cpu
```

## 批量处理

### 生成多张图像

在高级模式下：

* 将“图像数量”设置为所需数量
* 所有图像都使用不同的种子生成

### 提示词队列

使用通配符生成变化：

```
一辆 {红色|蓝色|绿色} 的汽车在街上
```

生成 3 张不同颜色的图像。

## API 访问

### 启用 API

```bash
python launch.py --listen 0.0.0.0 --port 7865
```

### API 端点

```python
import requests

response = requests.post(
    "http://localhost:7865/v1/generation/text-to-image",
    json={
        "prompt": "群山之上的美丽日落",
        "negative_prompt": "",
        "style_selections": ["Fooocus Enhance"],
        "performance_selection": "质量",
        "aspect_ratios_selection": "1024×1024",
        "image_number": 1,
        "image_seed": -1,
    }
)

# 获取图像
image_data = response.json()
```

## 预设

### 创建自定义预设

编辑 `presets/default.json`:

```json
{
    "default_model": "juggernautXL.safetensors",
    "default_refiner": "无",
    "default_loras": [
        ["detail_lora.safetensors", 0.5]
    ],
    "default_styles": ["Fooocus Enhance", "Cinematic"]
}
```

### 使用预设启动

```bash
python launch.py --preset anime
```

## 对比：Fooocus 与其他工具

| 功能   | Fooocus | A1111 | ComfyUI |
| ---- | ------- | ----- | ------- |
| 配置   | 无       | 中等    | 复杂      |
| 学习曲线 | 简单      | 中等    | 困难      |
| 灵活性  | 低       | 高     | 最高      |
| 最适合  | 初学者     | 高级用户  | 开发者     |

## 故障排查

### 内存不足

```bash

# 使用低显存模式
python launch.py --always-low-vram

# 或禁用细化器

# 在界面中：模型选项卡 > 细化器 > 无
```

### 生成缓慢

* 启用“极致速度”预设
* 禁用细化器
* 使用更小的分辨率

### 模型未加载

```bash

# 检查模型是否存在
ls -la /workspace/Fooocus/models/checkpoints/

# 检查文件大小（SDXL 应约为 6GB）
du -h /workspace/Fooocus/models/checkpoints/*.safetensors
```

### 黑图

* 降低 CFG 比例
* 更改种子
* 尝试不同的提示词

## 下载结果

```bash

# 图像位于 outputs 文件夹中
scp -P <port> -r root@<proxy>:/workspace/Fooocus/outputs/ ./
```

## 成本估算

CLORE.AI 市场常见费率（截至 2024 年）：

| GPU       | 小时费率    | 日费率     | 4 小时会话  |
| --------- | ------- | ------- | ------- |
| RTX 3060  | \~$0.03 | \~$0.70 | \~$0.12 |
| RTX 3090  | \~$0.06 | \~$1.50 | \~$0.25 |
| RTX 4090  | \~$0.10 | \~$2.30 | \~$0.40 |
| A100 40GB | \~$0.17 | \~$4.00 | \~$0.70 |
| A100 80GB | \~$0.25 | \~$6.00 | \~$1.00 |

*价格因提供商和需求而异。请查看* [*CLORE.AI 市场*](https://clore.ai/marketplace) *以获取当前费率。*

**节省费用：**

* 使用 **竞价** 可中断工作市场——约三分之一的服务器将现货价格定得低于按需价格（中位数约优惠 13%），其余则与按需价格持平
* 使用 **CLORE** 代币支付
* 比较不同提供商的价格

## 下一步

* Stable Diffusion WebUI - 更多控制
* ComfyUI 工作流 - 基于节点
* FLUX 生成 - 更新的模型


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.clore.ai/guides/guides_v2-zh/tu-xiang-sheng-cheng/fooocus-simple-sd.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
