{"id":15014,"date":"2023-05-29T20:41:09","date_gmt":"2023-05-29T12:41:09","guid":{"rendered":"http:\/\/139.9.1.231\/?p=15014"},"modified":"2023-07-14T17:05:46","modified_gmt":"2023-07-14T09:05:46","slug":"stable-diffusion-2","status":"publish","type":"post","link":"http:\/\/139.9.1.231\/index.php\/2023\/05\/29\/stable-diffusion-2\/","title":{"rendered":"Stable-diffusion"},"content":{"rendered":"\n<h1>Stable Diffusion<\/h1>\n\n\n\n<p>          <em>Stable Diffusion was made possible thanks to a collaboration with&nbsp;<a href=\"https:\/\/stability.ai\/\">Stability AI<\/a>&nbsp;and&nbsp;<a href=\"https:\/\/runwayml.com\/\">Runway<\/a>&nbsp;and builds upon our previous work:<\/em><\/p>\n\n\n\n<p class=\"has-light-pink-background-color has-background\"><a href=\"https:\/\/ommer-lab.com\/research\/latent-diffusion-models\/\"><strong>High-Resolution Image Synthesis with Latent Diffusion Models<\/strong><\/a><br><a href=\"https:\/\/github.com\/rromb\">Robin Rombach<\/a>*,&nbsp;<a href=\"https:\/\/github.com\/ablattmann\">Andreas Blattmann<\/a>*,&nbsp;<a href=\"https:\/\/github.com\/qp-qp\">Dominik Lorenz<\/a>,&nbsp;<a href=\"https:\/\/github.com\/pesser\">Patrick Esser<\/a>,&nbsp;<a href=\"https:\/\/hci.iwr.uni-heidelberg.de\/Staff\/bommer\">Bj\u00f6rn Ommer<\/a><br><em><a href=\"https:\/\/openaccess.thecvf.com\/content\/CVPR2022\/html\/Rombach_High-Resolution_Image_Synthesis_With_Latent_Diffusion_Models_CVPR_2022_paper.html\">CVPR &#8217;22 Oral<\/a>&nbsp;|&nbsp;<a href=\"https:\/\/github.com\/CompVis\/latent-diffusion\">GitHub<\/a>&nbsp;|&nbsp;<a href=\"https:\/\/arxiv.org\/abs\/2112.10752\">arXiv<\/a>&nbsp;|&nbsp;<a href=\"https:\/\/ommer-lab.com\/research\/latent-diffusion-models\/\">Project page<\/a><\/em><\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" width=\"1024\" height=\"368\" src=\"http:\/\/139.9.1.231\/wp-content\/uploads\/2023\/04\/image-35-1024x368.png\" alt=\"\" class=\"wp-image-15017\" srcset=\"http:\/\/139.9.1.231\/wp-content\/uploads\/2023\/04\/image-35-1024x368.png 1024w, http:\/\/139.9.1.231\/wp-content\/uploads\/2023\/04\/image-35-300x108.png 300w, http:\/\/139.9.1.231\/wp-content\/uploads\/2023\/04\/image-35-768x276.png 768w, http:\/\/139.9.1.231\/wp-content\/uploads\/2023\/04\/image-35.png 1313w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" width=\"1024\" height=\"577\" src=\"http:\/\/139.9.1.231\/wp-content\/uploads\/2023\/04\/image-36-1024x577.png\" alt=\"\" class=\"wp-image-15019\" srcset=\"http:\/\/139.9.1.231\/wp-content\/uploads\/2023\/04\/image-36-1024x577.png 1024w, http:\/\/139.9.1.231\/wp-content\/uploads\/2023\/04\/image-36-300x169.png 300w, http:\/\/139.9.1.231\/wp-content\/uploads\/2023\/04\/image-36-768x433.png 768w, http:\/\/139.9.1.231\/wp-content\/uploads\/2023\/04\/image-36.png 1337w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p class=\"has-text-align-center has-yellow-background-color has-background\"><strong>\u53c2\u8003\uff1a <a one-link-mark=\"yes\" href=\"https:\/\/zhuanlan.zhihu.com\/p\/573984443\">https:\/\/zhuanlan.zhihu.com\/p\/573984443<\/a><\/strong><\/p>\n\n\n\n<p class=\"has-text-align-center has-bright-blue-background-color has-background\"> <strong>\u53c2\u8003\uff1a<\/strong> <a href=\"https:\/\/zhuanlan.zhihu.com\/p\/599160988\">https:\/\/zhuanlan.zhihu.com\/p\/599160988<\/a><\/p>\n\n\n\n<p class=\"has-bright-blue-background-color has-background has-normal-font-size\">\u6269\u6563\u6a21\u578b\u6c47\u603b \uff1a<a href=\"https:\/\/github.com\/heejkoo\/Awesome-Diffusion-Models\">https:\/\/github.com\/heejkoo\/Awesome-Diffusion-Models<\/a><\/p>\n\n\n\n<p>            DDPM \u6a21\u578b\u5728\u751f\u6210\u56fe\u50cf\u8d28\u91cf\u4e0a\u6548\u679c\u5df2\u7ecf\u975e\u5e38\u597d\uff0c\u4f46\u5b83\u4e5f\u6709\u4e2a\u7f3a\u70b9\uff0c \u90a3\u5c31\u662fxt\u00a0\u7684\u5c3a\u5bf8\u662f\u548c\u56fe\u7247\u4e00\u81f4\u7684\uff0cxt\u7684\u5143\u7d20\u548c\u56fe\u7247\u7684\u50cf\u7d20\u662f\u4e00\u4e00\u5bf9\u5e94\u7684\uff0c \u6240\u4ee5\u79f0 DDPM \u662f\u50cf\u7d20(pixel)\u7a7a\u95f4\u7684\u751f\u6210\u6a21\u578b\u3002 \u6211\u4eec\u77e5\u9053\u4e00\u5f20\u56fe\u7247\u7684\u5c3a\u5bf8\u662f\u00a03\u00d7H\u00d7W\u00a0\uff0c\u5982\u679c\u60f3\u751f\u6210\u4e00\u5f20\u9ad8\u5c3a\u5bf8\u7684\u56fe\u50cf\uff0c\u00a0Xt\u7684\u5f20\u91cf\u5927\u5c0f\u662f\u975e\u5e38\u5927\u7684\uff0c\u8fd9\u5c31\u9700\u8981\u6781\u5927\u7684\u663e\u5361\uff08\u786c\u4ef6\uff09\u8d44\u6e90\uff0c\u5305\u62ec\u8ba1\u7b97\u8d44\u6e90\u548c\u663e\u5b58\u8d44\u6e90\u3002 \u540c\u6837\u7684\uff0c\u5b83\u7684\u8bad\u7ec3\u6210\u672c\u4e5f\u662f\u9ad8\u6602\u7684\u3002\u9ad8\u6602\u7684\u6210\u672c\u6781\u5927\u7684\u9650\u5236\u4e86\u5b83\u5728\u6c11\u7528\u9886\u7528\u7684\u53d1\u5c55\u3002<\/p>\n\n\n\n<h3>1.\u00a0\u6f5c\u5728\u6269\u6563\u6a21\u578b\uff08Latent diffusion model,LDM\uff09<\/h3>\n\n\n\n<p>           2021\u5e74\u5fb7\u56fd\u6155\u5c3c\u9ed1\u8def\u5fb7\u7ef4\u5e0c-\u9a6c\u514b\u897f\u7c73\u5229\u5b89\u5927\u5b66\u8ba1\u7b97\u673a\u89c6\u89c9\u548c\u5b66\u4e60\u7814\u7a76\u5c0f\u7ec4\uff08\u539f\u6d77\u5fb7\u5821\u5927\u5b66\u8ba1\u7b97\u673a\u89c6\u89c9\u5c0f\u7ec4\uff09\uff0c \u7b80\u79f0 CompVis \u5c0f\u7ec4\uff0c\u53d1\u5e03\u4e86\u8bba\u6587\u00a0High-Resolution Image Synthesis with Latent Diffusion Models\uff0c\u9488\u5bf9\u8fd9\u4e2a\u95ee\u9898\u505a\u4e86\u4e00\u4e9b\u6539\u8fdb\uff0c \u4e3b\u8981\u7684\u6539\u8fdb\u70b9\u6709\uff1a<\/p>\n\n\n\n<ul><li>\u5f15\u5165\u4e00\u4e2a\u81ea\u7f16\u7801\u5668\uff0c\u5148\u5bf9\u539f\u59cb\u5bf9\u8c61\u8fdb\u884c\u538b\u7f29\u7f16\u7801\uff0c\u7f16\u7801\u540e\u7684\u5411\u91cf\u518d\u5e94\u7528\u5230\u6269\u6563\u6a21\u578b\u3002<\/li><li>\u901a\u8fc7\u5728 UNET \u4e2d\u52a0\u5165 Attention \u673a\u5236\uff0c\u5904\u7406\u6761\u4ef6\u53d8\u91cf\u00a0y\u3002<\/li><\/ul>\n\n\n\n<p><strong>\u6f5c\u5728\u7a7a\u95f4<\/strong><\/p>\n\n\n\n<p class=\"has-yellow-background-color has-background\">      \u9488\u5bf9 DDPM \u6d88\u8017\u8d44\u6e90\u7684\u95ee\u9898\uff0c\u89e3\u51b3\u65b9\u6cd5\u4e5f\u7b80\u5355\u3002<strong> \u5f15\u5165\u4e00\u4e2a\u81ea\u7f16\u7801\u5668\uff0c\u6bd4\u5982\u4e0a\u4e00\u7ae0\u4ecb\u7ecd\u7684\u53d8\u5206\u7f16\u7801\u5668\uff08VAE\uff09\uff0c\u5148\u5bf9\u539f\u59cb\u56fe\u50cf\u8fdb\u884c\u538b\u7f29\u7f16\u7801\uff0c\u5f97\u5230\u56fe\u50cf\u7684\u4f4e\u7ef4\u8868\u793a\u00a0z0\u00a0\uff0c\u7136\u540e\u00a0x0\u00a0\u4f5c\u4e3a DDPM \u7684\u8f93\u5165\uff0c\u6267\u884c DDPM \u7684\u7b97\u6cd5\u8fc7\u7a0b\uff0cDDPM \u751f\u6210\u7684\u7ed3\u679c\u518d\u7ecf\u8fc7\u89e3\u7801\u5668\u8fd8\u539f\u6210\u56fe\u50cf\u3002 \u7531\u4e8e\u00a0z0\u00a0\u662f\u538b\u7f29\u8fc7\u7684\uff0c\u5176\u5c3a\u5bf8\u8fdc\u8fdc\u5c0f\u4e8e\u539f\u59cb\u7684\u56fe\u50cf\uff0c\u8fd9\u6837\u5c31\u80fd\u6781\u5927\u7684\u51cf\u5c11 DDPM \u8d44\u6e90\u7684\u6d88\u8017\u3002 \u538b\u7f29\u540e\u00a0z0\u00a0\u6240\u5728\u7684\u6570\u636e\u7a7a\u95f4\u79f0\u4e3a\u6f5c\u5728\u7a7a\u95f4\uff08latent space\uff09,\u00a0z0\u00a0\u53ef\u4ee5\u79f0\u4e3a\u6f5c\u5728\u6570\u636e<\/strong>\u3002<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><img loading=\"lazy\" width=\"446\" height=\"217\" src=\"http:\/\/139.9.1.231\/wp-content\/uploads\/2023\/07\/image-9.png\" alt=\"\" class=\"wp-image-15328\" srcset=\"http:\/\/139.9.1.231\/wp-content\/uploads\/2023\/07\/image-9.png 446w, http:\/\/139.9.1.231\/wp-content\/uploads\/2023\/07\/image-9-300x146.png 300w\" sizes=\"(max-width: 446px) 100vw, 446px\" \/><\/figure><\/div>\n\n\n\n<p>       \u8fd9\u4e2a\u81ea\u7f16\u7801\u5668\uff08VAE\uff09\u53ef\u4ee5\u662f\u63d0\u524d\u9884\u8bad\u7ec3\u597d\u7684\u6a21\u578b\uff0c\u5728\u8bad\u7ec3\u6269\u6563\u6a21\u578b\u65f6\uff0c\u81ea\u7f16\u7801\u5668\u7684\u53c2\u6570\u662f\u51bb\u4f4f\u7684\uff0c \u5982\u00a0\u56fe 7.1.2\u00a0\u6240\u793a<\/p>\n\n\n\n<ul><li>\u901a\u8fc7\u4f7f\u7528\u9884\u8bad\u7ec3\u7684\u7f16\u7801\u5668\u00a0E\uff0c\u6211\u4eec\u53ef\u4ee5\u5c06\u5168\u5c3a\u5bf8\u56fe\u50cf\u7f16\u7801\u4e3a\u4f4e\u7ef4\u6f5c\u5728\u7a7a\u95f4\u6570\u636e\uff08\u538b\u7f29\u6570\u636e\uff09\u3002<\/li><li>\u901a\u8fc7\u4f7f\u7528\u9884\u8bad\u7ec3\u7684\u89e3\u7801\u5668\u00a0D\uff0c\u6211\u4eec\u53ef\u4ee5\u5c06\u6f5c\u5728\u7a7a\u95f4\u6570\u636e\u89e3\u7801\u56de\u56fe\u50cf\u3002<\/li><\/ul>\n\n\n\n<p>\u8fd9\u6837\u5728 DDPM \u5916\u5c42\u589e\u52a0\u4e00\u4e2a VAE \u540e\uff0cDDPM \u7684\u6269\u6563\u8fc7\u7a0b\u548c\u964d\u566a\u8fc7\u7a0b\u90fd\u662f\u5728\u6f5c\u7a7a\u95f4\uff08Latent Space\uff09\u8fdb\u884c\uff0c \u6f5c\u7a7a\u95f4\u7684\u5c3a\u5bf8\u8fdc\u8fdc\u5c0f\u4e8e\u50cf\u7d20\u7a7a\u95f4\uff0c\u6781\u5927\u4e86\u964d\u4f4e\u4e86\u786c\u4ef6\u8d44\u6e90\u7684\u9700\u6c42\uff0c\u540c\u65f6\u4e5f\u80fd\u52a0\u901f\u6574\u4e2a\u8fc7\u7a0b\u3002<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><img loading=\"lazy\" width=\"527\" height=\"402\" src=\"http:\/\/139.9.1.231\/wp-content\/uploads\/2023\/07\/image-10.png\" alt=\"\" class=\"wp-image-15332\" srcset=\"http:\/\/139.9.1.231\/wp-content\/uploads\/2023\/07\/image-10.png 527w, http:\/\/139.9.1.231\/wp-content\/uploads\/2023\/07\/image-10-300x229.png 300w\" sizes=\"(max-width: 527px) 100vw, 527px\" \/><\/figure><\/div>\n\n\n\n<p>           \u6b63\u5411\u6269\u6563\u8fc7\u7a0b\u2192\u7ed9\u6f5c\u5728\u6570\u636e\u589e\u52a0\u566a\u58f0\uff0c\u9006\u5411\u6269\u6563\u8fc7\u7a0b\u2192\u4ece\u6f5c\u5728\u6570\u636e\u4e2d\u6d88\u9664\u566a\u58f0\u3002 \u6574\u4e2a DDPM \u7684\u8fc7\u7a0b\u90fd\u662f\u5728\u6f5c\u5728\u7a7a\u95f4\u6267\u884c\u7684\uff0c \u6240\u4ee5\u8fd9\u4e2a\u7b97\u6cd5\u88ab\u79f0\u4e3a\u6f5c\u5728\u6269\u6563\u6a21\u578b\uff08Latent diffusion model,LDM\uff09\u3002\u589e\u52a0\u4e00\u4e2a\u81ea\u7f16\u7801\u5668\u5e76\u6ca1\u6709\u6539\u53d8 DDPM \u7684\u7b97\u6cd5\u8fc7\u7a0b\uff0c\u6240\u4ee5\u5e76\u4e0d\u9700\u8981\u5bf9 DDPM \u7b97\u6cd5\u4ee3\u7801\u505a\u4efb\u4f55\u6539\u52a8\u3002<\/p>\n\n\n\n<p class=\"has-light-pink-background-color has-background\"><strong>\u6761\u4ef6\u5904\u7406<\/strong><\/p>\n\n\n\n<p>\u5728 DDPM \u7684\u8fc7\u7a0b\u4e2d\uff0c\u53ef\u4ee5\u589e\u52a0\u989d\u5916\u7684\u6307\u5bfc\u4fe1\u606f\uff0c\u4f7f\u5176\u751f\u6210\u6211\u4eec\u7684\u60f3\u8981\u7684\u56fe\u50cf\uff0c \u6bd4\u5982\u6587\u672c\u751f\u6210\u56fe\u50cf\u3001\u56fe\u50cf\u751f\u6210\u56fe\u50cf\u7b49\u7b49\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" width=\"701\" height=\"357\" src=\"http:\/\/139.9.1.231\/wp-content\/uploads\/2023\/07\/image-11.png\" alt=\"\" class=\"wp-image-15335\" srcset=\"http:\/\/139.9.1.231\/wp-content\/uploads\/2023\/07\/image-11.png 701w, http:\/\/139.9.1.231\/wp-content\/uploads\/2023\/07\/image-11-300x153.png 300w\" sizes=\"(max-width: 701px) 100vw, 701px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" width=\"1024\" height=\"444\" src=\"http:\/\/139.9.1.231\/wp-content\/uploads\/2023\/07\/image-12-1024x444.png\" alt=\"\" class=\"wp-image-15336\" srcset=\"http:\/\/139.9.1.231\/wp-content\/uploads\/2023\/07\/image-12-1024x444.png 1024w, http:\/\/139.9.1.231\/wp-content\/uploads\/2023\/07\/image-12-300x130.png 300w, http:\/\/139.9.1.231\/wp-content\/uploads\/2023\/07\/image-12-768x333.png 768w, http:\/\/139.9.1.231\/wp-content\/uploads\/2023\/07\/image-12.png 1213w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p class=\"has-light-pink-background-color has-background\">        \u5173\u4e8e\u6ce8\u610f\u529b\u673a\u5236\u7684\u5b9e\u73b0\u7ec6\u8282\uff0c\u53ef\u4ee5\u76f4\u63a5\u53c2\u8003\u8bba\u6587\u4ee3\u7801\uff0c LDM\u6a21\u578b\u8bba\u6587\u7684\u4ee3\u7801\u548c\u9884\u8bad\u7ec3\u7684\u6a21\u578b\u5df2\u7ecf\u5728 Github \u5f00\u6e90\uff0c\u5730\u5740\u4e3a\uff1a\u00a0<a rel=\"noreferrer noopener\" href=\"https:\/\/github.com\/CompVis\/latent-diffusion\" target=\"_blank\">https:\/\/github.com\/CompVis\/latent-diffusion<\/a>\u00a0\u3002<\/p>\n\n\n\n<p><strong>\u8bad\u7ec3\u8fc7\u7a0b<\/strong><\/p>\n\n\n\n<p>\u76f8\u6bd4\u4e8e DDPM \uff0c\u6761\u4ef6\u5316\u7684 LDM \u76ee\u6807\u51fd\u6570\u7a0d\u5fae\u53d8\u5316\u4e86\u4e00\u70b9\uff0c\u5177\u4f53\u53d8\u5316\u5185\u5bb9\u53ef\u4ee5\u53c2\u8003:<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full is-resized\"><img loading=\"lazy\" src=\"http:\/\/139.9.1.231\/wp-content\/uploads\/2023\/07\/image-14.png\" alt=\"\" class=\"wp-image-15343\" width=\"502\" height=\"283\" srcset=\"http:\/\/139.9.1.231\/wp-content\/uploads\/2023\/07\/image-14.png 775w, http:\/\/139.9.1.231\/wp-content\/uploads\/2023\/07\/image-14-300x170.png 300w, http:\/\/139.9.1.231\/wp-content\/uploads\/2023\/07\/image-14-768x434.png 768w\" sizes=\"(max-width: 502px) 100vw, 502px\" \/><\/figure><\/div>\n\n\n\n<p><strong>\u751f\u6210\uff08\u91c7\u6837\uff09\u8fc7\u7a0b<\/strong>:<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img loading=\"lazy\" width=\"1024\" height=\"391\" src=\"http:\/\/139.9.1.231\/wp-content\/uploads\/2023\/07\/image-15-1024x391.png\" alt=\"\" class=\"wp-image-15345\" srcset=\"http:\/\/139.9.1.231\/wp-content\/uploads\/2023\/07\/image-15-1024x391.png 1024w, http:\/\/139.9.1.231\/wp-content\/uploads\/2023\/07\/image-15-300x115.png 300w, http:\/\/139.9.1.231\/wp-content\/uploads\/2023\/07\/image-15-768x293.png 768w, http:\/\/139.9.1.231\/wp-content\/uploads\/2023\/07\/image-15.png 1244w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure><\/div>\n\n\n\n<p>      \u56fe 7.1.6\u00a0\u662f LDM \u91c7\u6837\u8fc7\u7a0b\u7684\u56fe\u5f62\u5316\u8868\u793a\uff0c \u8fc7\u7a0b\u5e76\u4e0d\u590d\u6742\uff0c\u7ecf\u8fc7 DDPM \u91c7\u6837\u751f\u6210\u7684\u00a0Z0\u00a0\u9700\u8981\u7528\u89e3\u7801\u5668\u00a0D\u00a0\u8fd8\u539f\u6210\u56fe\u50cf\u3002<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full is-resized\"><img loading=\"lazy\" src=\"http:\/\/139.9.1.231\/wp-content\/uploads\/2023\/07\/image-16.png\" alt=\"\" class=\"wp-image-15350\" width=\"490\" height=\"268\" srcset=\"http:\/\/139.9.1.231\/wp-content\/uploads\/2023\/07\/image-16.png 895w, http:\/\/139.9.1.231\/wp-content\/uploads\/2023\/07\/image-16-300x165.png 300w, http:\/\/139.9.1.231\/wp-content\/uploads\/2023\/07\/image-16-768x421.png 768w\" sizes=\"(max-width: 490px) 100vw, 490px\" \/><\/figure><\/div>\n\n\n\n<h3>\u00a02\u3001\u7a33\u5b9a\u6269\u6563\u6a21\u578b\uff08Stable diffusion,SD)<\/h3>\n\n\n\n<p>       LDM \u672c\u8eab\u662f\u7531 CompVis \u63d0\u51fa\u5e76\u8054\u5408 Runway ML\u8fdb\u884c\u5f00\u53d1\u5b9e\u73b0\uff0c\u540e\u6765 Stability AI \u4e5f\u53c2\u4e0e\u8fdb\u6765\u5e76\u63d0\u4f9b\u4e86\u4e00\u4e9b\u8d44\u6e90\uff0c \u8054\u5408\u641e\u4e86\u4e00\u4e2a\u9884\u8bad\u7ec3\u7684 LDM \u6a21\u578b\uff0c\u79f0\u4e3a Stable diffusion\u3002 \u6240\u4ee5\uff0cStable diffusion \u662f LDM \u7684\u4e00\u4e2a\u5f00\u6e90\u9884\u8bad\u7ec3\u6a21\u578b\uff0c\u7531\u4e8e\u5b83\u7684\u5f00\u6e90\u8fc5\u901f\u706b\u7206\u8d77\u6765\u3002 \u76ee\u524d Stable diffusion \u5df2\u7ecf\u5360\u636e\u4e86\u56fe\u50cf\u751f\u6210\u5f00\u6e90\u9886\u57df\u7684\u4e3b\u5bfc\u5730\u4f4d\u3002<\/p>\n\n\n\n<p>       \u7531\u4e8e Stable diffusion \u53ea\u662fLDM\u7684\u4e00\u4e2a\u5f00\u6e90\u9884\u8bad\u7ec3\u6a21\u578b\uff0c\u6ca1\u6709\u989d\u5916\u7684\u590d\u6742\u6570\u5b66\u516c\u5f0f\u9700\u8981\u8ba8\u8bba\uff0c \u8fd9\u91cc\u6211\u4eec\u5c31\u76f4\u63a5\u4e0a\u4ee3\u7801\u5427\u3002 \u6211\u4eec\u4e0d\u7528 Stable diffusion \u7684\u5b98\u65b9\u4ee3\u7801\u5e93\u00a0<a href=\"https:\/\/github.com\/Stability-AI\/stablediffusion\">stablediffusion<\/a>\u00a0\uff0c\u800c\u662f huggingface \u5f00\u6e90\u5e93 diffusers \u4e2d\u7684\u5b9e\u73b0\uff0c \u5b83\u7684\u6613\u8bfb\u6027\u66f4\u597d\u4e00\u4e9b\u3002<\/p>\n\n\n\n<p>diffusers \u628a\u6a21\u578b\u7684\u6838\u5fc3\u903b\u8f91\u90fd\u5c01\u88c5\u5728\u5404\u79cd DiffusionPipeline \u4e2d\uff0c StableDiffusionPipeline \u6838\u5fc3\u4ee3\u7801\u5728&nbsp;<code>diffusers.StableDiffusionPipeline<\/code>&nbsp;\u5148\u770b\u521d\u59cb\u5316\u4ee3\u7801\uff0c\u53ef\u660e\u663e\u770b\u5230\u6574\u4e2a StableDiffusionPipeline \u5305\u542b\u51e0\u4e2a\u5173\u952e\u7ec4\u4ef6\uff1avae,text_encoder\/tokenizer,unet,scheduler\u3002 \u8fd9\u51e0\u4e2a\u7ec4\u4ef6\u548c LDM \u4e2d\u662f\u5bf9\u5e94\u7684\u3002<\/p>\n\n\n\n<ul><li>vae: VAE \u81ea\u7f16\u7801\u5668\uff0c\u8d1f\u8d23\u524d\u540e\u7684\u7f16\u89e3\u7801\uff08\u538b\u7f29\u3001\u89e3\u538b\u7f29\uff09\u5de5\u4f5c\u3002<\/li><li>text_encoder\/tokenizer: \u6587\u672c\u7f16\u7801\u5668\uff0c\u8d1f\u8d23\u5bf9\u6587\u672cPrompt\u8fdb\u884c\u7f16\u7801\u5904\u7406\u3002<\/li><li>unet: \u566a\u58f0\u9884\u6d4b\u6a21\u578b\uff0c\u4e5f\u662fDDPM\u7684\u6838\u5fc3\u3002<\/li><li>scheduler: \u8d1f\u8d23\u964d\u566a\u8fc7\u7a0b\uff08\u9006\u8fc7\u7a0b\uff09\u7684\u8ba1\u7b97\uff0c\u4e5f\u5c31\u662f\u5b9e\u73b0\u00a0xt\u2212>xt\u22121\u00a0\uff0c\u5bf9\u5e94\u7740 DDPM\u3001DDIM\u3001ODE\u7b49\u4e0d\u540c\u7684\u964d\u91c7\u6837\u5b9e\u73b0\u3002<\/li><li>safety_checker: \u505a\u751f\u6210\u56fe\u50cf\u5b89\u5168\u6027\u68c0\u67e5\u7684\uff0c\u53ef\u9009\uff0c\u6682\u65f6\u53ef\u4ee5\u4e0d\u5173\u6ce8\u5b83\u3002<\/li><li>feature_extractor: \u5982\u679c\u8f93\u5165\u6761\u4ef6\u4e2d\u5b58\u5728 img\uff0c\u4e5f\u5c31\u662f\u4ee5\u56fe\u751f\u56fe(img2img)\uff0c\u53ef\u4ee5\u7528\u5b83\u5bf9\u6761\u4ef6\u56fe\u7247\u8fdb\u884c\u7279\u5f81\u62bd\u53d6\uff0c\u4e5f\u5c31\u662f\u56fe\u50cf\u7f16\u7801\u5668\uff08img encoder\uff09\uff0c\u53ef\u9009\u3002<\/li><\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Stable Diffusion Stable Diffusion was made possible tha &hellip; <a href=\"http:\/\/139.9.1.231\/index.php\/2023\/05\/29\/stable-diffusion-2\/\" class=\"more-link\">\u7ee7\u7eed\u9605\u8bfb<span class=\"screen-reader-text\">Stable-diffusion<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[37,4,9],"tags":[],"_links":{"self":[{"href":"http:\/\/139.9.1.231\/index.php\/wp-json\/wp\/v2\/posts\/15014"}],"collection":[{"href":"http:\/\/139.9.1.231\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/139.9.1.231\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/139.9.1.231\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/139.9.1.231\/index.php\/wp-json\/wp\/v2\/comments?post=15014"}],"version-history":[{"count":37,"href":"http:\/\/139.9.1.231\/index.php\/wp-json\/wp\/v2\/posts\/15014\/revisions"}],"predecessor-version":[{"id":15355,"href":"http:\/\/139.9.1.231\/index.php\/wp-json\/wp\/v2\/posts\/15014\/revisions\/15355"}],"wp:attachment":[{"href":"http:\/\/139.9.1.231\/index.php\/wp-json\/wp\/v2\/media?parent=15014"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/139.9.1.231\/index.php\/wp-json\/wp\/v2\/categories?post=15014"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/139.9.1.231\/index.php\/wp-json\/wp\/v2\/tags?post=15014"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}