{"id":1198,"date":"2024-06-27T16:19:54","date_gmt":"2024-06-27T07:19:54","guid":{"rendered":"https:\/\/shinke1987.net\/?p=1198"},"modified":"2024-06-27T16:19:55","modified_gmt":"2024-06-27T07:19:55","slug":"google-colaboratory%e3%81%a7animagine-xl-3-0%e3%82%92%e5%88%a9%e7%94%a8%e3%81%97%e3%81%a6%e3%80%81%e7%94%bb%e5%83%8f%e3%82%92%e7%94%9f%e6%88%90%e3%81%99%e3%82%8b","status":"publish","type":"post","link":"https:\/\/shinke1987.net\/?p=1198","title":{"rendered":"Google Colaboratory\u3067ANIMAGINE XL 3.0\u3092\u5229\u7528\u3057\u3066\u3001\u753b\u50cf\u3092\u751f\u6210\u3059\u308b"},"content":{"rendered":"\n<p>\u307e\u3060\u307e\u3060\u308f\u304b\u3089\u306a\u3044\u3053\u3068\u304c\u591a\u3044\u3051\u308c\u3069\u3082\u3001\u3072\u3068\u307e\u305a\u751f\u6210\u3067\u304d\u305f\u306e\u3067\u30ed\u30b0\u3092\u6b8b\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<h2 id=\"toc0\" class=\"wp-block-heading\">\u53c2\u8003<\/h2>\n\n\n\n<p><a href=\"https:\/\/gigazine.net\/news\/20220824-stable-diffusion-google-colaboratory\/\" target=\"_blank\" rel=\"noreferrer noopener\">\u753b\u50cf\u751f\u6210AI\u300cStable Diffusion\u300d\u3092\u4f4e\u30b9\u30da\u30c3\u30afPC\u3067\u3082\u7121\u6599\u304b\u3064\u5f85\u3061\u6642\u9593\u306a\u3057\u3067\u4f7f\u3046\u65b9\u6cd5\u307e\u3068\u3081 &#8211; GIGAZINE<\/a><\/p>\n\n\n\n<p><a href=\"https:\/\/huggingface.co\/cagliostrolab\/animagine-xl-3.0\" target=\"_blank\" rel=\"noreferrer noopener\">cagliostrolab\/animagine-xl-3.0 \u00b7 Hugging Face<\/a><\/p>\n\n\n\n<h2 id=\"toc1\" class=\"wp-block-heading\">\u624b\u9806<\/h2>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Hagging Face\u3067\u30a2\u30ab\u30a6\u30f3\u30c8\u3092\u767b\u9332\u3057\u3001\u30a2\u30af\u30bb\u30b9\u30c8\u30fc\u30af\u30f3\u3092read\u6a29\u9650\u3067\u767a\u884c\u3057\u3001\u30e1\u30e2\u3059\u308b\u3002<\/li>\n\n\n\n<li>Google Colaboratory\u3067\u5fc5\u8981\u306a\u3082\u306e\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b\u305f\u3081\u306b\u3001\u6b21\u306e\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3059\u308b\u3002<\/li>\n<\/ol>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: python; title: ; notranslate\" title=\"\">\npip install diffusers transformers accelerate safetensors\nHF_TOKEN=&quot;1\u756a\u3067\u767a\u884c\u3057\u305fHagging Face\u306e\u30a2\u30af\u30bb\u30b9\u30c8\u30fc\u30af\u30f3&quot;\n<\/pre><\/div>\n\n\n<p>3. \u6b21\u306ePython\u30b3\u30fc\u30c9\u3092\u5b9f\u884c\u3057\u3001\u8a2d\u5b9a\u3092\u884c\u3046\u3002<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: python; title: ; notranslate\" title=\"\">\nimport torch\nfrom diffusers import (\n    StableDiffusionXLPipeline, \n    EulerAncestralDiscreteScheduler,\n    AutoencoderKL\n)\n\n# Load VAE component\nvae = AutoencoderKL.from_pretrained(\n    &quot;madebyollin\/sdxl-vae-fp16-fix&quot;, \n    torch_dtype=torch.float16\n)\n\n# Configure the pipeline\npipe = StableDiffusionXLPipeline.from_pretrained(\n    &quot;cagliostrolab\/animagine-xl-3.0&quot;, \n    vae=vae,\n    torch_dtype=torch.float16, \n    use_safetensors=True, \n    token=HF_TOKEN,\n)\npipe.scheduler = EulerAncestralDiscreteScheduler.from_config(pipe.scheduler.config)\npipe.to(&#039;cuda&#039;)\n<\/pre><\/div>\n\n\n<p>4. \u6b21\u306e\u30b3\u30fc\u30c9\u3092\u5b9f\u884c\u3057\u3001\u751f\u6210\u3059\u308b\u753b\u50cf\u306e\u6761\u4ef6\u3092\u8a2d\u5b9a\u3057\u3001\u753b\u50cf\u3092\u751f\u6210\u3059\u308b\u3002<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: python; title: ; notranslate\" title=\"\">\nprompt = &quot;\u597d\u304d\u306a\u30d7\u30ed\u30f3\u30d7\u30c8&quot;\nnegative_prompt = &quot;NG\u306b\u3057\u305f\u3044\u30d7\u30ed\u30f3\u30d7\u30c8&quot;\nimage = pipe(\n    prompt, \n    negative_prompt=negative_prompt, \n    width=832,\n    height=1216,\n    guidance_scale=7,\n    num_inference_steps=28\n).images&#x5B;0]\n\n# \u751f\u6210\u3057\u305f\u753b\u50cf\u3092\u8868\u793a\u3057\u305f\u3044\u306a\u3089\u3001\u300cimage\u300d\u306e1\u6587\u3092\u8ffd\u52a0\u3059\u308c\u3070\u826f\u3044\u3002\n<\/pre><\/div>\n\n\n<p>5. \u6b21\u306e\u30b3\u30fc\u30c9\u3092\u5b9f\u884c\u3057\u3001\u753b\u50cf\u3092\u4fdd\u5b58\u3059\u308b\u3002<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: python; title: ; notranslate\" title=\"\">\nimage.save(&#039;\u30d5\u30a1\u30a4\u30eb\u540d.\u62e1\u5f35\u5b50&#039;)\n<\/pre><\/div>\n\n\n<h3 id=\"toc2\" class=\"wp-block-heading\">prompt\u7b49\u306e\u4f8b<\/h3>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: python; title: ; notranslate\" title=\"\">\nprompt = &quot;saber, fate \\(series\\), masterpiece&quot;\nnegative_prompt = &quot;EasyNegativeV2, negative_hand-neg, bad fingers, missing fingers, too many arms,  too many legs, poor quality, worst quality, low quality, normal quality, bad anatomy, text, signature&quot;\nimage = pipe(\n    prompt, \n    negative_prompt=negative_prompt, \n    width=832,\n    height=1216,\n    guidance_scale=20,\n    num_inference_steps=28\n).images&#x5B;0]\nimage\n<\/pre><\/div>","protected":false},"excerpt":{"rendered":"<p>\u307e\u3060\u307e\u3060\u308f\u304b\u3089\u306a\u3044\u3053\u3068\u304c\u591a\u3044\u3051\u308c\u3069\u3082\u3001\u3072\u3068\u307e\u305a\u751f\u6210\u3067\u304d\u305f\u306e\u3067\u30ed\u30b0\u3092\u6b8b\u3057\u307e\u3059\u3002 \u53c2\u8003 \u753b\u50cf\u751f\u6210AI\u300cStable Diffusion\u300d\u3092\u4f4e\u30b9\u30da\u30c3\u30afPC\u3067\u3082\u7121\u6599\u304b\u3064\u5f85\u3061\u6642\u9593\u306a\u3057\u3067\u4f7f\u3046\u65b9\u6cd5\u307e\u3068\u3081 &#8211; GIGAZIN [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[112],"tags":[113,114],"class_list":["post-1198","post","type-post","status-publish","format-standard","hentry","category-ai","tag-animagine-xl-3-0","tag-stable-diffusion-xl"],"_links":{"self":[{"href":"https:\/\/shinke1987.net\/index.php?rest_route=\/wp\/v2\/posts\/1198","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/shinke1987.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/shinke1987.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/shinke1987.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/shinke1987.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1198"}],"version-history":[{"count":3,"href":"https:\/\/shinke1987.net\/index.php?rest_route=\/wp\/v2\/posts\/1198\/revisions"}],"predecessor-version":[{"id":1201,"href":"https:\/\/shinke1987.net\/index.php?rest_route=\/wp\/v2\/posts\/1198\/revisions\/1201"}],"wp:attachment":[{"href":"https:\/\/shinke1987.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1198"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/shinke1987.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1198"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/shinke1987.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1198"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}