{"id":442590,"date":"2026-04-22T16:13:29","date_gmt":"2026-04-22T08:13:29","guid":{"rendered":"https:\/\/idc.net\/help\/?p=442590"},"modified":"2026-04-18T16:16:09","modified_gmt":"2026-04-18T08:16:09","slug":"%e5%9c%a8%e6%b5%b7%e5%a4%96%e6%9c%8d%e5%8a%a1%e5%99%a8%e4%b8%8a%e9%83%a8%e7%bd%b2stable-diffusion%ef%bc%9agpu%e5%ae%9e%e4%be%8b%e9%85%8d%e7%bd%ae%e4%b8%8e%e6%a8%a1%e5%9e%8b%e5%8a%a0%e8%bd%bd%e5%ae%9e","status":"publish","type":"post","link":"https:\/\/idc.net\/help\/442590\/","title":{"rendered":"\u5728\u6d77\u5916\u670d\u52a1\u5668\u4e0a\u90e8\u7f72Stable Diffusion\uff1aGPU\u5b9e\u4f8b\u914d\u7f6e\u4e0e\u6a21\u578b\u52a0\u8f7d\u5b9e\u64cd\u6559\u7a0b"},"content":{"rendered":"<p>Stable Diffusion \u662f\u76ee\u524d\u6700\u6d41\u884c\u7684\u5f00\u6e90 AI \u56fe\u50cf\u751f\u6210\u5de5\u5177\uff0c\u4f46\u5728\u672c\u5730\u8fd0\u884c\u5bf9\u663e\u5361\u8981\u6c42\u6781\u9ad8\uff08\u81f3\u5c11\u9700\u8981 8GB \u663e\u5b58\u7684 NVIDIA GPU\uff09\u3002\u5c06 Stable Diffusion \u90e8\u7f72\u5728<strong>\u6d77\u5916 GPU \u670d\u52a1\u5668<\/strong>\u4e0a\uff0c\u4e0d\u4ec5\u6446\u8131\u4e86\u672c\u5730\u786c\u4ef6\u9650\u5236\uff0c\u8fd8\u53ef\u4ee5\u901a\u8fc7\u6d4f\u89c8\u5668\u5728\u4efb\u4f55\u8bbe\u5907\u4e0a\u8bbf\u95ee\uff0c\u662f\u5f88\u591a\u8bbe\u8ba1\u5e08\u3001AI \u521b\u4e1a\u8005\u7684\u9009\u62e9\u3002\u672c\u6587\u63d0\u4f9b\u5b8c\u6574\u7684\u5b9e\u64cd\u6b65\u9aa4\u3002<\/p>\n<hr \/>\n<h2>\u4e00\u3001\u4e3a\u4ec0\u4e48\u9009\u62e9\u6d77\u5916\u670d\u52a1\u5668\u800c\u975e\u672c\u5730\u90e8\u7f72\uff1f<\/h2>\n<table style=\"border-collapse: collapse; width: 100%;\" border=\"1\" cellspacing=\"0\" cellpadding=\"8\">\n<thead>\n<tr style=\"background-color: #f5f5f5;\">\n<th>\u5bf9\u6bd4\u7ef4\u5ea6<\/th>\n<th>\u672c\u5730\u90e8\u7f72<\/th>\n<th>\u6d77\u5916\u670d\u52a1\u5668\u90e8\u7f72<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>\u786c\u4ef6\u6210\u672c<\/td>\n<td>\u8d2d\u4e70 GPU \u9700 5000~30000 \u5143<\/td>\n<td>\u6309\u9700\u4ed8\u8d39\uff0c\u65e0\u9700\u8d2d\u7f6e\u786c\u4ef6<\/td>\n<\/tr>\n<tr>\n<td>\u663e\u5b58\u9650\u5236<\/td>\n<td>\u53d7\u9650\u4e8e\u672c\u5730\u663e\u5361\u663e\u5b58<\/td>\n<td>\u53ef\u9009 16GB\u300124GB\u300180GB \u663e\u5b58\u5b9e\u4f8b<\/td>\n<\/tr>\n<tr>\n<td>\u8bbf\u95ee\u65b9\u5f0f<\/td>\n<td>\u4ec5\u9650\u672c\u673a<\/td>\n<td>\u4efb\u610f\u8bbe\u5907\u6d4f\u89c8\u5668\u8bbf\u95ee<\/td>\n<\/tr>\n<tr>\n<td>\u6a21\u578b\u4e0b\u8f7d\u901f\u5ea6<\/td>\n<td>\u53d7\u56fd\u5185\u7f51\u7edc\u9650\u5236\uff0c\u6781\u6162<\/td>\n<td>\u6d77\u5916\u670d\u52a1\u5668\u76f4\u8fde HuggingFace\/CivitAI\uff0c\u9ad8\u901f<\/td>\n<\/tr>\n<tr>\n<td>\u6301\u7eed\u8fd0\u884c<\/td>\n<td>\u4f9d\u8d56\u672c\u5730\u7535\u8111\u5f00\u673a<\/td>\n<td>24\u5c0f\u65f6\u7a33\u5b9a\u8fd0\u884c<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<hr \/>\n<h2>\u4e8c\u3001\u670d\u52a1\u5668\u9009\u578b\uff1a\u9700\u8981\u4ec0\u4e48\u914d\u7f6e\uff1f<\/h2>\n<h3>\u6700\u4f4e\u53ef\u7528\u914d\u7f6e<\/h3>\n<ul>\n<li>GPU\uff1aNVIDIA T4\uff0816GB \u663e\u5b58\uff09<\/li>\n<li>CPU\uff1a8\u6838<\/li>\n<li>\u5185\u5b58\uff1a32GB<\/li>\n<li>\u786c\u76d8\uff1a100GB SSD\uff08\u6a21\u578b\u6587\u4ef6\u901a\u5e38\u6bcf\u4e2a 2~7GB\uff09<\/li>\n<li>\u9002\u5408\uff1a\u751f\u6210 512\u00d7512 \u6216 768\u00d7768 \u56fe\u7247\uff0c\u901f\u5ea6\u7ea6 10~20\u79d2\/\u5f20<\/li>\n<\/ul>\n<h3>\u63a8\u8350\u751f\u4ea7\u914d\u7f6e<\/h3>\n<ul>\n<li>GPU\uff1aNVIDIA A10G\uff0824GB \u663e\u5b58\uff09\u6216 RTX 3090\/4090<\/li>\n<li>CPU\uff1a16\u6838<\/li>\n<li>\u5185\u5b58\uff1a64GB<\/li>\n<li>\u786c\u76d8\uff1a500GB SSD\uff08\u5b58\u653e\u591a\u4e2a\u6a21\u578b\u548c LoRA\uff09<\/li>\n<li>\u9002\u5408\uff1a1024\u00d71024 \u9ad8\u5206\u56fe\u7247\uff0c\u901f\u5ea6\u7ea6 3~8\u79d2\/\u5f20\uff0c\u652f\u6301\u591a\u4eba\u5e76\u53d1<\/li>\n<\/ul>\n<h3>\u7cfb\u7edf\u9009\u62e9<\/h3>\n<p>\u63a8\u8350 <strong>Ubuntu 22.04 LTS<\/strong>\uff0cNVIDIA \u9a71\u52a8\u548c CUDA \u517c\u5bb9\u6027\u6700\u597d\uff0c\u793e\u533a\u6587\u6863\u6700\u4e30\u5bcc\u3002<\/p>\n<hr \/>\n<h2>\u4e09\u3001\u73af\u5883\u914d\u7f6e\uff1aCUDA + Python + \u4f9d\u8d56\u5b89\u88c5<\/h2>\n<h3>Step 1\uff1a\u66f4\u65b0\u7cfb\u7edf\u5e76\u5b89\u88c5\u57fa\u7840\u5de5\u5177<\/h3>\n<pre><code>sudo apt update &amp;&amp; sudo apt upgrade -y\r\nsudo apt install -y git wget curl build-essential libgl1 libglib2.0-0<\/code><\/pre>\n<h3>Step 2\uff1a\u5b89\u88c5 NVIDIA \u9a71\u52a8\uff08\u5982\u679c\u672a\u9884\u88c5\uff09<\/h3>\n<pre><code># \u67e5\u770b\u63a8\u8350\u9a71\u52a8\u7248\u672c\r\nubuntu-drivers devices\r\n\r\n# \u81ea\u52a8\u5b89\u88c5\u63a8\u8350\u9a71\u52a8\r\nsudo ubuntu-drivers autoinstall\r\nsudo reboot<\/code><\/pre>\n<p>\u91cd\u542f\u540e\u9a8c\u8bc1\u9a71\u52a8\u5b89\u88c5\uff1a<\/p>\n<pre><code>nvidia-smi<\/code><\/pre>\n<p>\u80fd\u770b\u5230 GPU \u4fe1\u606f\uff08\u663e\u5b58\u5927\u5c0f\u3001\u9a71\u52a8\u7248\u672c\uff09\u8bf4\u660e\u6210\u529f\u3002<\/p>\n<h3>Step 3\uff1a\u5b89\u88c5 Python 3.10<\/h3>\n<pre><code>sudo apt install -y python3.10 python3.10-venv python3.10-dev python3-pip\r\npython3.10 --version   # \u786e\u8ba4\u7248\u672c<\/code><\/pre>\n<hr \/>\n<h2>\u56db\u3001\u5b89\u88c5 Stable Diffusion WebUI\uff08AUTOMATIC1111 \u7248\u672c\uff09<\/h2>\n<p>AUTOMATIC1111 \u662f\u6700\u4e3b\u6d41\u7684 Stable Diffusion \u524d\u7aef\uff0c\u529f\u80fd\u6700\u5168\uff0c\u63d2\u4ef6\u751f\u6001\u6700\u4e30\u5bcc\u3002<\/p>\n<h3>Step 1\uff1a\u514b\u9686\u4ed3\u5e93<\/h3>\n<pre><code>cd ~\r\ngit clone https:\/\/github.com\/AUTOMATIC1111\/stable-diffusion-webui.git\r\ncd stable-diffusion-webui<\/code><\/pre>\n<h3>Step 2\uff1a\u4e0b\u8f7d\u57fa\u7840\u6a21\u578b<\/h3>\n<p>\u6d77\u5916\u670d\u52a1\u5668\u53ef\u4ee5\u76f4\u63a5\u9ad8\u901f\u8bbf\u95ee HuggingFace\uff0c\u4e0b\u8f7d\u901f\u5ea6\u901a\u5e38\u5728 50~200MB\/s\uff1a<\/p>\n<pre><code>cd models\/Stable-diffusion\r\n\r\n# \u4e0b\u8f7d SDXL 1.0 \u57fa\u7840\u6a21\u578b\uff08\u7ea6 6.5GB\uff09\r\nwget https:\/\/huggingface.co\/stabilityai\/stable-diffusion-xl-base-1.0\/resolve\/main\/sd_xl_base_1.0.safetensors\r\n\r\n# \u6216\u4e0b\u8f7d\u7ecf\u5178\u7684 SD 1.5 \u6a21\u578b\uff08\u7ea6 4GB\uff09\r\nwget https:\/\/huggingface.co\/runwayml\/stable-diffusion-v1-5\/resolve\/main\/v1-5-pruned-emaonly.safetensors<\/code><\/pre>\n<h3>Step 3\uff1a\u9996\u6b21\u542f\u52a8\uff08\u81ea\u52a8\u5b89\u88c5\u4f9d\u8d56\uff09<\/h3>\n<pre><code>cd ~\/stable-diffusion-webui\r\n\r\n# \u542f\u52a8\u811a\u672c\u4f1a\u81ea\u52a8\u521b\u5efa\u865a\u62df\u73af\u5883\u5e76\u5b89\u88c5\u6240\u6709\u4f9d\u8d56\r\nbash webui.sh --listen --port 7860 --enable-insecure-extension-access<\/code><\/pre>\n<p>\u53c2\u6570\u8bf4\u660e\uff1a<\/p>\n<ul>\n<li><code>--listen<\/code>\uff1a\u76d1\u542c\u6240\u6709\u7f51\u5361\uff08\u5141\u8bb8\u5916\u90e8\u8bbf\u95ee\uff0c\u4e0d\u52a0\u6b64\u53c2\u6570\u53ea\u80fd\u672c\u673a\u8bbf\u95ee\uff09<\/li>\n<li><code>--port 7860<\/code>\uff1a\u6307\u5b9a\u7aef\u53e3<\/li>\n<li><code>--enable-insecure-extension-access<\/code>\uff1a\u5141\u8bb8\u5b89\u88c5\u63d2\u4ef6<\/li>\n<\/ul>\n<p>\u9996\u6b21\u542f\u52a8\u9700\u8981\u4e0b\u8f7d\u7ea6 2~5GB \u7684\u4f9d\u8d56\u5305\uff0c\u6d77\u5916\u670d\u52a1\u5668\u901a\u5e38 5~15 \u5206\u949f\u5b8c\u6210\u3002\u770b\u5230 <code>Running on local URL: http:\/\/0.0.0.0:7860<\/code> \u8868\u793a\u542f\u52a8\u6210\u529f\u3002<\/p>\n<hr \/>\n<h2>\u4e94\u3001\u8bbe\u7f6e\u8fdc\u7a0b\u8bbf\u95ee\u4e0e\u5b89\u5168\u9632\u62a4<\/h2>\n<h3>\u65b9\u6848\u4e00\uff1a\u76f4\u63a5 IP \u8bbf\u95ee\uff08\u5feb\u901f\u6d4b\u8bd5\u7528\uff09<\/h3>\n<p>\u6d4f\u89c8\u5668\u8bbf\u95ee <code>http:\/\/\u4f60\u7684\u670d\u52a1\u5668IP:7860<\/code> \u5373\u53ef\u6253\u5f00 WebUI\u3002\u9002\u5408\u4e34\u65f6\u6d4b\u8bd5\uff0c\u4e0d\u5efa\u8bae\u957f\u671f\u4f7f\u7528\uff08\u65e0 HTTPS\uff0c\u5b89\u5168\u6027\u4f4e\uff09\u3002<\/p>\n<h3>\u65b9\u6848\u4e8c\uff1aNginx \u53cd\u5411\u4ee3\u7406 + HTTPS\uff08\u63a8\u8350\u751f\u4ea7\u73af\u5883\uff09<\/h3>\n<pre><code># \u5b89\u88c5 Nginx \u548c Certbot\r\nsudo apt install nginx certbot python3-certbot-nginx -y\r\n\r\n# \u521b\u5efa Nginx \u914d\u7f6e\r\nsudo nano \/etc\/nginx\/sites-available\/sd.yourdomain.com<\/code><\/pre>\n<pre><code>server {\r\n    listen 80;\r\n    server_name sd.yourdomain.com;\r\n\r\n    location \/ {\r\n        proxy_pass http:\/\/127.0.0.1:7860;\r\n        proxy_set_header Host $host;\r\n        proxy_set_header X-Real-IP $remote_addr;\r\n        proxy_read_timeout 300;    # SD \u751f\u56fe\u9700\u8981\u8f83\u957f\u65f6\u95f4\uff0c\u589e\u5927\u8d85\u65f6\r\n        proxy_send_timeout 300;\r\n    }\r\n}<\/code><\/pre>\n<pre><code>sudo ln -s \/etc\/nginx\/sites-available\/sd.yourdomain.com \/etc\/nginx\/sites-enabled\/\r\nsudo nginx -t &amp;&amp; sudo systemctl reload nginx\r\nsudo certbot --nginx -d sd.yourdomain.com<\/code><\/pre>\n<h3>\u65b9\u6848\u4e09\uff1a\u6dfb\u52a0\u8bbf\u95ee\u5bc6\u7801\uff08\u9632\u6b62\u964c\u751f\u4eba\u4f7f\u7528\uff09<\/h3>\n<p>\u542f\u52a8\u65f6\u6dfb\u52a0 <code>--gradio-auth<\/code> \u53c2\u6570\uff1a<\/p>\n<pre><code>bash webui.sh --listen --port 7860 --gradio-auth username:password<\/code><\/pre>\n<hr \/>\n<h2>\u516d\u3001\u540e\u53f0\u6301\u4e45\u8fd0\u884c\uff1a\u7528 tmux \u9632\u6b62 SSH \u65ad\u7ebf\u505c\u6b62<\/h2>\n<pre><code># \u5b89\u88c5 tmux\r\nsudo apt install tmux -y\r\n\r\n# \u521b\u5efa\u65b0 session\r\ntmux new -s sd\r\n\r\n# \u5728 tmux \u4e2d\u542f\u52a8 WebUI\r\nbash webui.sh --listen --port 7860\r\n\r\n# \u65ad\u5f00 SSH \u65f6\u6309 Ctrl+B \u7136\u540e\u6309 D\uff08detach\uff09\uff0c\u7a0b\u5e8f\u7ee7\u7eed\u540e\u53f0\u8fd0\u884c\r\n# \u4e0b\u6b21 SSH \u767b\u5f55\u540e\u6062\u590d session\uff1a\r\ntmux attach -t sd<\/code><\/pre>\n<hr \/>\n<h2>\u4e03\u3001\u5e38\u7528\u6a21\u578b\u548c\u63d2\u4ef6\u63a8\u8350<\/h2>\n<h3>\u70ed\u95e8\u6a21\u578b\uff08\u53ef\u5728 CivitAI \u4e0b\u8f7d\uff0c\u6d77\u5916\u670d\u52a1\u5668\u4e0b\u8f7d\u6781\u5feb\uff09<\/h3>\n<ul>\n<li><strong>Realistic Vision<\/strong>\uff1a\u7167\u7247\u7ea7\u771f\u5b9e\u4eba\u50cf\uff0c\u6548\u679c\u51fa\u8272<\/li>\n<li><strong>DreamShaper XL<\/strong>\uff1a\u7efc\u5408\u6027\u80fd\u5f3a\uff0c\u9002\u5408\u5404\u7c7b\u98ce\u683c<\/li>\n<li><strong>SDXL Turbo<\/strong>\uff1a\u6781\u901f\u751f\u56fe\uff0c1~4\u6b65\u5373\u53ef\u51fa\u56fe<\/li>\n<li><strong>CounterfeitXL<\/strong>\uff1a\u4e8c\u6b21\u5143\/\u52a8\u6f2b\u98ce\u683c\u9996\u9009<\/li>\n<\/ul>\n<h3>\u5fc5\u88c5\u63d2\u4ef6<\/h3>\n<ul>\n<li><strong>ControlNet<\/strong>\uff1a\u7cbe\u786e\u63a7\u5236\u56fe\u50cf\u6784\u56fe\u548c\u59ff\u6001\uff0c\u5546\u4e1a\u7528\u9014\u5fc5\u88c5<\/li>\n<li><strong>ADetailer<\/strong>\uff1a\u81ea\u52a8\u4fee\u590d\u4eba\u8138\u7ec6\u8282\uff0c\u63d0\u5347\u4eba\u50cf\u8d28\u91cf<\/li>\n<li><strong>Ultimate SD Upscale<\/strong>\uff1a\u8d85\u5206\u8fa8\u7387\u653e\u5927\uff0c\u652f\u6301 4K \u8f93\u51fa<\/li>\n<\/ul>\n<hr \/>\n<h2>\u603b\u7ed3<\/h2>\n<p>\u5728\u6d77\u5916\u670d\u52a1\u5668\u4e0a\u90e8\u7f72 Stable Diffusion \u7684\u6838\u5fc3\u4f18\u52bf\u662f\uff1a\u6446\u8131\u672c\u5730\u786c\u4ef6\u9650\u5236\u3001\u6a21\u578b\u4e0b\u8f7d\u6781\u901f\u3001\u968f\u65f6\u968f\u5730\u6d4f\u89c8\u5668\u8bbf\u95ee\u3002\u6574\u5957\u6d41\u7a0b\u4ece\u670d\u52a1\u5668\u8d2d\u4e70\u5230 WebUI \u53ef\u7528\uff0c\u901a\u5e38\u5728 1~2 \u5c0f\u65f6\u5185\u5b8c\u6210\u3002<\/p>\n<p>\u5982\u9700\u9ad8\u6027\u80fd GPU \u670d\u52a1\u5668\u6216\u7a33\u5b9a\u7684\u6d77\u5916 VPS \u4f5c\u4e3a SD \u90e8\u7f72\u57fa\u7840\uff0c\u6b22\u8fce\u67e5\u770b<a title=\"\u540e\u6d6a\u4e91\u670d\u52a1\u5668\" href=\"https:\/\/idc.net\/\">\u540e\u6d6a\u4e91\u670d\u52a1\u5668<\/a>\u65b9\u6848\uff0c\u652f\u6301\u652f\u4ed8\u5b9d\u4ed8\u6b3e\uff0c\u6280\u672f\u95ee\u9898\u53ef\u901a\u8fc7 Telegram \u6216\u5de5\u5355\u8054\u7cfb\u6211\u4eec\u7684\u5de5\u7a0b\u5e08\u56e2\u961f\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Stable Diffusion \u662f\u76ee\u524d\u6700\u6d41\u884c\u7684\u5f00\u6e90 AI \u56fe\u50cf\u751f\u6210\u5de5\u5177\uff0c\u4f46\u5728\u672c\u5730\u8fd0\u884c\u5bf9\u663e\u5361\u8981\u6c42\u6781\u9ad8\uff08\u81f3\u5c11\u9700\u8981 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[202646,6979],"tags":[],"class_list":["post-442590","post","type-post","status-publish","format-standard","hentry","category-hkserver","category-product"],"_links":{"self":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/posts\/442590","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/comments?post=442590"}],"version-history":[{"count":1,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/posts\/442590\/revisions"}],"predecessor-version":[{"id":442591,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/posts\/442590\/revisions\/442591"}],"wp:attachment":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/media?parent=442590"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/categories?post=442590"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/tags?post=442590"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}