{"id":29875,"date":"2025-04-03T20:14:53","date_gmt":"2025-04-03T12:14:53","guid":{"rendered":"https:\/\/www.aisharenet.com\/?p=29875"},"modified":"2025-04-03T20:14:53","modified_gmt":"2025-04-03T12:14:53","slug":"easycontrol","status":"publish","type":"post","link":"https:\/\/www.kdjingpai.com\/en\/easycontrol\/","title":{"rendered":"EasyControl\uff1a\u5c06\u4eba\u50cf\u8f6c\u4e3a\u5409\u535c\u529b\u98ce\u683c\u56fe\u50cf\u7684\u514d\u8d39\u5de5\u5177"},"content":{"rendered":"<p>EasyControl \u662f\u4e00\u4e2a\u5f00\u6e90\u9879\u76ee\uff0c\u9879\u76ee\u57fa\u4e8e\u6269\u6563\u53d8\u6362\u5668\uff08DiT\uff09\u67b6\u6784\uff0c\u63d0\u4f9b\u9ad8\u6548\u3001\u7075\u6d3b\u7684\u56fe\u50cf\u751f\u6210\u63a7\u5236\u3002\u5176\u4e2d\uff0cGhibli Control LoRA \u662f\u5176\u7279\u8272\u529f\u80fd\u4e4b\u4e00\uff0c\u901a\u8fc7\u4ec5\u7528 100 \u5f20\u4e9a\u6d32\u4eba\u8138\u53ca\u5176 GPT-4o \u751f\u6210\u7684\u5409\u535c\u529b\u98ce\u683c\u56fe\u50cf\u8bad\u7ec3\uff0c\u80fd\u5c06\u771f\u5b9e\u4eba\u50cf\u8f6c\u4e3a\u5409\u535c\u529b\u52a8\u753b\u98ce\u683c\uff0c\u540c\u65f6\u4fdd\u7559\u9762\u90e8\u7279\u5f81\u3002EasyControl \u652f\u6301\u591a\u79cd\u6761\u4ef6\u8f93\u5165\uff0c\u5305\u62ec\u8fb9\u7f18\u3001\u6df1\u5ea6\u3001\u59ff\u52bf\u7b49\uff0cGhibli \u6a21\u578b\u5219\u662f\u98ce\u683c\u5316\u751f\u6210\u7684\u4eae\u70b9\u3002\u9879\u76ee\u4f7f\u7528 Apache 2.0 \u8bb8\u53ef\u8bc1\uff0c\u4ec5\u9650\u7814\u7a76\u7528\u9014\u3002\u622a\u81f3 2025 \u5e74 4 \u6708 3 \u65e5\uff0c\u6700\u65b0\u66f4\u65b0\u5305\u62ec Ghibli \u98ce\u683c\u6a21\u578b\u548c\u5728\u7ebf\u6f14\u793a\u3002<\/p>\n<div id=\"attachment_29876\" style=\"width: 1531px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-29876\" class=\"wp-image-29876 size-full\" title=\"EasyControl\uff1a\u5c06\u4eba\u50cf\u8f6c\u4e3a\u5409\u535c\u529b\u98ce\u683c\u56fe\u50cf\u7684\u514d\u8d39\u5de5\u5177-1\" src=\"https:\/\/www.kdjingpai.com\/wp-content\/uploads\/2025\/04\/4ca9ad1136a4750.png\" alt=\"EasyControl\uff1a\u5c06\u4eba\u50cf\u8f6c\u4e3a\u5409\u535c\u529b\u98ce\u683c\u56fe\u50cf\u7684\u514d\u8d39\u5de5\u5177-1\" width=\"1521\" height=\"699\" srcset=\"https:\/\/www.kdjingpai.com\/wp-content\/uploads\/2025\/04\/4ca9ad1136a4750.png 1521w, https:\/\/www.kdjingpai.com\/wp-content\/uploads\/2025\/04\/4ca9ad1136a4750-768x353.png 768w, https:\/\/www.kdjingpai.com\/wp-content\/uploads\/2025\/04\/4ca9ad1136a4750-18x8.png 18w\" sizes=\"auto, (max-width: 1521px) 100vw, 1521px\" \/><p id=\"caption-attachment-29876\" class=\"wp-caption-text\">\u514d\u8d39\u4f53\u9a8c\uff1ahttps:\/\/huggingface.co\/spaces\/jamesliu1217\/EasyControl_Ghibli<\/p><\/div>\n<p>&nbsp;<\/p>\n<h2>\u529f\u80fd\u5217\u8868<\/h2>\n<ul>\n<li>\u5c06\u4eba\u50cf\u8f6c\u4e3a\u5409\u535c\u529b\u98ce\u683c\uff1a\u8f93\u5165\u771f\u5b9e\u4eba\u8138\u56fe\u50cf\uff0c\u751f\u6210\u5409\u535c\u529b\u52a8\u753b\u98ce\u683c\u56fe\u50cf\u3002<\/li>\n<li>\u4fdd\u7559\u9762\u90e8\u7279\u5f81\uff1a\u57fa\u4e8e 100 \u5f20\u4e9a\u6d32\u4eba\u8138\u8bad\u7ec3\uff0c\u786e\u4fdd\u8f6c\u6362\u540e\u7ec6\u8282\u4e0d\u5931\u771f\u3002<\/li>\n<li>\u652f\u6301\u591a\u79cd\u6761\u4ef6\u63a7\u5236\uff1a\u5305\u62ec\u8fb9\u7f18\uff08Canny\uff09\u3001\u6df1\u5ea6\uff08Depth\uff09\u3001\u59ff\u52bf\uff08Pose\uff09\u7b49\u3002<\/li>\n<li>\u7075\u6d3b\u5206\u8fa8\u7387\u8f93\u51fa\uff1a\u652f\u6301\u4e0d\u540c\u9ad8\u5ea6\u548c\u5bbd\u5ea6\u7684\u56fe\u50cf\u751f\u6210\u3002<\/li>\n<li>\u9ad8\u6548\u751f\u6210\uff1a\u7ed3\u5408\u56e0\u679c\u6ce8\u610f\u529b\u673a\u5236\u548c KV Cache \u6280\u672f\uff0c\u52a0\u5feb\u63a8\u7406\u901f\u5ea6\u3002<\/li>\n<li>\u5373\u63d2\u5373\u7528\u6a21\u5757\uff1aGhibli LoRA \u53ef\u4e0e DiT \u6a21\u578b\uff08\u5982 <a href=\"https:\/\/www.kdjingpai.com\/de\/manxuebanflux1chan\/\">FLUX<\/a>.1-dev\uff09\u65e0\u7f1d\u96c6\u6210\u3002<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<h2>\u4f7f\u7528\u5e2e\u52a9<\/h2>\n<p>EasyControl \u9002\u5408\u6709\u6280\u672f\u57fa\u7840\u7684\u7528\u6237\uff0c\u5c24\u5176\u662f\u7814\u7a76\u8005\u548c\u521b\u610f\u5de5\u4f5c\u8005\u3002\u4ee5\u4e0b\u662f\u5b89\u88c5\u548c\u4f7f\u7528 Ghibli \u529f\u80fd\u7684\u8be6\u7ec6\u6307\u5357\u3002<\/p>\n<h3>\u5b89\u88c5\u6d41\u7a0b<\/h3>\n<ol>\n<li><strong>\u51c6\u5907\u73af\u5883<\/strong><br \/>\n\u9700\u8981 Python 3.10 \u548c\u5e26 CUDA \u652f\u6301\u7684 PyTorch\u3002\u521b\u5efa Conda \u73af\u5883\uff1a<\/li>\n<\/ol>\n<pre><code>conda create -n easycontrol python=3.10\r\nconda activate easycontrol\r\n<\/code><\/pre>\n<ol start=\"2\">\n<li><strong>\u514b\u9686\u4ed3\u5e93<\/strong><br \/>\n\u4e0b\u8f7d EasyControl \u9879\u76ee\uff1a<\/li>\n<\/ol>\n<pre><code>git clone https:\/\/github.com\/Xiaojiu-z\/EasyControl.git\r\ncd EasyControl\r\n<\/code><\/pre>\n<ol start=\"3\">\n<li><strong>\u5b89\u88c5\u4f9d\u8d56<\/strong><br \/>\n\u5b89\u88c5\u6240\u9700\u5e93\uff1a<\/li>\n<\/ol>\n<pre><code>pip install -r requirements.txt\r\n<\/code><\/pre>\n<p>GPU \u7528\u6237\u9700\u786e\u4fdd PyTorch \u652f\u6301 CUDA\u3002<\/p>\n<ol start=\"4\">\n<li><strong>\u4e0b\u8f7d Ghibli \u6a21\u578b<\/strong><br \/>\n\u4ece Hugging Face \u83b7\u53d6 Ghibli LoRA\uff1a<\/li>\n<\/ol>\n<pre><code>from huggingface_hub import hf_hub_download\r\nhf_hub_download(repo_id=\"Xiaojiu-Z\/EasyControl\", filename=\"models\/Ghibli.safetensors\", local_dir=\".\/\")\r\n<\/code><\/pre>\n<p>\u82e5\u65e0\u6cd5\u8bbf\u95ee\uff0c\u53ef\u7528\u955c\u50cf\u7ad9\uff1a<\/p>\n<pre><code>export HF_ENDPOINT=https:\/\/hf-mirror.com\r\nhuggingface-cli download --resume-download Xiaojiu-Z\/EasyControl --local-dir checkpoints\r\n<\/code><\/pre>\n<ol start=\"5\">\n<li><strong>\u9a8c\u8bc1\u5b89\u88c5<\/strong><br \/>\n\u8fd0\u884c\u6d4b\u8bd5\u811a\u672c\uff1a<\/li>\n<\/ol>\n<pre><code>python demo.py\r\n<\/code><\/pre>\n<p>\u82e5\u751f\u6210\u56fe\u50cf\uff0c\u5b89\u88c5\u6210\u529f\u3002<\/p>\n<h3>\u4e3b\u8981\u529f\u80fd\u64cd\u4f5c<\/h3>\n<h4>1. \u751f\u6210\u5409\u535c\u529b\u98ce\u683c\u56fe\u50cf<\/h4>\n<ul>\n<li><strong>\u64cd\u4f5c\u6b65\u9aa4<\/strong><br \/>\n\u521d\u59cb\u5316\u6a21\u578b\u5e76\u52a0\u8f7d Ghibli LoRA\uff1a<\/li>\n<\/ul>\n<pre><code>import torch\r\nfrom PIL import Image\r\nfrom src.pipeline import FluxPipeline\r\nfrom src.lora_helper import set_single_lora\r\ndevice = \"cuda\"\r\nbase_path = \"FLUX.1-dev\"  # \u57fa\u7840\u6a21\u578b\u8def\u5f84\r\npipe = FluxPipeline.from_pretrained(base_path, torch_dtype=torch.bfloat16).to(device)\r\nset_single_lora(pipe.transformer, \"models\/Ghibli.safetensors\", lora_weights=[1], cond_size=512)\r\nprompt = \"Ghibli Studio style, Charming hand-drawn anime-style illustration\"\r\nsubject_image = Image.open(\"test_imgs\/portrait.png\").convert(\"RGB\")\r\nimage = pipe(\r\nprompt,\r\nheight=1024,\r\nwidth=1024,\r\nguidance_scale=3.5,\r\nnum_inference_steps=25,\r\nsubject_images=[subject_image],\r\ncond_size=512,\r\ngenerator=torch.Generator(\"cpu\").manual_seed(1)\r\n).images[0]\r\nimage.save(\"output\/ghibli_result.png\")\r\n<\/code><\/pre>\n<ul>\n<li><strong>\u7ed3\u679c<\/strong><br \/>\n\u8f93\u51fa\u5409\u535c\u529b\u98ce\u683c\u56fe\u50cf\uff0c\u4fdd\u5b58\u81f3\u00a0<code>output\/ghibli_result.png<\/code>\u3002<\/li>\n<\/ul>\n<h4>2. \u5728\u7ebf\u6f14\u793a\u4f7f\u7528<\/h4>\n<ul>\n<li><strong>\u64cd\u4f5c\u6b65\u9aa4<\/strong><br \/>\n\u8bbf\u95ee Hugging Face \u7a7a\u95f4\u00a0https:\/\/huggingface.co\/spaces\/jamesliu1217\/EasyControl_Ghibli\uff1a<\/p>\n<ol>\n<li>\u4e0a\u4f20\u4eba\u50cf\u56fe\u7247\u3002<\/li>\n<li>\u8f93\u5165\u63d0\u793a\u8bcd\uff1a<code>Ghibli Studio style, Charming hand-drawn anime-style illustration<\/code>\u3002<\/li>\n<li>\u8bbe\u7f6e\u9ad8\u5ea6\u548c\u5bbd\u5ea6\uff08\u53d7\u786c\u4ef6\u9650\u5236\uff0c\u9ed8\u8ba4 256&#215;256\uff0c\u9ad8\u5206\u8fa8\u7387\u9700\u672c\u5730\u8fd0\u884c\uff09\u3002<\/li>\n<li>\u70b9\u51fb\u201cGenerate Image\u201d\uff0c\u7b49\u5f85 20-40 \u79d2\u3002<\/li>\n<\/ol>\n<\/li>\n<li><strong>\u7ed3\u679c<\/strong><br \/>\n\u751f\u6210\u4f4e\u5206\u8fa8\u7387\u5409\u535c\u529b\u98ce\u683c\u56fe\u50cf\u3002<\/li>\n<\/ul>\n<h3>\u7279\u8272\u529f\u80fd\u64cd\u4f5c<\/h3>\n<h4>\u9ad8\u5206\u8fa8\u7387\u751f\u6210<\/h4>\n<ul>\n<li><strong>\u64cd\u4f5c\u6b65\u9aa4<\/strong><br \/>\n\u672c\u5730\u8fd0\u884c\u65f6\uff0c\u4fee\u6539\u9ad8\u5ea6\u548c\u5bbd\u5ea6\u53c2\u6570\uff1a<\/p>\n<pre><code>image = pipe(prompt, height=1024, width=1024, ...)\r\n<\/code><\/pre>\n<\/li>\n<li><strong>\u6ce8\u610f<\/strong><br \/>\n\u9700\u8981\u81f3\u5c11 12GB GPU \u5185\u5b58\uff0c\u5426\u5219\u53ef\u80fd\u5931\u8d25\u3002<\/li>\n<\/ul>\n<h4>\u6e05\u7406\u7f13\u5b58<\/h4>\n<ul>\n<li><strong>\u64cd\u4f5c\u6b65\u9aa4<\/strong><br \/>\n\u6bcf\u6b21\u751f\u6210\u540e\u6e05\u7406\u7f13\u5b58\uff1a<\/p>\n<pre><code>def clear_cache(<a href=\"https:\/\/www.kdjingpai.com\/de\/transformer\/\">transformer<\/a>):\r\nfor name, attn_processor in transformer.attn_processors.items():\r\nattn_processor.bank_kv.clear()\r\nclear_cache(pipe.transformer)\r\n<\/code><\/pre>\n<\/li>\n<\/ul>\n<h3>\u4f7f\u7528\u6280\u5de7<\/h3>\n<ul>\n<li>\u63d0\u793a\u8bcd\u5fc5\u987b\u5305\u542b\u00a0<code>Ghibli Studio style, Charming hand-drawn anime-style illustration<\/code>\u00a0\u4ee5\u89e6\u53d1\u98ce\u683c\u3002<\/li>\n<li>\u8f93\u5165\u56fe\u50cf\u5efa\u8bae\u4e3a\u6e05\u6670\u4eba\u50cf\uff0c\u5206\u8fa8\u7387 512&#215;512 \u4ee5\u4e0a\u3002<\/li>\n<li>\u5728\u7ebf\u6f14\u793a\u53d7\u9650\u4e8e\u786c\u4ef6\uff0c\u4ec5\u652f\u6301\u4f4e\u5206\u8fa8\u7387\uff08256&#215;256\uff09\u3002<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<h2>\u5e94\u7528\u573a\u666f<\/h2>\n<ol>\n<li><strong>\u52a8\u6f2b\u89d2\u8272\u8bbe\u8ba1<\/strong><br \/>\n\u5c06\u771f\u5b9e\u4eba\u50cf\u8f6c\u4e3a\u5409\u535c\u529b\u98ce\u683c\uff0c\u5feb\u901f\u751f\u6210\u52a8\u753b\u89d2\u8272\u539f\u578b\u3002<\/li>\n<li><strong>\u827a\u672f\u521b\u4f5c<\/strong><br \/>\n\u827a\u672f\u5bb6\u7528 Ghibli \u6a21\u578b\u521b\u4f5c\u624b\u7ed8\u98ce\u683c\u63d2\u56fe\uff0c\u63d0\u5347\u6548\u7387\u3002<\/li>\n<li><strong>\u6559\u80b2\u7814\u7a76<\/strong><br \/>\n\u7814\u7a76\u8005\u63a2\u7d22\u6761\u4ef6\u63a7\u5236\u5728\u98ce\u683c\u5316\u751f\u6210\u4e2d\u7684\u5e94\u7528\u3002<\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<h2>QA<\/h2>\n<ol>\n<li><strong>\u4e3a\u4ec0\u4e48\u5728\u7ebf\u751f\u6210\u7684\u5206\u8fa8\u7387\u4f4e\uff1f<\/strong><br \/>\n\u5728\u7ebf\u6f14\u793a\u53d7\u786c\u4ef6\u9650\u5236\uff0c\u4ec5\u652f\u6301 256&#215;256\uff0c\u9700\u672c\u5730\u8fd0\u884c\u4ee5\u751f\u6210 1024&#215;1024 \u56fe\u50cf\u3002<\/li>\n<li><strong>\u751f\u6210\u7684\u56fe\u50cf\u4e0d\u50cf\u5409\u535c\u529b\u98ce\u683c\u600e\u4e48\u529e\uff1f<\/strong><br \/>\n\u786e\u4fdd\u63d0\u793a\u8bcd\u5305\u542b\u89e6\u53d1\u8bcd\uff0c\u6216\u68c0\u67e5\u8f93\u5165\u56fe\u50cf\u662f\u5426\u6e05\u6670\u3002<\/li>\n<li><strong>\u652f\u6301\u975e\u4eba\u50cf\u8f93\u5165\u5417\uff1f<\/strong><br \/>\n\u53ef\u4ee5\uff0c\u4f46 Ghibli \u6a21\u578b\u9488\u5bf9\u4eba\u8138\u4f18\u5316\uff0c\u5176\u4ed6\u8f93\u5165\u6548\u679c\u53ef\u80fd\u4e0d\u4f73\u3002<\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>EasyControl \u662f\u4e00\u4e2a\u5f00\u6e90\u9879\u76ee\uff0c\u9879\u76ee\u57fa\u4e8e\u6269\u6563\u53d8\u6362\u5668\uff08DiT\uff09\u67b6\u6784\uff0c\u63d0\u4f9b\u9ad8\u6548\u3001\u7075\u6d3b\u7684\u56fe\u50cf\u751f\u6210\u63a7\u5236\u3002\u5176\u4e2d\uff0cGhibli Control LoRA \u662f\u5176\u7279\u8272\u529f\u80fd\u4e4b\u4e00\uff0c\u901a\u8fc7\u4ec5\u7528 100 \u5f20\u4e9a\u6d32\u4eba\u8138\u53ca\u5176 GPT-4o \u751f\u6210\u7684\u5409\u535c\u529b\u98ce\u683c\u56fe\u50cf\u8bad\u7ec3&#8230;<\/p>\n","protected":false},"author":1,"featured_media":62190,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[20],"tags":[229,230],"class_list":["post-29875","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tool","tag-aituxiangfenggekongzhi","tag-aikaiyuanxiangmu"],"_links":{"self":[{"href":"https:\/\/www.kdjingpai.com\/en\/wp-json\/wp\/v2\/posts\/29875","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.kdjingpai.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.kdjingpai.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.kdjingpai.com\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.kdjingpai.com\/en\/wp-json\/wp\/v2\/comments?post=29875"}],"version-history":[{"count":0,"href":"https:\/\/www.kdjingpai.com\/en\/wp-json\/wp\/v2\/posts\/29875\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.kdjingpai.com\/en\/wp-json\/wp\/v2\/media\/62190"}],"wp:attachment":[{"href":"https:\/\/www.kdjingpai.com\/en\/wp-json\/wp\/v2\/media?parent=29875"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.kdjingpai.com\/en\/wp-json\/wp\/v2\/categories?post=29875"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.kdjingpai.com\/en\/wp-json\/wp\/v2\/tags?post=29875"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}