{"id":102178,"date":"2022-09-09T09:32:05","date_gmt":"2022-09-09T00:32:05","guid":{"rendered":"https:\/\/softantenna.com\/blog\/?p=102178"},"modified":"2022-09-09T09:32:05","modified_gmt":"2022-09-09T00:32:05","slug":"stable-diffusion-m1-m2-mac","status":"publish","type":"post","link":"https:\/\/softantenna.com\/blog\/stable-diffusion-m1-m2-mac\/","title":{"rendered":"M1\/M2\u642d\u8f09Mac\u4e0a\u3067\u300cStable Diffusion\u300d\u3092\u5b9f\u884c\u3059\u308b\u65b9\u6cd5"},"content":{"rendered":"<p><img decoding=\"async\" style=\"display:block; margin-left:auto; margin-right:auto;\" src=\"https:\/\/softantenna.com\/blog\/wp-content\/uploads\/2022\/09\/s_20220907_161336.jpg\" alt=\"S 20220907 161336\" title=\"s_20220907_161336.jpg\" border=\"0\" width=\"1217\" height=\"886\" \/><\/p>\n<p>AI\u3092\u5229\u7528\u3057\u30c6\u30ad\u30b9\u30c8\u304b\u3089\u753b\u50cf\u3092\u751f\u6210\u3067\u304d\u308b\u30bd\u30d5\u30c8\u30a6\u30a7\u30a2\u300c<a href=\"https:\/\/github.com\/CompVis\/stable-diffusion\">Stable Diffusion<\/a>\u300d\u3002<\/p>\n<p>\u672c\u6765\u5b9f\u884c\u3059\u308b\u305f\u3081\u306b\u306f\u3001NVIDA\u88fd\u306e\u7279\u5b9a\u306eGPU\u304c\u5fc5\u8981\u3068\u3044\u3046\u5236\u9650\u304c\u5b58\u5728\u3057\u307e\u3059\u304c\u3001\u30aa\u30fc\u30d7\u30f3\u30bd\u30fc\u30b9\u30bd\u30d5\u30c8\u30a6\u30a7\u30a2\u306e\u7279\u6027\u3092\u751f\u304b\u3057\u3001<a href=\"https:\/\/softantenna.com\/blog\/?p=102101\">Intel CPU\u306e\u307f\u3067\u5b9f\u884c\u3067\u304d\u308b\u30d0\u30fc\u30b8\u30e7\u30f3<\/a>\u306a\u3069\u3001\u3055\u307e\u3056\u307e\u306a\u6d3e\u751f\u7248\u304c\u4f5c\u3089\u308c\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u672c\u65e5\u306f\u305d\u306e\u306a\u304b\u3067\u3001Apple\u306e\u72ec\u81ea\u30c1\u30c3\u30d7\u3067\u3042\u308bM1\u304a\u3088\u3073M2\u30c1\u30c3\u30d7\u3092\u642d\u8f09\u3057\u305fMac\u3067Stable Diffusion\u3092\u5b9f\u884c\u3059\u308b\u65b9\u6cd5\u3092\u7d39\u4ecb\u3057\u307e\u3059\u3002<\/p>\n<p>\u65b9\u6cd5\u3092\u8aac\u660e\u3057\u305f<a href=\"https:\/\/replicate.com\/blog\/run-stable-diffusion-on-m1-mac\">\u30d6\u30ed\u30b0<\/a>\u306b\u3088\u308b\u3068\u3001Mac\u306e\u8981\u4ef6\u306f\u4ee5\u4e0b\u306e\u901a\u308a\u3067\u3059\u3002<\/p>\n<ul>\n<li>M1\u307e\u305f\u306fM2\u30c1\u30c3\u30d7\u3092\u642d\u8f09\u3057\u305fMac\u3002<\/li>\n<li>16GB\u4ee5\u4e0a\u306eRAM\u30028GB\u306eRAM\u3067\u52d5\u4f5c\u3059\u308b\u304c\u3068\u3066\u3082\u9045\u3044\u3002<\/li>\n<li>macOS 12.3\u4ee5\u964d<\/li>\n<\/ul>\n<p>\u4ee5\u4e0b\u3001\u5177\u4f53\u7684\u306a\u624b\u9806\u3092\u8aac\u660e\u3057\u307e\u3059\u3002<\/p>\n<h2>Python\u306e\u30bb\u30c3\u30c8\u30a2\u30c3\u30d7<\/h2>\n<p>Stable Diffusion\u3092\u5b9f\u884c\u3059\u308b\u305f\u3081\u306b\u306fPython\u74b0\u5883\u304c\u5fc5\u8981\u3067\u3059\u3002Python\u74b0\u5883\u3092\u30bb\u30c3\u30c8\u30a2\u30c3\u30d7\u3059\u308b\u305f\u3081\u306b\u306f\u3055\u307e\u3056\u307e\u306a\u65b9\u6cd5\u304c\u5b58\u5728\u3057\u307e\u3059\u3002\u4eca\u56de\u306f\u5143\u306e\u30d6\u30ed\u30b0\u306b\u8a18\u4e8b\u5f93\u3044\u3001Homebrew\u3067\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u305fPython 3.10\u3068virtualenv\u3092\u4f7f\u7528\u3057\u307e\u3059\u3002<\/p>\n<p>\u307e\u305aPython\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u307e\u3059\u3002<\/p>\n<pre>\r\nbrew update\r\nbrew install python\r\n<\/pre>\n<p><code>python3 -V<\/code>\u3067\u300c3.10\u300d\u4ee5\u964d\u304c\u8868\u793a\u3055\u308c\u308c\u3070\u6210\u529f\u3067\u3059\u3002\u306a\u304aStable Diffusion\u5b9f\u884c\u6642\u306b<code>cmake<\/code>\u3001<code>protobuf<\/code>\u3001<code>rust<\/code>\u7b49\u306e\u30bd\u30d5\u30c8\u30a6\u30a7\u30a2\u3082\u5fc5\u8981\u306a\u3088\u3046\u3067\u3059\u3002\u4e8b\u524d\u306b\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u3066\u304a\u3051\u3070\u624b\u623b\u308a\u304c\u3042\u308a\u307e\u305b\u3093\u3002<\/p>\n<pre>\r\nbrew install cmake protobuf rust\r\n<\/pre>\n<h2>Stable Diffusion\u306e\u30bb\u30c3\u30c8\u30a2\u30c3\u30d7<\/h2>\n<p>Stable Diffusion\u306e\u30ea\u30dd\u30b8\u30c8\u30ea\u3092clone\u3057\u307e\u3059\u3002<\/p>\n<pre>\r\ngit clone -b apple-silicon-mps-support https:\/\/github.com\/bfirsh\/stable-diffusion.git\r\ncd stable-diffusion\r\nmkdir -p models\/ldm\/stable-diffusion-v1\r\n<\/pre>\n<p>virtualenv\u306e\u30bb\u30c3\u30c8\u30a2\u30c3\u30d7\u3092\u884c\u3044\u307e\u3059\u3002<\/p>\n<pre>\r\npython3 -m pip install virtualenv\r\npython3 -m virtualenv venv\r\nsource venv\/bin\/activate\r\n<\/pre>\n<p>\u3053\u306e\u65b9\u6cd5\u3067\u306f\u3001<code>source venv\/bin\/activate<\/code>\u306f\u6bce\u56de\u5b9f\u884c\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002\u5b9f\u884c\u3059\u308b\u3068\u30b3\u30de\u30f3\u30c9\u30d7\u30ed\u30f3\u30d7\u30c8\u304c\u5909\u308f\u308a\u307e\u3059\u3002<\/p>\n<p>\u5fc5\u8981\u306a\u30bd\u30d5\u30c8\u30a6\u30a7\u30a2\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u307e\u3059\u3002<\/p>\n<pre>\r\npip install -r requirements.txt\r\n<\/pre>\n<p>\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u306b\u3057\u3070\u3089\u304f\u6642\u9593\u304c\u5fc5\u8981\u3067\u3059\u3002<\/p>\n<h2>\u30a6\u30a7\u30a4\u30c8\u306e\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9<\/h2>\n<p>\u5b9f\u884c\u306b\u5fc5\u8981\u306a\u30a6\u30a7\u30a4\u30c8\u3068\u547c\u3070\u308c\u308b\u30d5\u30a1\u30a4\u30eb\u3092\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3057\u307e\u3059\u3002<a href=\"https:\/\/huggingface.co\/CompVis\/stable-diffusion-v-1-4-original\">Hugging Face repository<\/a>\u3092\u958b\u304d\u3001\u30e9\u30a4\u30bb\u30f3\u30b9\u3092\u78ba\u8a8d\u3057\u300cAccess repository\u300d\u30dc\u30bf\u30f3\u3092\u30af\u30ea\u30c3\u30af\u3057\u307e\u3059\u3002\u5fc5\u8981\u306a\u3089\u3070\u30a2\u30ab\u30a6\u30f3\u30c8\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002<\/p>\n<p><img decoding=\"async\" style=\"display:block; margin-left:auto; margin-right:auto;\" src=\"https:\/\/softantenna.com\/blog\/wp-content\/uploads\/2022\/09\/s_20220907_164156.jpg\" alt=\"S 20220907 164156\" title=\"s_20220907_164156.jpg\" border=\"0\" width=\"906\" height=\"592\" \/><\/p>\n<p>\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3057\u305f<code>sd-v1-4.ckpt<\/code>(4GB\u8fd1\u304f\u306e\u30b5\u30a4\u30ba)\u3092\u3001\u5148\u307b\u3069\u4f5c\u6210\u3057\u305f\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306b<code>models\/ldm\/stable-diffusion-v1\/model.ckpt<\/code>\u3068\u3057\u3066\u4fdd\u5b58\u3057\u307e\u3059\u3002<\/p>\n<h2>\u5b9f\u884c<\/h2>\n<p>\u3044\u3088\u3044\u3088\u5b9f\u884c\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre>\r\npython3 scripts\/txt2img.py --prompt \"a red juicy apple floating in outer space, like a planet\" --n_samples 1 --n_iter 1 --plms\r\n<\/pre>\n<p>\u5b8c\u4e86\u3059\u308b\u3068<code>outputs\/txt2img-samples<\/code>\u4ee5\u4e0b\u306b\u753b\u50cf\u304c\u4f5c\u6210\u3055\u308c\u307e\u3059\u3002<\/p>\n<p><img decoding=\"async\" style=\"display:block; margin-left:auto; margin-right:auto;\" src=\"https:\/\/softantenna.com\/blog\/wp-content\/uploads\/2022\/09\/s_20220907_164935.jpg\" alt=\"S 20220907 164935\" title=\"s_20220907_164935.jpg\" border=\"0\" width=\"906\" height=\"592\" \/><\/p>\n<p>\u5b87\u5b99\u306b\u8d64\u3044\u30ea\u30f3\u30b4\u304c\u6d6e\u304b\u3093\u3067\u3044\u308b\u4e0d\u601d\u8b70\u306a\u753b\u50cf\u304c\u4f5c\u6210\u3055\u308c\u307e\u3059\u3002<\/p>\n<h2>\u307e\u3068\u3081<\/h2>\n<p>Stable Diffusion\u3092M1\/M2 Mac\u4e0a\u3067\u5b9f\u884c\u3059\u308b\u65b9\u6cd5\u3092\u8aac\u660e\u3057\u307e\u3057\u305f\u30028GB\u306eM1 MacBook Air\u3067\u3082\u4e00\u5fdc\u5b9f\u884c\u3067\u304d\u308b\u3088\u3046\u3067\u3059\u3002\u8a71\u984c\u306e\u30c6\u30af\u30ce\u30ed\u30b8\u30fc\u306b\u89e6\u308c\u3066\u307f\u305f\u3044\u65b9\u306f\u5b9f\u969b\u306b\u5b9f\u884c\u3057\u3066\u307f\u3066\u306f\u3044\u304b\u304c\u3067\u3057\u3087\u3046\u304b\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>AI\u3092\u5229\u7528\u3057\u30c6\u30ad\u30b9\u30c8\u304b\u3089\u753b\u50cf\u3092\u751f\u6210\u3067\u304d\u308b\u30bd\u30d5\u30c8\u30a6\u30a7\u30a2\u300cStable Diffusion\u300d\u3002 \u672c\u6765\u5b9f\u884c\u3059\u308b\u305f\u3081\u306b\u306f\u3001NVIDA\u88fd\u306e\u7279\u5b9a\u306eGPU\u304c\u5fc5\u8981\u3068\u3044\u3046\u5236\u9650\u304c\u5b58\u5728\u3057\u307e\u3059\u304c\u3001\u30aa\u30fc\u30d7\u30f3\u30bd\u30fc\u30b9\u30bd\u30d5\u30c8\u30a6\u30a7\u30a2\u306e\u7279\u6027\u3092\u751f\u304b\u3057\u3001Int [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":102225,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"swell_btn_cv_data":"","footnotes":""},"categories":[2047],"tags":[3299],"class_list":["post-102178","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tips","tag-mac"],"_links":{"self":[{"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/posts\/102178","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/comments?post=102178"}],"version-history":[{"count":0,"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/posts\/102178\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/media\/102225"}],"wp:attachment":[{"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/media?parent=102178"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/categories?post=102178"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/tags?post=102178"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}