{"id":254,"date":"2026-03-21T19:15:55","date_gmt":"2026-03-21T11:15:55","guid":{"rendered":"https:\/\/home.snu1e.top\/index.php\/2026\/03\/21\/z-image-turbo-%e6%9c%ac%e5%9c%b0%e9%83%a8%e7%bd%b2%e5%ae%8c%e5%85%a8%e6%8c%87%e5%8d%97\/"},"modified":"2026-03-21T19:15:55","modified_gmt":"2026-03-21T11:15:55","slug":"z-image-turbo-%e6%9c%ac%e5%9c%b0%e9%83%a8%e7%bd%b2%e5%ae%8c%e5%85%a8%e6%8c%87%e5%8d%97","status":"publish","type":"post","link":"https:\/\/home.snu1e.top\/index.php\/2026\/03\/21\/z-image-turbo-%e6%9c%ac%e5%9c%b0%e9%83%a8%e7%bd%b2%e5%ae%8c%e5%85%a8%e6%8c%87%e5%8d%97\/","title":{"rendered":"Z-Image Turbo \u672c\u5730\u90e8\u7f72\u5b8c\u5168\u6307\u5357"},"content":{"rendered":"\n<p>Z-Image Turbo \u662f\u963f\u91cc\u5df4\u5df4\u901a\u4e49\u5b9e\u9a8c\u5ba4\u5f00\u6e90\u76846B\u53c2\u6570\u56fe\u50cf\u751f\u6210\u6a21\u578b\uff0c\u652f\u6301\u4e2d\u82f1\u6587\u53cc\u8bed\u63d0\u793a\u8bcd\uff0c9\u6b65\u5373\u53ef\u751f\u6210\u9ad8\u8d28\u91cf1024&#215;1024\u56fe\u50cf\u3002\u672c\u6587\u4ecb\u7ecd\u5982\u4f55\u5728Windows\u7cfb\u7edf+RTX 4070 Ti SUPER 16GB\u663e\u5b58\u7684\u914d\u7f6e\u4e0b\u5b8c\u6210\u672c\u5730\u90e8\u7f72\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u786c\u4ef6\u8981\u6c42<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\u663e\u5361<\/strong>: NVIDIA GPU\uff0c\u663e\u5b58 \u226512GB\uff08\u63a8\u835016GB\uff09<\/li>\n<li><strong>\u5185\u5b58<\/strong>: 32GB \u7cfb\u7edf\u5185\u5b58<\/li>\n<li><strong>\u5b58\u50a8<\/strong>: 20GB+ \u53ef\u7528\u7a7a\u95f4\uff08\u6a21\u578b\u7ea612GB\uff09<\/li>\n<li><strong>\u7cfb\u7edf<\/strong>: Windows 10\/11<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">\u73af\u5883\u51c6\u5907<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">1. \u521b\u5efaConda\u73af\u5883<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>conda create -n openmodels python=3.10 -y\nconda activate openmodels<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">2. \u5b89\u88c5PyTorch\uff08CUDA 12.1\u7248\u672c\uff09<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>pip install torch torchvision torchaudio --index-url https:\/\/download.pytorch.org\/whl\/cu121<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">3. \u5b89\u88c5Diffusers\u548c\u76f8\u5173\u4f9d\u8d56<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>pip install diffusers transformers accelerate<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">\u76ee\u5f55\u7ed3\u6784\u89c4\u5212<\/h2>\n\n\n\n<p>\u5efa\u8bae\u521b\u5efa\u4ee5\u4e0b\u76ee\u5f55\u7ed3\u6784\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>D:\\AI-Models\\Z-Image\u251c\u2500\u2500 models\\          # \u6a21\u578b\u6587\u4ef6\u5b58\u653e\u76ee\u5f55\n\u251c\u2500\u2500 outputs\\         # \u751f\u6210\u56fe\u7247\u8f93\u51fa\u76ee\u5f55\n\u251c\u2500\u2500 generate.py      # \u4e3b\u7a0b\u5e8f\n\u2514\u2500\u2500 start.bat        # \u4e00\u952e\u542f\u52a8\u811a\u672c<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">\u90e8\u7f72\u6b65\u9aa4<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">1. \u521b\u5efa\u76ee\u5f55<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>mkdir \"D:\\AI-Models\\Z-Image\"\nmkdir \"D:\\AI-Models\\Z-Image\\models\"\nmkdir \"D:\\AI-Models\\Z-Image\\outputs\"<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">2. \u521b\u5efa\u751f\u6210\u811a\u672c<\/h3>\n\n\n\n<p>\u521b\u5efa\u6587\u4ef6 <code>D:\\AI-Models\\Z-Image\\generate.py<\/code>\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>import os\nimport torch\nfrom diffusers import ZImagePipeline\n\n# \u8bbe\u7f6e\u81ea\u5b9a\u4e49\u7f13\u5b58\u8def\u5f84\ncache_dir = r\"D:\\AI-Models\\Z-Image\\models\"\nos.environ[\"HF_HOME\"] = cache_dir\nos.environ[\"TRANSFORMERS_CACHE\"] = cache_dir\n\nprint(f\"\u6a21\u578b\u5c06\u4e0b\u8f7d\u5230: {cache_dir}\")\nprint(\"\u9996\u6b21\u8fd0\u884c\u9700\u8981\u4e0b\u8f7d\u7ea612GB\u6a21\u578b\u6587\u4ef6\uff0c\u8bf7\u8010\u5fc3\u7b49\u5f85...\")\n\n# \u52a0\u8f7d\u6a21\u578b\npipe = ZImagePipeline.from_pretrained(\n    \"Tongyi-MAI\/Z-Image-Turbo\",\n    torch_dtype=torch.bfloat16,\n    cache_dir=cache_dir,\n    local_files_only=False\n)\npipe.to(\"cuda\")\n\nprint(\"\u6a21\u578b\u52a0\u8f7d\u5b8c\u6210\uff01\")\n\n# \u751f\u6210\u56fe\u7247\u793a\u4f8b\nprompt = \"\u4e00\u53ea\u53ef\u7231\u7684\u6a58\u732b\uff0c\u5750\u5728\u7a97\u53f0\u4e0a\uff0c\u9633\u5149\u7167\u5c04\uff0c\u9ad8\u6e05\u7ec6\u8282\"\nprint(f\"\u6b63\u5728\u751f\u6210: {prompt}\")\n\nimage = pipe(\n    prompt=prompt,\n    num_inference_steps=9,\n    height=1024,\n    width=1024,\n    guidance_scale=0.0,\n    generator=torch.Generator(\"cuda\").manual_seed(42)\n).images[0]\n\n# \u4fdd\u5b58\u56fe\u7247\noutput_dir = r\"D:\\AI-Models\\Z-Image\\outputs\"\nos.makedirs(output_dir, exist_ok=True)\noutput_path = os.path.join(output_dir, \"output.png\")\nimage.save(output_path)\nprint(f\"\u56fe\u7247\u5df2\u4fdd\u5b58: {output_path}\")<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">3. \u521b\u5efa\u4e00\u952e\u542f\u52a8\u811a\u672c<\/h3>\n\n\n\n<p>\u521b\u5efa\u6587\u4ef6 <code>D:\\AI-Models\\Z-Image\\start.bat<\/code>\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>@echo off\nchcp 65001 >nul\necho \u6b63\u5728\u6fc0\u6d3bconda\u73af\u5883...\ncall conda activate openmodels\n\necho \u6b63\u5728\u542f\u52a8Z-Image Turbo...\ncd \/d \"D:\\AI-Models\\Z-Image\"\npython generate.py\n\necho.\npause<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">4. \u9996\u6b21\u8fd0\u884c\uff08\u4e0b\u8f7d\u6a21\u578b\uff09<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>conda activate openmodels\ncd \"D:\\AI-Models\\Z-Image\"\npython generate.py<\/code><\/pre>\n\n\n\n<p>\u9996\u6b21\u8fd0\u884c\u4f1a\u81ea\u52a8\u4e0b\u8f7d\u7ea612GB\u7684\u6a21\u578b\u6587\u4ef6\uff0c\u6839\u636e\u7f51\u7edc\u60c5\u51b5\u53ef\u80fd\u9700\u898110-30\u5206\u949f\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u4ea4\u4e92\u5f0f\u751f\u6210\u811a\u672c<\/h2>\n\n\n\n<p>\u5982\u9700\u4ea4\u4e92\u5f0f\u8f93\u5165\u63d0\u793a\u8bcd\uff0c\u4f7f\u7528\u4ee5\u4e0b\u811a\u672c\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>import os\nimport torch\nfrom diffusers import ZImagePipeline\nfrom datetime import datetime\n\ncache_dir = r\"D:\\AI-Models\\Z-Image\\models\"\nos.environ[\"HF_HOME\"] = cache_dir\nos.environ[\"TRANSFORMERS_CACHE\"] = cache_dir\n\nprint(\"\u6b63\u5728\u52a0\u8f7dZ-Image Turbo...\")\npipe = ZImagePipeline.from_pretrained(\n    \"Tongyi-MAI\/Z-Image-Turbo\",\n    torch_dtype=torch.bfloat16,\n    cache_dir=cache_dir,\n)\npipe.to(\"cuda\")\nprint(\"\u6a21\u578b\u52a0\u8f7d\u5b8c\u6210\uff01\n\")\n\nwhile True:\n    prompt = input(\"\u8bf7\u8f93\u5165\u63d0\u793a\u8bcd(\u6216'quit'\u9000\u51fa): \").strip()\n    if prompt.lower() in ['quit', 'exit', 'q']:\n        break\n    if not prompt:\n        continue\n    \n    print(f\"\u6b63\u5728\u751f\u6210: {prompt}\")\n    image = pipe(\n        prompt=prompt,\n        num_inference_steps=9,\n        height=1024,\n        width=1024,\n        guidance_scale=0.0,\n    ).images[0]\n    \n    output_dir = r\"D:\\AI-Models\\Z-Image\\outputs\"\n    os.makedirs(output_dir, exist_ok=True)\n    timestamp = datetime.now().strftime(\"%Y%m%d_%H%M%S\")\n    output_path = os.path.join(output_dir, f\"image_{timestamp}.png\")\n    image.save(output_path)\n    print(f\"\u5df2\u4fdd\u5b58: {output_path}\n\")<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">\u53c2\u6570\u8bf4\u660e<\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>\u53c2\u6570<\/th><th>\u63a8\u8350\u503c<\/th><th>\u8bf4\u660e<\/th><\/tr><\/thead><tbody><tr><td>num_inference_steps<\/td><td>9<\/td><td>Z-Image\u53ea\u97009\u6b65\u5373\u53ef\u51fa\u56fe<\/td><\/tr><tr><td>height\/width<\/td><td>1024<\/td><td>\u539f\u751f\u652f\u63011024&#215;1024<\/td><\/tr><tr><td>guidance_scale<\/td><td>0.0<\/td><td>Z-Image\u63a8\u8350\u8bbe\u4e3a0<\/td><\/tr><tr><td>torch_dtype<\/td><td>bfloat16<\/td><td>\u517c\u987e\u901f\u5ea6\u548c\u7cbe\u5ea6<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">\u4e0eFLUX2\u5bf9\u6bd4<\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>\u7279\u6027<\/th><th>Z-Image Turbo<\/th><th>FLUX2-Klein-9B<\/th><\/tr><\/thead><tbody><tr><td>\u53c2\u6570\u91cf<\/td><td>6B<\/td><td>9B<\/td><\/tr><tr><td>\u663e\u5b58\u9700\u6c42<\/td><td>12-16GB<\/td><td>10-12GB<\/td><\/tr><tr><td>\u63a8\u7406\u6b65\u6570<\/td><td>9\u6b65<\/td><td>20-30\u6b65<\/td><\/tr><tr><td>\u4e2d\u6587\u652f\u6301<\/td><td>\u6781\u5f3a<\/td><td>\u826f\u597d<\/td><\/tr><tr><td>\u8bb8\u53ef\u8bc1<\/td><td>Apache 2.0<\/td><td>\u6df7\u5408\u8bb8\u53ef<\/td><\/tr><tr><td>\u56fe\u50cf\u7f16\u8f91<\/td><td>\u4e0d\u652f\u6301<\/td><td>\u652f\u6301\u6362\u88c5\/\u6362\u80cc\u666f<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">\u5e38\u89c1\u95ee\u9898<\/h2>\n\n\n\n<p><strong>Q: \u4e0b\u8f7d\u901f\u5ea6\u6162\u600e\u4e48\u529e\uff1f<\/strong><br>A: \u53ef\u8bbe\u7f6eHuggingFace\u955c\u50cf\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>set HF_ENDPOINT=https:\/\/hf-mirror.com<\/code><\/pre>\n\n\n\n<p><strong>Q: \u5982\u4f55\u79bb\u7ebf\u4f7f\u7528\uff1f<\/strong><br>A: \u9996\u6b21\u4e0b\u8f7d\u5b8c\u6210\u540e\uff0c\u5c06\u4ee3\u7801\u4e2d <code>local_files_only=False<\/code> \u6539\u4e3a <code>True<\/code>\u3002<\/p>\n\n\n\n<p><strong>Q: \u663e\u5b58\u4e0d\u8db3\u600e\u4e48\u529e\uff1f<\/strong><br>A: \u5728 <code>pipe.to(\"cuda\")<\/code> \u524d\u6dfb\u52a0 <code>pipe.enable_model_cpu_offload()<\/code>\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u53c2\u8003\u94fe\u63a5<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Z-Image\u5b98\u65b9\u4ed3\u5e93: https:\/\/github.com\/Tongyi-MAI\/Z-Image<\/li>\n<li>HuggingFace\u6a21\u578b\u9875: https:\/\/huggingface.co\/Tongyi-MAI\/Z-Image-Turbo<\/li>\n<li>Diffusers\u6587\u6863: https:\/\/huggingface.co\/docs\/diffusers<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Z-Image Turbo \u662f\u963f\u91cc\u5df4\u5df4\u901a\u4e49\u5b9e\u9a8c\u5ba4\u5f00\u6e90\u76846B\u53c2\u6570\u56fe\u50cf\u751f\u6210\u6a21\u578b\uff0c\u652f\u6301\u4e2d\u82f1\u6587\u53cc\u8bed\u63d0\u793a\u8bcd\uff0c9\u6b65\u5373\u53ef\u751f\u6210 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[19],"tags":[],"class_list":["post-254","post","type-post","status-publish","format-standard","hentry","category-19"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/home.snu1e.top\/index.php\/wp-json\/wp\/v2\/posts\/254","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/home.snu1e.top\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/home.snu1e.top\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/home.snu1e.top\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/home.snu1e.top\/index.php\/wp-json\/wp\/v2\/comments?post=254"}],"version-history":[{"count":0,"href":"https:\/\/home.snu1e.top\/index.php\/wp-json\/wp\/v2\/posts\/254\/revisions"}],"wp:attachment":[{"href":"https:\/\/home.snu1e.top\/index.php\/wp-json\/wp\/v2\/media?parent=254"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/home.snu1e.top\/index.php\/wp-json\/wp\/v2\/categories?post=254"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/home.snu1e.top\/index.php\/wp-json\/wp\/v2\/tags?post=254"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}