{"id":1524,"date":"2025-02-23T19:25:23","date_gmt":"2025-02-23T11:25:23","guid":{"rendered":"https:\/\/www.izhuhn.cn\/?p=1524"},"modified":"2025-02-24T15:55:37","modified_gmt":"2025-02-24T07:55:37","slug":"macbookpro%e9%83%a8%e7%bd%b2deepseek-r1%e5%9f%ba%e4%ba%8eunsloth%e5%8a%a8%e6%80%81%e9%87%8f%e5%8c%96%e7%89%88%e6%9c%ac","status":"publish","type":"post","link":"https:\/\/www.izhuhn.cn\/index.php\/2025\/02\/23\/macbookpro%e9%83%a8%e7%bd%b2deepseek-r1%e5%9f%ba%e4%ba%8eunsloth%e5%8a%a8%e6%80%81%e9%87%8f%e5%8c%96%e7%89%88%e6%9c%ac\/","title":{"rendered":"MacBookPro\u90e8\u7f72DeepSeek-R1\u57fa\u4e8eUnsloth\u52a8\u6001\u91cf\u5316\u7248\u672c"},"content":{"rendered":"\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u4e00\u3001\u786c\u4ef6\u914d\u7f6e<\/h2>\n\n\n\n<p>\u5b98\u65b9\u5efa\u8bae\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>1.58 \u4f4d\u91cf\u5316\u5e94\u9002\u5408 160GB \u7684 VRAM \u4ee5\u8fdb\u884c\u5feb\u901f\u63a8\u7406\uff082x H100 80GB\uff09\uff0c\u541e\u5410\u91cf\u7ea6\u4e3a<strong>\u6bcf\u79d2 140 \u4e2a\u4ee4\u724c<\/strong>\uff0c\u5355\u7528\u6237\u63a8\u7406\u4e3a\u6bcf\u79d2 14 \u4e2a\u4ee4\u724c\u3002\u60a8\u4e0d\u9700\u8981 VRAM \uff08GPU\uff09 \u6765\u8fd0\u884c 1.58 \u4f4d R1\uff0c\u53ea\u9700 20GB \u7684 RAM \uff08CPU\uff09 \u5c31\u53ef\u4ee5\u5de5\u4f5c\uff0c\u4f46\u53ef\u80fd\u4f1a\u5f88\u6162\u3002\u4e3a\u4e86\u83b7\u5f97\u6700\u4f73\u6027\u80fd\uff0c\u6211\u4eec\u5efa\u8bae VRAM + RAM \u7684\u603b\u548c\u81f3\u5c11\u4e3a 80GB+\u3002<\/code><\/pre>\n\n\n\n<p>\u672c\u6b21\u90e8\u7f72\u914d\u7f6e:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>CPU:16\u6838\nRAM:64G\nVRAM:8G<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">\u4e8c\u3001\u52a8\u6001\u91cf\u5316\u5404\u7248\u672c\u7684\u5bf9\u6bd4<\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>MoE<\/td><td>DISK<\/td><td>Type<\/td><td>Quality<\/td><td>Link<\/td><td>Down_proj<\/td><\/tr><tr><td>1.58-bit<\/td><td><strong>131GB<\/strong><\/td><td>IQ1_S<\/td><td>\u516c\u5e73<\/td><td><a href=\"https:\/\/huggingface.co\/unsloth\/DeepSeek-R1-GGUF\/tree\/main\/DeepSeek-R1-UD-IQ1_S\" target=\"_blank\"  rel=\"nofollow\" >\u4e0b\u8f7d\u94fe\u63a5<\/a><\/td><td>2.06\/1.56bit<\/td><\/tr><tr><td>1.73-bit<\/td><td><strong>158GB<\/strong><\/td><td>IQ1_M<\/td><td>\u597d<\/td><td><a href=\"https:\/\/huggingface.co\/unsloth\/DeepSeek-R1-GGUF\/tree\/main\/DeepSeek-R1-UD-IQ1_M\" target=\"_blank\"  rel=\"nofollow\" >\u4e0b\u8f7d\u94fe\u63a5<\/a><\/td><td>2.06bit<\/td><\/tr><tr><td>2.22-bit<\/td><td><strong>183GB<\/strong><\/td><td>IQ2_XXS<\/td><td>\u66f4\u597d<\/td><td><a href=\"https:\/\/huggingface.co\/unsloth\/DeepSeek-R1-GGUF\/tree\/main\/DeepSeek-R1-UD-IQ2_XXS\" target=\"_blank\"  rel=\"nofollow\" >\u4e0b\u8f7d\u94fe\u63a5<\/a><\/td><td>2.5\/2.06bit<\/td><\/tr><tr><td>2.51-bit<\/td><td><strong>212GB<\/strong><\/td><td>Q2_K_XL<\/td><td>\u6700\u597d<\/td><td><a href=\"https:\/\/huggingface.co\/unsloth\/DeepSeek-R1-GGUF\/tree\/main\/DeepSeek-R1-UD-Q2_K_XL\" target=\"_blank\"  rel=\"nofollow\" >\u4e0b\u8f7d\u94fe\u63a5<\/a><\/td><td>3.5\/2.5bit<\/td><\/tr><\/tbody><\/table><figcaption class=\"wp-element-caption\">\u5176\u4ed6\u5b8c\u6574\u3001\u84b8\u998f\u7248\u672c\u53c2\u9605\u5b98\u7f51:<a href=\"https:\/\/huggingface.co\/collections\/unsloth\/deepseek-r1-all-versions-678e1c48f5d2fce87892ace5\" target=\"_blank\"  rel=\"nofollow\" >https:\/\/huggingface.co\/collections\/unsloth\/deepseek-r1-all-versions-678e1c48f5d2fce87892ace5<\/a><\/figcaption><\/figure>\n\n\n\n<p>\u5c42\u6570<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>Quant<\/td><td>File Size<\/td><td>24GB GPU<\/td><td>80GB GPU<\/td><td>2x80GB GPU<\/td><\/tr><tr><td>1.58bit<\/td><td>131GB<\/td><td>7<\/td><td>33<\/td><td>61<\/td><\/tr><tr><td>1.73bit<\/td><td>158GB<\/td><td>5<\/td><td>26<\/td><td>57<\/td><\/tr><tr><td>2.22bit<\/td><td>183GB<\/td><td>4<\/td><td>22<\/td><td>49<\/td><\/tr><tr><td>2.51bit<\/td><td>212GB<\/td><td>2<\/td><td>19<\/td><td>22<\/td><\/tr><\/tbody><\/table><figcaption class=\"wp-element-caption\">DeepSeek R1 \u6709 61 \u5c42\u3002\u4f8b\u5982\uff0c\u5bf9\u4e8e 24GB GPU \u6216 80GB GPU\uff0c\u60a8\u53ef\u4ee5\u9884\u671f\u5728\u5411\u4e0b\u820d\u5165\u540e\u5378\u8f7d\uff08\u5982\u679c\u5185\u5b58\u4e0d\u8db3\uff0c\u5219\u51cf\u5c11 1\uff09\uff1a<\/figcaption><\/figure>\n\n\n\n<p>\u4e5f\u53ef\u4ee5\u642d\u914dGRPO\u548cUnsloth\u84b8\u998f\u7248\u672c\u8fdb\u884c\u8bad\u7ec3\u81ea\u5df1\u7684\u63a8\u7406\u6a21\u578b <a href=\"https:\/\/unsloth.ai\/blog\/r1-reasoning\" data-type=\"link\" data-id=\"https:\/\/unsloth.ai\/blog\/r1-reasoning\" target=\"_blank\"  rel=\"nofollow\" >GRPO+Unsloth<\/a><\/p>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u4e09\u3001\u4e0b\u8f7d\u6a21\u578b\u6587\u4ef6<\/h2>\n\n\n\n<p>1.\u4e0b\u8f7d\u5e76\u5b89\u88c5XDM\u4e0b\u8f7d\u5668<\/p>\n\n\n\n<p><a href=\"https:\/\/xtremedownloadmanager.com\" target=\"_blank\"  rel=\"nofollow\" >https:\/\/xtremedownloadmanager.com<\/a><\/p>\n\n\n\n<p>2.\u9009\u62e9File&gt;Add URL <\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"610\" src=\"https:\/\/www.izhuhn.cn\/wp-content\/uploads\/2025\/02\/1739854973461-1024x610.png\" alt=\"\" class=\"wp-image-1538\" srcset=\"https:\/\/www.izhuhn.cn\/wp-content\/uploads\/2025\/02\/1739854973461-1024x610.png 1024w, https:\/\/www.izhuhn.cn\/wp-content\/uploads\/2025\/02\/1739854973461-300x179.png 300w, https:\/\/www.izhuhn.cn\/wp-content\/uploads\/2025\/02\/1739854973461-768x457.png 768w, https:\/\/www.izhuhn.cn\/wp-content\/uploads\/2025\/02\/1739854973461.png 1026w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>3.\u6253\u5f00\u6a21\u578b\u94fe\u63a5\u4f9d\u6b21\u5355\u4e2a\u6587\u4ef6\u590d\u5236\u5230XDM\u4e0b\u8f7d\u5668\u4e2d\uff0chttps:\/\/huggingface.co\/unsloth\/DeepSeek-R1-GGUF<\/p>\n\n\n\n<p><\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"769\" height=\"769\" src=\"https:\/\/www.izhuhn.cn\/wp-content\/uploads\/2025\/02\/image-69.png\" alt=\"\" class=\"wp-image-1539\" srcset=\"https:\/\/www.izhuhn.cn\/wp-content\/uploads\/2025\/02\/image-69.png 769w, https:\/\/www.izhuhn.cn\/wp-content\/uploads\/2025\/02\/image-69-300x300.png 300w, https:\/\/www.izhuhn.cn\/wp-content\/uploads\/2025\/02\/image-69-150x150.png 150w\" sizes=\"(max-width: 769px) 100vw, 769px\" \/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1018\" height=\"605\" src=\"https:\/\/www.izhuhn.cn\/wp-content\/uploads\/2025\/02\/image-72.png\" alt=\"\" class=\"wp-image-1545\" srcset=\"https:\/\/www.izhuhn.cn\/wp-content\/uploads\/2025\/02\/image-72.png 1018w, https:\/\/www.izhuhn.cn\/wp-content\/uploads\/2025\/02\/image-72-300x178.png 300w, https:\/\/www.izhuhn.cn\/wp-content\/uploads\/2025\/02\/image-72-768x456.png 768w\" sizes=\"(max-width: 1018px) 100vw, 1018px\" \/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<p>\u5982\u679c\u56fd\u5185\u7f51\u7edc\u4e0d\u901a\u7684\u60c5\u51b5\u4e0b\u53ef\u4ee5\u4fee\u6539\u4e0b\u89e3\u6790\uff1a<\/p>\n\n\n\n<p>#vi \/etc\/hosts<br>13.35.202.34 huggingface.co<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u56db\u3001\u5408\u5e76\u6a21\u578b\u6587\u4ef6<\/h2>\n\n\n\n<p>\u5c06\u4e0b\u8f7d\u7684 3 \u4e2a GGUF \u62c6\u5206\u6587\u4ef6\u5408\u5e76\u4e3a 1 \u4e2a(\u6839\u636e\u81ea\u5df1\u4e0b\u8f7d\u7684\u8fdb\u884c\u4fee\u6539\u547d\u4ee4\uff0c\u4e0b\u65b9\u63d0\u4f9b\u4e09\u4e2a\u6a21\u677f)<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># \/usr\/local\/Cellar\/llama.cpp\/4743\/bin\/llama-gguf-split --merge DeepSeek-R1-UD-IQ1_M-00001-of-00004.gguf DeepSeek-R1-UD-IQ1_M.gguf\n# \/usr\/local\/Cellar\/llama.cpp\/4743\/bin\/llama-gguf-split --merge DeepSeek-R1-Q4_K_M-00001-of-00009.gguf DeepSeek-R1-Q4_K_M.gguf\n# \/usr\/local\/Cellar\/llama.cpp\/4743\/bin\/llama-gguf-split --merge DeepSeek-R1-GGUF\/DeepSeek-R1-UD-IQ1_S\/DeepSeek-R1-UD-IQ1_S-00001-of-00003.gguf DeepSeek-R1-UD-IQ1_S.gguf<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"186\" src=\"https:\/\/www.izhuhn.cn\/wp-content\/uploads\/2025\/02\/image-78-1024x186.png\" alt=\"\" class=\"wp-image-1579\" srcset=\"https:\/\/www.izhuhn.cn\/wp-content\/uploads\/2025\/02\/image-78-1024x186.png 1024w, https:\/\/www.izhuhn.cn\/wp-content\/uploads\/2025\/02\/image-78-300x54.png 300w, https:\/\/www.izhuhn.cn\/wp-content\/uploads\/2025\/02\/image-78-768x139.png 768w, https:\/\/www.izhuhn.cn\/wp-content\/uploads\/2025\/02\/image-78-1536x279.png 1536w, https:\/\/www.izhuhn.cn\/wp-content\/uploads\/2025\/02\/image-78.png 1564w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u4e94\u3001\u4f7f\u7528llama\u5b89\u88c5\u90e8\u7f72(llama\u548collama\u4efb\u4e00\u5373\u53ef)<\/h2>\n\n\n\n<h2 class=\"wp-block-heading\"><\/h2>\n\n\n\n<p><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">MAC\u5b89\u88c5llama(mac \u5982\u679c\u662famd\u663e\u5361\u76ee\u524d\u6ca1\u6cd5\u7528\uff0c\u53ea\u80fd\u7528cpu)<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code># \/bin\/bash -c \"$(curl -fsSL https:\/\/raw.githubusercontent.com\/Homebrew\/install\/HEAD\/install.sh)\" #mac\u5b89\u88c5Brew\n# brew install llama.cpp<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"389\" src=\"https:\/\/www.izhuhn.cn\/wp-content\/uploads\/2025\/02\/image-79-1024x389.png\" alt=\"\" class=\"wp-image-1581\" srcset=\"https:\/\/www.izhuhn.cn\/wp-content\/uploads\/2025\/02\/image-79-1024x389.png 1024w, https:\/\/www.izhuhn.cn\/wp-content\/uploads\/2025\/02\/image-79-300x114.png 300w, https:\/\/www.izhuhn.cn\/wp-content\/uploads\/2025\/02\/image-79-768x292.png 768w, https:\/\/www.izhuhn.cn\/wp-content\/uploads\/2025\/02\/image-79-1536x584.png 1536w, https:\/\/www.izhuhn.cn\/wp-content\/uploads\/2025\/02\/image-79.png 1558w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"349\" src=\"https:\/\/www.izhuhn.cn\/wp-content\/uploads\/2025\/02\/image-80-1024x349.png\" alt=\"\" class=\"wp-image-1583\" srcset=\"https:\/\/www.izhuhn.cn\/wp-content\/uploads\/2025\/02\/image-80-1024x349.png 1024w, https:\/\/www.izhuhn.cn\/wp-content\/uploads\/2025\/02\/image-80-300x102.png 300w, https:\/\/www.izhuhn.cn\/wp-content\/uploads\/2025\/02\/image-80-768x262.png 768w, https:\/\/www.izhuhn.cn\/wp-content\/uploads\/2025\/02\/image-80.png 1274w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Linux\u5b89\u88c5llama<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>apt-get update\napt-get install build-essential cmake curl libcurl4-openssl-dev -y\ngit clone https:\/\/github.com\/ggerganov\/llama.cpp\ncmake llama.cpp -B llama.cpp\/build \\\n    -DBUILD_SHARED_LIBS=OFF -DGGML_CUDA=ON -DLLAMA_CURL=ON\ncmake --build llama.cpp\/build --config Release -j --clean-first --target llama-quantize llama-cli llama-gguf-split\ncp llama.cpp\/build\/bin\/llama-* llama.cpp\n\n\n\n\u66f4\u6539\u5b89\u88c5\u76ee\u5f55\nsudo systemctl edit ollama\n\n\u5e76\u5728\u7b2c\u4e8c\u884c\u540e\u6dfb\u52a0\u4ee5\u4e0b\u884c\uff08\u5373\u5728 \u201c\u201d \u548c \u201c\u201d\uff09 \u4e4b\u95f4### Anything between here and the comment below will become the contents of the drop-in file### Edits below this comment will be discarded\n\n&#91;Service]\nEnvironment=\"OLLAMA_MODELS=\/path\/to\/your\/directory\"\n\n\u7136\u540e\u91cd\u65b0\u542f\u52a8 ollama \u670d\u52a1\n\nsudo systemctl restart ollama<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>\nCUDA\u7f16\u8bd1:\n\u5df2\u5b89\u88c5CUDA toolkit \uff08\u9a71\u52a8\u56fa\u4ef6\uff09\ncmake -B build -DGGML_MUSA=ON \\\n  -DBUILD_SHARED_LIBS=OFF -DCMAKE_POSITION_INDEPENDENT_CODE=ON\ncmake --build build --config Release\n\nCANN\u7f16\u8bd1\uff1a\n\u5df2\u5b89\u88c5CANN Toolkit\uff08\u9a71\u52a8\u56fa\u4ef6\uff09\ncmake -B build -DGGML_CANN=on -DCMAKE_BUILD_TYPE=release\ncmake --build build --config release\n\u6d4b\u8bd5:.\/build\/bin\/llama-cli -m PATH_TO_MODEL -p \"Building a website can be done in 10 steps:\" -ngl 32\n\n\nHIP\u7f16\u8bd1:\n\u5df2\u5b89\u88c5ROCm\nHIPCXX=\"$(hipconfig -l)\/clang\" HIP_PATH=\"$(hipconfig -R)\" \\\n    cmake -S . -B build -DGGML_HIP=ON -DAMDGPU_TARGETS=gfx1030 -DCMAKE_BUILD_TYPE=Release \\\n    &amp;&amp; cmake --build build --config Release -- -j 16\n\u5728 Linux \u4e0a\uff0c\u8fd8\u53ef\u4ee5\u4f7f\u7528\u7edf\u4e00\u5185\u5b58\u67b6\u6784 \uff08UMA\uff09 \u5728 CPU \u548c\u96c6\u6210 GPU \u4e4b\u95f4\u5171\u4eab\u4e3b\u5185\u5b58\uff0c\u65b9\u6cd5\u662f\u5c06 . \u4f46\u662f\uff0c\u8fd9\u4f1a\u635f\u5bb3\u975e\u96c6\u6210 GPU \u7684\u6027\u80fd\uff08\u4f46\u5141\u8bb8\u4f7f\u7528\u96c6\u6210 GPU\uff09\u3002-DGGML_HIP_UMA=ON\n\u5b89\u88c5ROCm\n\n#brew install cmake llvm libfabric rocm-device-libs hipify clang-format hcc hip rocminfo rocprim rocrand rocsolver rocblas rocprim\n#brew install cmake llvm libfabric  clang-format\n\n\nMetal\u7f16\u8bd1:\n\u5728 MacOS \u4e0a\uff0cMetal \u9ed8\u8ba4\u5904\u4e8e\u542f\u7528\u72b6\u6001\u3002\u4f7f\u7528 Metal \u4f7f\u8ba1\u7b97\u5728 GPU \u4e0a\u8fd0\u884c\u3002 \u8981\u5728\u7f16\u8bd1\u65f6\u7981\u7528 Metal \u6784\u5efa\uff0c\u8bf7\u4f7f\u7528 cmake \u9009\u9879\u3002<code>-DGGML_METAL=OFF<\/code>\u4f7f\u7528 Metal \u652f\u6301\u6784\u5efa\u65f6\uff0c\u60a8\u53ef\u4ee5\u4f7f\u7528\u547d\u4ee4\u884c\u53c2\u6570\u663e\u5f0f\u7981\u7528 GPU \u63a8\u7406\u3002<code>--n-gpu-layers 0<\/code><\/code><\/pre>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u4f7f\u7528llama\u8fd0\u884c\u6a21\u578b<\/h3>\n\n\n\n<p>\u5728MAC\u4e0a\u8fd0\u884c\uff08\u4f8b\u5b50\u5bf9\u4e8e Apple Metal \u8bbe\u5907\uff0c\u8bf7\u6ce8\u610f --n-gpu-layers\u3002\u5982\u679c\u60a8\u53d1\u73b0\u8ba1\u7b97\u673a\u5185\u5b58\u4e0d\u8db3\uff0c\u8bf7\u51cf\u5c11\u5185\u5b58\u3002\u5bf9\u4e8e 128GB \u7684\u7edf\u4e00\u5185\u5b58\u8ba1\u7b97\u673a\uff0c\u60a8\u5e94\u8be5\u80fd\u591f\u5378\u8f7d 59 \u5c42\u5de6\u53f3\u3002\uff09<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>.\/llama.cpp\/llama-cli \\\n    --model DeepSeek-R1-GGUF\/DeepSeek-R1-UD-IQ1_S\/DeepSeek-R1-UD-IQ1_S-00001-of-00003.gguf \\\n    --cache-type-k q4_0 \\\n    --threads 16 \\\n    --prio 2 \\\n    --temp 0.6 \\\n    --ctx-size 8192 \\\n    --seed 3407 \\\n    --n-gpu-layers 59 \\\n    -no-cnv \\\n    --prompt \"&lt;\uff5cUser\uff5c>Create a Flappy Bird game in Python.&lt;\uff5cAssistant\uff5c>\"\n<\/code><\/pre>\n\n\n\n<p>--threads == \u4f60\u6709\u591a\u5c11\u4e2a CPU \u5185\u6838<\/p>\n\n\n\n<p>--ctx-size == \u8f93\u51fa\u7684\u4e0a\u4e0b\u6587\u957f\u5ea6<\/p>\n\n\n\n<p>--n-gpu-layers == \u8981\u5378\u8f7d\u5230\u4f60\u7684 GPU \u7684\u5c42\u6570\uff08\u4ece\u5c42\u6570\u8868\u4e2d\u83b7\u53d6\uff09<\/p>\n\n\n\n<p>   --prompt \u63d0\u95ee<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"261\" src=\"https:\/\/www.izhuhn.cn\/wp-content\/uploads\/2025\/02\/image-77-1024x261.png\" alt=\"\" class=\"wp-image-1577\" srcset=\"https:\/\/www.izhuhn.cn\/wp-content\/uploads\/2025\/02\/image-77-1024x261.png 1024w, https:\/\/www.izhuhn.cn\/wp-content\/uploads\/2025\/02\/image-77-300x76.png 300w, https:\/\/www.izhuhn.cn\/wp-content\/uploads\/2025\/02\/image-77-768x195.png 768w, https:\/\/www.izhuhn.cn\/wp-content\/uploads\/2025\/02\/image-77.png 1124w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><\/code><\/pre>\n\n\n\n<p>\u5728Linux\u4e0a\u8fd0\u884c\uff08\u4f8b\u5982\uff0c\u5728\u5177\u6709 24GB VRAM\/\u5185\u5b58\u7684 RTX 4090 GPU \u4e0a\uff0c\u6211\u4eec\u8fd9\u6837\u505a\uff1a\uff09<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>.\/llama.cpp\/llama-cli \\\n    --model DeepSeek-R1-GGUF\/DeepSeek-R1-UD-IQ1_S\/DeepSeek-R1-UD-IQ1_S-00001-of-00003.gguf \\\n    --cache-type-k q4_0 \\\n    --threads 16 \\\n    --prio 2 \\\n    --temp 0.6 \\\n    --ctx-size 8192 \\\n    --seed 3407 \\\n    --n-gpu-layers 7 \\\n    -no-cnv \\\n    --prompt \"&lt;\uff5cUser\uff5c&gt;Create a Flappy Bird game in Python.&lt;\uff5cAssistant\uff5c&gt;\"<\/code><\/pre>\n\n\n\n<p>--threads == \u4f60\u6709\u591a\u5c11\u4e2a CPU \u5185\u6838<\/p>\n\n\n\n<p>--ctx-size == \u8f93\u51fa\u7684\u4e0a\u4e0b\u6587\u957f\u5ea6<\/p>\n\n\n\n<p>--n-gpu-layers == \u8981\u5378\u8f7d\u5230\u4f60\u7684 GPU \u7684\u5c42\u6570\uff08\u4ece\u5c42\u6570\u8868\u4e2d\u83b7\u53d6\uff09<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u516d\u3001\u4f7f\u7528ollama\u5b89\u88c5\u90e8\u7f72(llama\u548collama\u4efb\u4e00\u5373\u53ef)<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>\n\n1.linux\u5b89\u88c5ollama\n# curl -fsSL https:\/\/ollama.com\/install.sh | sh\n2.mac\u5b89\u88c5ollama\nhttps:&#47;&#47;ollama.com\/download\n\u4e0b\u8f7d\u540e\u76f4\u63a5\u56fe\u5f62\u5316\u5b89\u88c5<\/code><\/pre>\n\n\n\n<p>2.\u521b\u5efa\u4e00\u4e2a\u6307\u5bfcollama\u521b\u5efa\u6a21\u578b\u7684\u6a21\u578b\u6587\u4ef6<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\u8fd9\u4e2aDeepSeekQ1_Modelfile \u4f7f\u7528\u7684\u662f DeepSeek-R1-UD-IQ1_M\n FROM \/home\/snowkylin\/DeepSeek-R1-UD-IQ1_M.gguf\n PARAMETER num_gpu 28\n PARAMETER num_ctx 2048\n PARAMETER temperature 0.6\n TEMPLATE \"&lt;\uff5cUser\uff5c&gt;{{ .System }} {{ .Prompt }}&lt;\uff5cAssistant\uff5c&gt;\"<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>\u8fd9\u4e2aDeepSeekQ4_Modelfile \u4f7f\u7528\u7684\u662f DeepSeek-R1-Q4_K_M\n FROM \/home\/snowkylin\/DeepSeek-R1-Q4_K_M.gguf\n PARAMETER num_gpu 8\n PARAMETER num_ctx 2048\n PARAMETER temperature 0.6\n TEMPLATE \"&lt;\uff5cUser\uff5c&gt;{{ .System }} {{ .Prompt }}&lt;\uff5cAssistant\uff5c&gt;\"\n<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>#num_gpu\u8981\u5378\u8f7d\u5230\u4f60\u7684 GPU \u7684\u5c42\u6570\uff08\u4ece\u5c42\u6570\u8868\u4e2d\u83b7\u53d6)\n#num_ctx \u4e0a\u4e0b\u6587\u957f\u5ea6 \u53ef\u4ee5\u5728\u5f00\u59cb\u65f6\u4fdd\u6301\u8f83\u5c0f\u503c\uff0c\u4ee5\u4fbf\u6a21\u578b\u9002\u5408\u5185\u5b58\uff0c\u7136\u540e\u60a8\u53ef\u4ee5\u9010\u6e10\u589e\u52a0\u5b83\uff0c\u76f4\u5230\u53d1\u751f OOM\u3002\n\n# vim DeepSeekIQ1_Modelfile\nFROM \/home\/test\/DeepSeek-R1-UD-IQ1_S.gguf\n PARAMETER num_gpu 8\n PARAMETER num_ctx 2048\n PARAMETER temperature 0.6\n TEMPLATE \"&lt;\uff5cUser\uff5c&gt;{{ .System }} {{ .Prompt }}&lt;\uff5cAssistant\uff5c&gt;\"<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"898\" height=\"196\" src=\"https:\/\/www.izhuhn.cn\/wp-content\/uploads\/2025\/02\/image-83.png\" alt=\"\" class=\"wp-image-1596\" srcset=\"https:\/\/www.izhuhn.cn\/wp-content\/uploads\/2025\/02\/image-83.png 898w, https:\/\/www.izhuhn.cn\/wp-content\/uploads\/2025\/02\/image-83-300x65.png 300w, https:\/\/www.izhuhn.cn\/wp-content\/uploads\/2025\/02\/image-83-768x168.png 768w\" sizes=\"(max-width: 898px) 100vw, 898px\" \/><\/figure>\n\n\n\n<p>3.\u5728ollama\u521b\u5efa\u6a21\u578b<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ollama create DeepSeek-R1-UD-IQ1_S -f DeepSeekQ1_Modelfile<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"179\" src=\"https:\/\/www.izhuhn.cn\/wp-content\/uploads\/2025\/02\/image-84-1024x179.png\" alt=\"\" class=\"wp-image-1599\" srcset=\"https:\/\/www.izhuhn.cn\/wp-content\/uploads\/2025\/02\/image-84-1024x179.png 1024w, https:\/\/www.izhuhn.cn\/wp-content\/uploads\/2025\/02\/image-84-300x53.png 300w, https:\/\/www.izhuhn.cn\/wp-content\/uploads\/2025\/02\/image-84-768x134.png 768w, https:\/\/www.izhuhn.cn\/wp-content\/uploads\/2025\/02\/image-84.png 1302w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>4.\u5728ollama\u8fd0\u884c\u6a21\u578b<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code> ollama run DeepSeek-R1-UD-IQ1_S --verbose<\/code><\/pre>\n\n\n\n<p>\u5982\u679c\u5728\u521d\u59cb\u5316\u6a21\u578b\u6216\u751f\u6210\u6a21\u578b\u65f6\u4ecd\u7136\u51fa\u73b0 OOM\/CUDA \u9519\u8bef\uff0c\u60a8\u4e5f\u53ef\u4ee5\u5c1d\u8bd5\u4ee5\u4e0b\u64cd\u4f5c<\/p>\n\n\n\n<ul>\n<li>\u589e\u52a0\u7cfb\u7edf\u7684\u4ea4\u6362\u7a7a\u95f4\u4ee5\u6269\u5927\u53ef\u7528\u7684 RAM\u3002\uff08\u6700\u597d\u4e0d\u8981\u4f9d\u8d56\u8fd9\u4e2a\uff0c\u8fd9\u4f1a\u5927\u5927\u51cf\u6162\u751f\u6210\u901f\u5ea6\u3002\u5f53 ollama \u9519\u8bef\u5730\u9ad8\u4f30\u4e86\u5185\u5b58\u9700\u6c42\u5e76\u4e14\u4e0d\u5141\u8bb8\u60a8\u8fd0\u884c\u6a21\u578b\u65f6\uff0c\u8bf7\u4f7f\u7528\u5b83\uff09<\/li>\n\n\n\n<li>\u5728\u6a21\u578b\u6587\u4ef6\u4e2d\u8bbe\u7f6e\u53c2\u6570\uff0c\u544a\u8bc9LLM\u5141\u8bb8\u751f\u6210\u7684\u6700\u5927\u4ee3\u5e01\u6570\u91cf\uff0c\u7136\u540e\u91cd\u65b0\u521b\u5efa\u5e76\u91cd\u65b0\u8fd0\u884c\u6a21\u578b\u3002<code>num_predict<\/code><\/li>\n<\/ul>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u5982\u4f55\u6307\u5b9a\u4e0a\u4e0b\u6587\u7a97\u53e3\u5927\u5c0f\uff1f<\/h2>\n\n\n\n<p><a href=\"https:\/\/github.com\/ollama\/ollama\/blob\/main\/docs\/faq.md#how-can-i-specify-the-context-window-size\" target=\"_blank\"  rel=\"nofollow\" ><\/a><\/p>\n\n\n\n<p>\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0cOllama \u4f7f\u7528\u7684\u4e0a\u4e0b\u6587\u7a97\u53e3\u5927\u5c0f\u4e3a 2048 \u4e2a\u4ee4\u724c\u3002<\/p>\n\n\n\n<p>\u8981\u5728\u4f7f\u7528 \u65f6\u66f4\u6539\u6b64\u8bbe\u7f6e\uff0c\u8bf7\u4f7f\u7528 \uff1a<code>ollama run<\/code><code>\/set parameter<\/code><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">\/set parameter num_ctx 4096<\/pre>\n\n\n\n<p><\/p>\n\n\n\n<p>ollama run DeepSeek-R1-UD-IQ1_S \/set parameter num_ctx 4096   --verbose<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u5982\u4f55\u5224\u65ad\u6211\u7684\u6a21\u578b\u662f\u5426\u5df2\u52a0\u8f7d\u5230 GPU \u4e0a\uff1f<\/h2>\n\n\n\n<p><a href=\"https:\/\/github.com\/ollama\/ollama\/blob\/main\/docs\/faq.md#how-can-i-tell-if-my-model-was-loaded-onto-the-gpu\" target=\"_blank\"  rel=\"nofollow\" ><\/a><\/p>\n\n\n\n<p>\u4f7f\u7528\u8be5\u547d\u4ee4\u67e5\u770b\u5f53\u524d\u52a0\u8f7d\u5230\u5185\u5b58\u4e2d\u7684\u6a21\u578b\u3002<code>ollama ps<\/code><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">ollama ps<\/pre>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p><strong>\u8f93\u51fa<\/strong>\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>NAME      \tID          \tSIZE \tPROCESSOR\tUNTIL\nllama3:70b\tbcfb190ca3a7\t42 GB\t100% GPU \t4 minutes from now\n<\/code><\/pre>\n\n\n\n<p>\u8be5\u5217\u5c06\u663e\u793a\u6a21\u578b\u52a0\u8f7d\u5230\u54ea\u4e2a\u5185\u5b58\uff1a<code>Processor<\/code><\/p>\n<\/blockquote>\n\n\n\n<ul>\n<li><code>100% GPU<\/code>\u8868\u793a\u6a21\u578b\u5df2\u5b8c\u5168\u52a0\u8f7d\u5230 GPU \u4e2d<\/li>\n\n\n\n<li><code>100% CPU<\/code>\u8868\u793a\u6a21\u578b\u5b8c\u5168\u52a0\u8f7d\u5230\u7cfb\u7edf\u5185\u5b58\u4e2d<\/li>\n\n\n\n<li><code>48%\/52% CPU\/GPU<\/code>\u8868\u793a\u6a21\u578b\u5df2\u90e8\u5206\u52a0\u8f7d\u5230 GPU \u548c\u7cfb\u7edf\u5185\u5b58\u4e2d<\/li>\n<\/ul>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code><br><br><br><\/code><\/pre>\n\n\n\n<p><\/p>\n\n\n\n<p>\u8fd0\u884cOllama\u5728Open WebUI<\/p>\n\n\n\n<p>##\u540e\u7eed<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>Ollama \u5229\u7528 AMD ROCm \u5e93\uff0c\u8be5\u5e93\u5e76\u4e0d\u652f\u6301\u6240\u6709 AMD GPU\u3002\u5728 \u5728\u67d0\u4e9b\u60c5\u51b5\u4e0b\uff0c\u60a8\u53ef\u4ee5\u5f3a\u5236\u7cfb\u7edf\u5c1d\u8bd5\u4f7f\u7528\u7c7b\u4f3c\u7684 LLVM \u76ee\u6807\uff0c\u5373 \u5173\u95ed\u3002\u4f8b\u5982\uff1aRadeon RX 5400 \u662f\uff08\u4e5f\u79f0\u4e3a 10.3.4\uff09 \u4f46\u662f\uff0cROCm \u76ee\u524d\u4e0d\u652f\u6301\u6b64\u76ee\u6807\u3002\u6700\u63a5\u8fd1\u7684\u652f\u6301\u662f \u3002\u60a8\u53ef\u4ee5\u5c06\u73af\u5883\u53d8\u91cf\u4e0e syntax \u4e00\u8d77\u4f7f\u7528\u3002\u56e0\u6b64\uff0c\u4f8b\u5982\uff0c\u8981\u5f3a\u5236\u7cfb\u7edf\u5728 RX 5400 \u4e0a\u8fd0\u884c\uff0c\u60a8\u9700\u8981 \u5c06\u8bbe\u7f6e\u4e3a \u670d\u52a1\u5668\u3002\u5982\u679c\u60a8\u6709\u4e0d\u53d7\u652f\u6301\u7684 AMD GPU\uff0c\u5219\u53ef\u4ee5\u4f7f\u7528 \u652f\u6301\u7684\u7c7b\u578b\u5982\u4e0b\u3002<code>gfx1034<\/code><code>gfx1030<\/code><code>HSA_OVERRIDE_GFX_VERSION<\/code><code>x.y.z<\/code><code>HSA_OVERRIDE_GFX_VERSION=\"10.3.0\"<\/code><\/p>\n\n\n\n<p>\u5982\u679c\u60a8\u6709\u591a\u4e2a\u5177\u6709\u4e0d\u540c GFX \u7248\u672c\u7684 GPU\uff0c\u8bf7\u9644\u52a0\u6570\u5b57\u8bbe\u5907 number \u6dfb\u52a0\u5230\u73af\u5883\u53d8\u91cf\u4e2d\u4ee5\u5355\u72ec\u8bbe\u7f6e\u5b83\u4eec\u3002\u4f8b\u5982\uff0c\u548c<code>HSA_OVERRIDE_GFX_VERSION_0=10.3.0<\/code><code>HSA_OVERRIDE_GFX_VERSION_1=11.0.0<\/code><\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>\u62a5\u9519\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>1. Error: llama runner process has terminated: GGML_ASSERT(hparams.n_expert &lt;= LLAMA_MAX_EXPERTS) failed<\/code><\/pre>\n\n\n\n<p>\u7248\u672c\u95ee\u9898\uff0c\u5347\u7ea7\u540e\u89e3\u51b3<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"576\" height=\"116\" src=\"https:\/\/www.izhuhn.cn\/wp-content\/uploads\/2025\/02\/image-85.png\" alt=\"\" class=\"wp-image-1605\" srcset=\"https:\/\/www.izhuhn.cn\/wp-content\/uploads\/2025\/02\/image-85.png 576w, https:\/\/www.izhuhn.cn\/wp-content\/uploads\/2025\/02\/image-85-300x60.png 300w\" sizes=\"(max-width: 576px) 100vw, 576px\" \/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<p>2.Error: llama runner process has terminated: signal: killed<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"68\" src=\"https:\/\/www.izhuhn.cn\/wp-content\/uploads\/2025\/02\/image-86-1024x68.png\" alt=\"\" class=\"wp-image-1607\" srcset=\"https:\/\/www.izhuhn.cn\/wp-content\/uploads\/2025\/02\/image-86-1024x68.png 1024w, https:\/\/www.izhuhn.cn\/wp-content\/uploads\/2025\/02\/image-86-300x20.png 300w, https:\/\/www.izhuhn.cn\/wp-content\/uploads\/2025\/02\/image-86-768x51.png 768w, https:\/\/www.izhuhn.cn\/wp-content\/uploads\/2025\/02\/image-86.png 1030w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>\u8d44\u6e90\u8017\u5c3d\u88ab\u7cfb\u7edf\u6740\u6389\u8fdb\u7a0b\uff0c\u6269\u5bb9\u786c\u4ef6\u6216\u8005\u964d\u4f4e\u6a21\u578b\u914d\u7f6e<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><code>export OLLAMA_KEEP_ALIVE=-1 export OLLAMA_SCHED_SPREAD=1<\/code><\/p>\n\n\n\n<p>\u8ba9Ollama\u8fd0\u884c\u65f6\u5c3d\u91cf\u5360\u6ee1GPU\uff0c\u7136\u540e\u91cd\u65b0Ollama run \u6a21\u578b<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>LLAMA github:<a href=\"https:\/\/github.com\/ggml-org\/llama.cpp.git\" target=\"_blank\"  rel=\"nofollow\" >https:\/\/github.com\/ggml-org\/llama.cpp.git<\/a><\/p>\n\n\n\n<p>unsloth: <a href=\"https:\/\/unsloth.ai\/blog\/deepseekr1-dynamic\" target=\"_blank\"  rel=\"nofollow\" >https:\/\/unsloth.ai\/blog\/deepseekr1-dynamic<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4e00\u3001\u786c\u4ef6\u914d\u7f6e \u5b98\u65b9\u5efa\u8bae\uff1a \u672c\u6b21\u90e8\u7f72\u914d\u7f6e: \u4e8c\u3001\u52a8\u6001\u91cf\u5316\u5404\u7248\u672c\u7684\u5bf9\u6bd4 MoE DISK Type Quality Link Down &#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/www.izhuhn.cn\/index.php\/wp-json\/wp\/v2\/posts\/1524"}],"collection":[{"href":"https:\/\/www.izhuhn.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.izhuhn.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.izhuhn.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.izhuhn.cn\/index.php\/wp-json\/wp\/v2\/comments?post=1524"}],"version-history":[{"count":91,"href":"https:\/\/www.izhuhn.cn\/index.php\/wp-json\/wp\/v2\/posts\/1524\/revisions"}],"predecessor-version":[{"id":1641,"href":"https:\/\/www.izhuhn.cn\/index.php\/wp-json\/wp\/v2\/posts\/1524\/revisions\/1641"}],"wp:attachment":[{"href":"https:\/\/www.izhuhn.cn\/index.php\/wp-json\/wp\/v2\/media?parent=1524"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.izhuhn.cn\/index.php\/wp-json\/wp\/v2\/categories?post=1524"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.izhuhn.cn\/index.php\/wp-json\/wp\/v2\/tags?post=1524"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}