{"id":89918,"date":"2026-08-04T06:48:41","date_gmt":"2026-08-03T22:48:41","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/89918.html"},"modified":"2026-08-04T06:48:41","modified_gmt":"2026-08-03T22:48:41","slug":"gemma-3-12b-it%e5%bc%80%e6%ba%90%e5%a4%a7%e6%a8%a1%e5%9e%8b%e9%83%a8%e7%bd%b2%e6%96%b9%e6%a1%88%ef%bc%9a23gb%e6%a8%a1%e5%9e%8b%e5%9c%a832gb%e5%86%85%e5%ad%98%e6%9c%8d%e5%8a%a1%e5%99%a8%e5%ae%9e","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/89918.html","title":{"rendered":"Gemma-3-12B-IT\u5f00\u6e90\u5927\u6a21\u578b\u90e8\u7f72\u65b9\u6848\uff1a23GB\u6a21\u578b\u572832GB\u5185\u5b58\u670d\u52a1\u5668\u5b9e\u6d4b"},"content":{"rendered":"<h2>Gemma-3-12B-IT\u5f00\u6e90\u5927\u6a21\u578b\u90e8\u7f72\u65b9\u6848&#xff1a;23GB\u6a21\u578b\u572832GB\u5185\u5b58\u670d\u52a1\u5668\u5b9e\u6d4b<\/h2>\n<h3>1. \u5f15\u8a00&#xff1a;\u4e3a\u4ec0\u4e48\u9009\u62e9Gemma-3-12B-IT&#xff1f;<\/h3>\n<p>\u5982\u679c\u4f60\u6b63\u5728\u5bfb\u627e\u4e00\u4e2a\u6027\u80fd\u5f3a\u52b2\u3001\u90e8\u7f72\u6210\u672c\u53ef\u63a7\u7684\u5f00\u6e90\u5927\u8bed\u8a00\u6a21\u578b&#xff0c;\u90a3\u4e48Google\u7684Gemma-3-12B-IT\u7edd\u5bf9\u503c\u5f97\u4f60\u82b1\u65f6\u95f4\u4e86\u89e3\u4e00\u4e0b\u3002\u6211\u6700\u8fd1\u5728\u4e00\u53f032GB\u5185\u5b58\u7684\u670d\u52a1\u5668\u4e0a\u5b8c\u6574\u90e8\u7f72\u5e76\u6d4b\u8bd5\u4e86\u8fd9\u4e2a\u6a21\u578b&#xff0c;\u6574\u4e2a\u8fc7\u7a0b\u6bd4\u60f3\u8c61\u4e2d\u8981\u987a\u5229\u5f97\u591a\u3002<\/p>\n<p>\u4f60\u53ef\u80fd\u542c\u8bf4\u8fc7\u52a8\u8f84\u51e0\u767eGB\u751a\u81f3\u4e0aTB\u7684\u5927\u6a21\u578b&#xff0c;\u90e8\u7f72\u8d77\u6765\u9700\u8981\u6602\u8d35\u7684\u4e13\u4e1a\u786c\u4ef6\u3002\u4f46Gemma-3-12B-IT\u53ea\u670923GB\u5927\u5c0f&#xff0c;\u5728\u666e\u901a\u670d\u52a1\u5668\u4e0a\u5c31\u80fd\u8dd1\u8d77\u6765&#xff0c;\u800c\u4e14\u6548\u679c\u76f8\u5f53\u4e0d\u9519\u3002\u5b83\u4e13\u95e8\u9488\u5bf9\u4eba\u7c7b\u6307\u4ee4\u8fdb\u884c\u4e86\u4f18\u5316&#xff0c;\u8fd9\u610f\u5473\u7740\u4f60\u4e0d\u9700\u8981\u590d\u6742\u7684\u63d0\u793a\u8bcd\u5de5\u7a0b&#xff0c;\u7528\u65e5\u5e38\u5bf9\u8bdd\u7684\u65b9\u5f0f\u5c31\u80fd\u83b7\u5f97\u9ad8\u8d28\u91cf\u7684\u56de\u590d\u3002<\/p>\n<p>\u8fd9\u7bc7\u6587\u7ae0\u6211\u4f1a\u5206\u4eab\u5b8c\u6574\u7684\u90e8\u7f72\u8fc7\u7a0b\u3001\u5b9e\u9645\u6d4b\u8bd5\u6548\u679c&#xff0c;\u4ee5\u53ca\u4e00\u4e9b\u4f60\u53ef\u80fd\u9047\u5230\u7684\u5751\u548c\u89e3\u51b3\u65b9\u6cd5\u3002\u65e0\u8bba\u4f60\u662f\u60f3\u642d\u5efa\u4e00\u4e2a\u5185\u90e8\u7684\u77e5\u8bc6\u95ee\u7b54\u52a9\u624b&#xff0c;\u8fd8\u662f\u9700\u8981\u4e00\u4e2a\u4ee3\u7801\u751f\u6210\u5de5\u5177&#xff0c;\u8fd9\u4e2a\u65b9\u6848\u90fd\u80fd\u7ed9\u4f60\u63d0\u4f9b\u53c2\u8003\u3002<\/p>\n<h3>2. \u6a21\u578b\u6982\u89c8&#xff1a;\u7b2c\u4e09\u4ee3Gemma\u7684\u6838\u5fc3\u5347\u7ea7<\/h3>\n<p>\u5728\u5f00\u59cb\u90e8\u7f72\u4e4b\u524d&#xff0c;\u6211\u4eec\u5148\u7b80\u5355\u4e86\u89e3\u4e00\u4e0bGemma-3-12B-IT\u5230\u5e95\u662f\u4ec0\u4e48&#xff0c;\u4ee5\u53ca\u5b83\u76f8\u6bd4\u524d\u4ee3\u6709\u54ea\u4e9b\u6539\u8fdb\u3002<\/p>\n<h4>2.1 \u6a21\u578b\u57fa\u672c\u4fe1\u606f<\/h4>\n<p>Gemma-3-12B-IT\u662fGoogle\u6700\u65b0\u53d1\u5e03\u7684\u8f7b\u91cf\u7ea7\u5f00\u6e90\u8bed\u8a00\u6a21\u578b&#xff0c;\u5c5e\u4e8eGemma\u7cfb\u5217\u7684\u7b2c\u4e09\u4ee3\u4ea7\u54c1\u3002\u8fd9\u91cc\u7684\u201c12B\u201d\u6307\u7684\u662f120\u4ebf\u53c2\u6570&#xff0c;\u8fd9\u4e2a\u89c4\u6a21\u5728\u5f53\u524d\u7684\u6a21\u578b\u751f\u6001\u4e2d\u5c5e\u4e8e\u201c\u751c\u70b9\u7ea7\u201d\u2014\u2014\u65e2\u6709\u4e0d\u9519\u7684\u6027\u80fd&#xff0c;\u53c8\u4e0d\u4f1a\u5bf9\u786c\u4ef6\u63d0\u51fa\u8fc7\u5206\u7684\u8981\u6c42\u3002<\/p>\n<p>\u201cIT\u201d\u4ee3\u8868Instruction Tuned&#xff0c;\u4e5f\u5c31\u662f\u6307\u4ee4\u5fae\u8c03\u7248\u672c\u3002\u8fd9\u610f\u5473\u7740\u6a21\u578b\u7ecf\u8fc7\u4e86\u4e13\u95e8\u7684\u8bad\u7ec3&#xff0c;\u80fd\u591f\u66f4\u597d\u5730\u7406\u89e3\u548c\u6267\u884c\u4eba\u7c7b\u7684\u6307\u4ee4\u3002\u6bd4\u5982\u4f60\u95ee\u201c\u5199\u4e00\u4e2aPython\u51fd\u6570\u6765\u8ba1\u7b97\u6590\u6ce2\u90a3\u5951\u6570\u5217\u201d&#xff0c;\u5b83\u4e0d\u4f1a\u7ed9\u4f60\u8bb2\u4e00\u5806\u6570\u5b66\u7406\u8bba&#xff0c;\u800c\u662f\u76f4\u63a5\u7ed9\u51fa\u53ef\u8fd0\u884c\u7684\u4ee3\u7801\u3002<\/p>\n<h4>2.2 \u76f8\u6bd4\u524d\u4ee3\u7684\u63d0\u5347<\/h4>\n<p>\u5982\u679c\u4f60\u7528\u8fc7Gemma 1\u6216Gemma 2&#xff0c;\u53ef\u80fd\u4f1a\u597d\u5947\u7b2c\u4e09\u4ee3\u5230\u5e95\u5f3a\u5728\u54ea\u91cc\u3002\u6839\u636e\u6211\u7684\u5b9e\u6d4b\u548c\u5b98\u65b9\u6587\u6863&#xff0c;\u4e3b\u8981\u63d0\u5347\u5728\u4e09\u4e2a\u65b9\u9762&#xff1a;<\/p>\n<p>\u63a8\u7406\u80fd\u529b\u660e\u663e\u589e\u5f3a&#xff1a;\u5728\u5904\u7406\u903b\u8f91\u63a8\u7406\u3001\u6570\u5b66\u8ba1\u7b97\u8fd9\u7c7b\u4efb\u52a1\u65f6&#xff0c;\u56de\u7b54\u7684\u51c6\u786e\u6027\u548c\u6761\u7406\u6027\u90fd\u6709\u63d0\u5347\u3002\u6211\u6d4b\u8bd5\u4e86\u51e0\u4e2a\u7ecf\u5178\u7684\u903b\u8f91\u8c1c\u9898&#xff0c;Gemma-3\u7684\u89e3\u9898\u601d\u8def\u66f4\u52a0\u6e05\u6670\u3002<\/p>\n<p>\u591a\u8bed\u8a00\u652f\u6301\u66f4\u597d&#xff1a;\u867d\u7136\u4e3b\u8981\u8fd8\u662f\u4ee5\u82f1\u6587\u8bad\u7ec3\u4e3a\u4e3b&#xff0c;\u4f46\u5bf9\u4e2d\u6587\u3001\u65e5\u6587\u3001\u6cd5\u6587\u7b49\u5176\u4ed6\u8bed\u8a00\u7684\u7406\u89e3\u548c\u751f\u6210\u80fd\u529b\u90fd\u6709\u6240\u6539\u5584\u3002\u6211\u7528\u4e2d\u6587\u63d0\u95ee\u65f6&#xff0c;\u5f97\u5230\u7684\u56de\u590d\u8d28\u91cf\u76f8\u5f53\u4e0d\u9519\u3002<\/p>\n<p>\u6548\u7387\u4f18\u5316\u663e\u8457&#xff1a;\u8fd9\u662f\u90e8\u7f72\u65f6\u611f\u53d7\u6700\u660e\u663e\u7684\u4e00\u70b9\u3002\u6a21\u578b\u5728\u63a8\u7406\u65f6\u7684\u5185\u5b58\u5360\u7528\u66f4\u52a0\u5408\u7406&#xff0c;\u54cd\u5e94\u901f\u5ea6\u4e5f\u66f4\u5feb\u3002\u5728\u540c\u6837\u7684\u786c\u4ef6\u6761\u4ef6\u4e0b&#xff0c;Gemma-3\u6bd4\u524d\u4ee3\u80fd\u5904\u7406\u66f4\u957f\u7684\u4e0a\u4e0b\u6587\u3002<\/p>\n<h4>2.3 \u9002\u5408\u54ea\u4e9b\u573a\u666f&#xff1f;<\/h4>\n<p>\u57fa\u4e8e\u6211\u7684\u6d4b\u8bd5&#xff0c;\u8fd9\u4e2a\u6a21\u578b\u7279\u522b\u9002\u5408\u4ee5\u4e0b\u51e0\u79cd\u5e94\u7528&#xff1a;<\/p>\n<ul>\n<li>\u7f16\u7a0b\u52a9\u624b&#xff1a;\u5199\u4ee3\u7801\u3001\u8c03\u8bd5\u3001\u4ee3\u7801\u89e3\u91ca\u3001\u6280\u672f\u65b9\u6848\u8bbe\u8ba1<\/li>\n<li>\u77e5\u8bc6\u95ee\u7b54&#xff1a;\u6280\u672f\u95ee\u9898\u89e3\u7b54\u3001\u6982\u5ff5\u89e3\u91ca\u3001\u5b66\u4e60\u8f85\u5bfc<\/li>\n<li>\u5185\u5bb9\u521b\u4f5c&#xff1a;\u5199\u6587\u7ae0\u3001\u5199\u90ae\u4ef6\u3001\u5199\u62a5\u544a\u3001\u521b\u610f\u5199\u4f5c<\/li>\n<li>\u5bf9\u8bdd\u7cfb\u7edf&#xff1a;\u667a\u80fd\u5ba2\u670d\u3001\u865a\u62df\u52a9\u624b\u3001\u804a\u5929\u673a\u5668\u4eba<\/li>\n<\/ul>\n<p>\u5982\u679c\u4f60\u9700\u8981\u4e00\u4e2a\u65e2\u5f3a\u5927\u53c8\u5bb9\u6613\u90e8\u7f72\u7684AI\u52a9\u624b&#xff0c;Gemma-3-12B-IT\u662f\u4e2a\u5f88\u4e0d\u9519\u7684\u9009\u62e9\u3002<\/p>\n<h3>3. \u786c\u4ef6\u8981\u6c42\u4e0e\u90e8\u7f72\u51c6\u5907<\/h3>\n<p>\u90e8\u7f72\u5927\u6a21\u578b\u542c\u8d77\u6765\u53ef\u80fd\u6709\u70b9\u5413\u4eba&#xff0c;\u4f46\u5176\u5b9e\u53ea\u8981\u786c\u4ef6\u8fbe\u6807&#xff0c;\u8fc7\u7a0b\u5e76\u4e0d\u590d\u6742\u3002\u4e0b\u9762\u662f\u6211\u5b9e\u6d4b\u7684\u786c\u4ef6\u8981\u6c42\u548c\u51c6\u5907\u5de5\u4f5c\u3002<\/p>\n<h4>3.1 \u670d\u52a1\u5668\u914d\u7f6e\u5efa\u8bae<\/h4>\n<p>\u6211\u7528\u7684\u662f\u4e00\u53f0\u6807\u51c6\u7684\u4e91\u670d\u52a1\u5668&#xff0c;\u914d\u7f6e\u5982\u4e0b&#xff1a;<\/p>\n<ul>\n<li>CPU&#xff1a;8\u6838 Intel Xeon<\/li>\n<li>\u5185\u5b58&#xff1a;32GB DDR4<\/li>\n<li>\u5b58\u50a8&#xff1a;200GB SSD<\/li>\n<li>GPU&#xff1a;\u65e0&#xff08;\u7eafCPU\u63a8\u7406&#xff09;<\/li>\n<li>\u7cfb\u7edf&#xff1a;Ubuntu 22.04 LTS<\/li>\n<\/ul>\n<p>\u4e3a\u4ec0\u4e48\u9009\u62e9\u8fd9\u4e2a\u914d\u7f6e&#xff1f;<\/p>\n<p>23GB\u7684\u6a21\u578b\u6587\u4ef6\u52a0\u8f7d\u5230\u5185\u5b58\u540e&#xff0c;\u52a0\u4e0a\u7cfb\u7edf\u5f00\u9500\u548c\u63a8\u7406\u65f6\u7684\u4e34\u65f6\u5185\u5b58&#xff0c;32GB\u5185\u5b58\u521a\u597d\u591f\u7528\u3002\u5982\u679c\u5185\u5b58\u518d\u5c0f\u4e00\u4e9b&#xff0c;\u6bd4\u598224GB&#xff0c;\u53ef\u80fd\u5c31\u9700\u8981\u4f7f\u7528\u91cf\u5316\u7248\u672c\u6216\u8005\u5916\u6302\u4ea4\u6362\u7a7a\u95f4&#xff0c;\u90a3\u6837\u4f1a\u5f71\u54cd\u63a8\u7406\u901f\u5ea6\u3002<\/p>\n<p>\u5982\u679c\u6ca1\u6709GPU\u600e\u4e48\u529e&#xff1f;<\/p>\n<p>\u5b8c\u5168\u6ca1\u95ee\u9898\u3002\u6211\u8fd9\u6b21\u6d4b\u8bd5\u5c31\u662f\u7eafCPU\u73af\u5883&#xff0c;\u867d\u7136\u63a8\u7406\u901f\u5ea6\u6bd4\u4e0d\u4e0aGPU&#xff08;\u5927\u7ea6\u6bcf\u79d2\u751f\u62103-5\u4e2atoken&#xff09;&#xff0c;\u4f46\u5bf9\u4e8e\u5927\u591a\u6570\u5bf9\u8bdd\u573a\u666f\u6765\u8bf4\u5b8c\u5168\u591f\u7528\u3002\u5982\u679c\u4f60\u6709NVIDIA GPU&#xff08;\u663e\u5b588GB\u4ee5\u4e0a&#xff09;&#xff0c;\u901f\u5ea6\u4f1a\u5feb\u5f88\u591a\u3002<\/p>\n<h4>3.2 \u8f6f\u4ef6\u73af\u5883\u51c6\u5907<\/h4>\n<p>\u5728\u5f00\u59cb\u90e8\u7f72\u4e4b\u524d&#xff0c;\u9700\u8981\u786e\u4fdd\u7cfb\u7edf\u73af\u5883\u6b63\u786e\u3002\u4ee5\u4e0b\u662f\u5fc5\u987b\u7684\u51c6\u5907\u5de5\u4f5c&#xff1a;<\/p>\n<p>\u7b2c\u4e00\u6b65&#xff1a;\u66f4\u65b0\u7cfb\u7edf\u5e76\u5b89\u88c5\u57fa\u7840\u5de5\u5177<\/p>\n<p># \u66f4\u65b0\u7cfb\u7edf\u5305<br \/>\nsudo apt update &amp;&amp; sudo apt upgrade -y<\/p>\n<p># \u5b89\u88c5\u5fc5\u8981\u7684\u5de5\u5177<br \/>\nsudo apt install -y python3-pip python3-venv git curl wget<\/p>\n<p># \u68c0\u67e5Python\u7248\u672c&#xff08;\u9700\u89813.10\u4ee5\u4e0a&#xff09;<br \/>\npython3 &#8211;version<\/p>\n<p>\u7b2c\u4e8c\u6b65&#xff1a;\u521b\u5efa\u4e13\u7528\u73af\u5883<\/p>\n<p>\u4e3a\u4e86\u907f\u514d\u4f9d\u8d56\u51b2\u7a81&#xff0c;\u5efa\u8bae\u4e3a\u6a21\u578b\u90e8\u7f72\u521b\u5efa\u72ec\u7acb\u7684Python\u73af\u5883&#xff1a;<\/p>\n<p># \u521b\u5efa\u9879\u76ee\u76ee\u5f55<br \/>\nmkdir -p ~\/gemma-3-deployment<br \/>\ncd ~\/gemma-3-deployment<\/p>\n<p># \u521b\u5efa\u865a\u62df\u73af\u5883<br \/>\npython3 -m venv venv<\/p>\n<p># \u6fc0\u6d3b\u73af\u5883<br \/>\nsource venv\/bin\/activate<\/p>\n<p>\u7b2c\u4e09\u6b65&#xff1a;\u5b89\u88c5PyTorch<\/p>\n<p>PyTorch\u662f\u8fd0\u884c\u6a21\u578b\u7684\u57fa\u7840\u6846\u67b6&#xff0c;\u9700\u8981\u6839\u636e\u4f60\u7684\u786c\u4ef6\u9009\u62e9\u6b63\u786e\u7684\u7248\u672c&#xff1a;<\/p>\n<p># \u5982\u679c\u662f\u7eafCPU\u73af\u5883<br \/>\npip install torch torchvision torchaudio &#8211;index-url https:\/\/download.pytorch.org\/whl\/cpu<\/p>\n<p># \u5982\u679c\u6709NVIDIA GPU&#xff08;CUDA 12.1&#xff09;<br \/>\npip install torch torchvision torchaudio &#8211;index-url https:\/\/download.pytorch.org\/whl\/cu121<\/p>\n<p>\u5b89\u88c5\u5b8c\u6210\u540e&#xff0c;\u53ef\u4ee5\u9a8c\u8bc1\u4e00\u4e0b&#xff1a;<\/p>\n<p># \u6d4b\u8bd5PyTorch\u662f\u5426\u5b89\u88c5\u6210\u529f<br \/>\npython3 -c &#034;import torch; print(f&#039;PyTorch\u7248\u672c: {torch.__version__}&#039;)&#034;<\/p>\n<h3>4. \u5b8c\u6574\u90e8\u7f72\u6b65\u9aa4\u8be6\u89e3<\/h3>\n<p>\u51c6\u5907\u597d\u4e86\u73af\u5883&#xff0c;\u6211\u4eec\u5c31\u53ef\u4ee5\u5f00\u59cb\u6b63\u5f0f\u7684\u90e8\u7f72\u4e86\u3002\u6574\u4e2a\u8fc7\u7a0b\u6211\u628a\u5b83\u5206\u4e3a\u56db\u4e2a\u4e3b\u8981\u6b65\u9aa4&#xff0c;\u8ddf\u7740\u505a\u5e94\u8be5\u4e0d\u4f1a\u6709\u4ec0\u4e48\u95ee\u9898\u3002<\/p>\n<h4>4.1 \u4e0b\u8f7d\u6a21\u578b\u6587\u4ef6<\/h4>\n<p>Gemma-3-12B-IT\u7684\u6a21\u578b\u6587\u4ef6\u5927\u7ea623GB&#xff0c;\u4e0b\u8f7d\u9700\u8981\u4e00\u4e9b\u65f6\u95f4\u548c\u8db3\u591f\u7684\u78c1\u76d8\u7a7a\u95f4\u3002<\/p>\n<p>\u65b9\u6cd5\u4e00&#xff1a;\u4eceHugging Face\u4e0b\u8f7d&#xff08;\u63a8\u8350&#xff09;<\/p>\n<p># \u5b89\u88c5huggingface-cli<br \/>\npip install huggingface-hub<\/p>\n<p># \u8bbe\u7f6e\u7f13\u5b58\u76ee\u5f55&#xff08;\u786e\u4fdd\u6709\u8db3\u591f\u7a7a\u95f4&#xff09;<br \/>\nexport HF_HOME&#061;~\/hf_cache<\/p>\n<p># \u4e0b\u8f7d\u6a21\u578b<br \/>\npython3 -c &#034;<br \/>\nfrom huggingface_hub import snapshot_download<br \/>\nsnapshot_download(<br \/>\n    repo_id&#061;&#039;google\/gemma-3-12b-it&#039;,<br \/>\n    local_dir&#061;&#039;.\/gemma-3-12b-it&#039;,<br \/>\n    ignore_patterns&#061;[&#039;*.safetensors&#039;, &#039;*.bin&#039;],  # \u53ea\u4e0b\u8f7d\u5fc5\u8981\u7684\u6587\u4ef6<br \/>\n    local_dir_use_symlinks&#061;False<br \/>\n)<br \/>\n&#034;<\/p>\n<p>\u65b9\u6cd5\u4e8c&#xff1a;\u624b\u52a8\u4e0b\u8f7d&#xff08;\u5982\u679c\u7f51\u7edc\u4e0d\u7a33\u5b9a&#xff09;<\/p>\n<p>\u5982\u679c\u76f4\u63a5\u4eceHugging Face\u4e0b\u8f7d\u901f\u5ea6\u592a\u6162&#xff0c;\u53ef\u4ee5\u5c1d\u8bd5\u7528\u5176\u4ed6\u65b9\u5f0f&#xff1a;<\/p>\n<p># \u4f7f\u7528wget\u5206\u6bb5\u4e0b\u8f7d&#xff08;\u5982\u679c\u6709\u76f4\u94fe&#xff09;<br \/>\n# \u6216\u8005\u4f7f\u7528\u56fd\u5185\u955c\u50cf\u6e90<\/p>\n<p># \u521b\u5efa\u6a21\u578b\u76ee\u5f55<br \/>\nmkdir -p ~\/models\/gemma-3-12b-it<br \/>\ncd ~\/models\/gemma-3-12b-it<\/p>\n<p># \u8fd9\u91cc\u9700\u8981\u6839\u636e\u5b9e\u9645\u53ef\u7528\u7684\u4e0b\u8f7d\u94fe\u63a5\u6765\u8c03\u6574<br \/>\n# \u901a\u5e38\u53ef\u4ee5\u5728Hugging Face\u9875\u9762\u627e\u5230\u4e0b\u8f7d\u94fe\u63a5<\/p>\n<p>\u4e0b\u8f7d\u5b8c\u6210\u540e&#xff0c;\u68c0\u67e5\u6587\u4ef6\u5927\u5c0f&#xff1a;<\/p>\n<p># \u67e5\u770b\u6a21\u578b\u6587\u4ef6\u5927\u5c0f<br \/>\ndu -sh ~\/models\/gemma-3-12b-it\/<\/p>\n<p># \u5e94\u8be5\u663e\u793a\u5927\u7ea623GB<\/p>\n<h4>4.2 \u5b89\u88c5\u63a8\u7406\u6846\u67b6<\/h4>\n<p>\u6211\u9009\u62e9\u4e86\u4e24\u4e2a\u6bd4\u8f83\u6d41\u884c\u7684\u6846\u67b6\u8fdb\u884c\u6d4b\u8bd5&#xff1a;Transformers\u548cllama.cpp\u3002\u524d\u8005\u529f\u80fd\u5168\u9762&#xff0c;\u540e\u8005\u5728CPU\u4e0a\u6548\u7387\u66f4\u9ad8\u3002<\/p>\n<p>\u5b89\u88c5Transformers\u548c\u76f8\u5173\u4f9d\u8d56<\/p>\n<p># \u786e\u4fdd\u5728\u865a\u62df\u73af\u5883\u4e2d<br \/>\nsource venv\/bin\/activate<\/p>\n<p># \u5b89\u88c5\u5fc5\u8981\u7684\u5e93<br \/>\npip install transformers accelerate sentencepiece protobuf<\/p>\n<p># \u5982\u679c\u9700\u8981Web\u754c\u9762&#xff0c;\u53ef\u4ee5\u5b89\u88c5Gradio<br \/>\npip install gradio&#061;&#061;4.19.2<\/p>\n<p>\u5b89\u88c5llama.cpp&#xff08;\u53ef\u9009&#xff0c;\u7528\u4e8eCPU\u4f18\u5316&#xff09;<\/p>\n<p>\u5982\u679c\u4f60\u4e3b\u8981\u5728CPU\u4e0a\u8fd0\u884c&#xff0c;llama.cpp\u80fd\u63d0\u4f9b\u66f4\u597d\u7684\u6027\u80fd&#xff1a;<\/p>\n<p># \u514b\u9686\u4ed3\u5e93<br \/>\ngit clone https:\/\/github.com\/ggerganov\/llama.cpp<br \/>\ncd llama.cpp<\/p>\n<p># \u7f16\u8bd1<br \/>\nmake -j4<\/p>\n<p># \u5c06\u6a21\u578b\u8f6c\u6362\u4e3agguf\u683c\u5f0f&#xff08;\u9700\u8981\u5148\u4e0b\u8f7d\u539f\u59cb\u6a21\u578b&#xff09;<br \/>\npython3 convert.py ~\/models\/gemma-3-12b-it &#8211;outfile gemma-3-12b-it.gguf<\/p>\n<p># \u91cf\u5316\u6a21\u578b\u4ee5\u51cf\u5c0f\u5927\u5c0f&#xff08;\u53ef\u9009&#xff09;<br \/>\n.\/quantize gemma-3-12b-it.gguf gemma-3-12b-it-q4_0.gguf q4_0<\/p>\n<h4>4.3 \u914d\u7f6eWeb UI\u754c\u9762<\/h4>\n<p>\u4e3a\u4e86\u8ba9\u6a21\u578b\u66f4\u5bb9\u6613\u4f7f\u7528&#xff0c;\u6211\u642d\u5efa\u4e86\u4e00\u4e2a\u7b80\u5355\u7684Web\u754c\u9762\u3002\u8fd9\u91cc\u6211\u7528Gradio&#xff0c;\u5b83\u8db3\u591f\u8f7b\u91cf\u4e14\u5bb9\u6613\u914d\u7f6e\u3002<\/p>\n<p>\u521b\u5efaWeb\u5e94\u7528\u6587\u4ef6<\/p>\n<p># app.py<br \/>\nimport gradio as gr<br \/>\nfrom transformers import AutoTokenizer, AutoModelForCausalLM<br \/>\nimport torch<br \/>\nimport time<\/p>\n<p>class GemmaChatbot:<br \/>\n    def __init__(self, model_path):<br \/>\n        print(&#034;\u6b63\u5728\u52a0\u8f7d\u6a21\u578b&#8230;&#034;)<br \/>\n        start_time &#061; time.time()<\/p>\n<p>        # \u52a0\u8f7dtokenizer\u548c\u6a21\u578b<br \/>\n        self.tokenizer &#061; AutoTokenizer.from_pretrained(model_path)<br \/>\n        self.model &#061; AutoModelForCausalLM.from_pretrained(<br \/>\n            model_path,<br \/>\n            torch_dtype&#061;torch.float16 if torch.cuda.is_available() else torch.float32,<br \/>\n            device_map&#061;&#034;auto&#034; if torch.cuda.is_available() else &#034;cpu&#034;,<br \/>\n            low_cpu_mem_usage&#061;True<br \/>\n        )<\/p>\n<p>        # \u5982\u679c\u662fCPU\u73af\u5883&#xff0c;\u4f7f\u7528\u66f4\u8282\u7701\u5185\u5b58\u7684\u6a21\u5f0f<br \/>\n        if not torch.cuda.is_available():<br \/>\n            self.model &#061; self.model.to(torch.float32)<\/p>\n<p>        load_time &#061; time.time() &#8211; start_time<br \/>\n        print(f&#034;\u6a21\u578b\u52a0\u8f7d\u5b8c\u6210&#xff0c;\u8017\u65f6: {load_time:.2f}\u79d2&#034;)<\/p>\n<p>        # \u521d\u59cb\u5316\u5bf9\u8bdd\u5386\u53f2<br \/>\n        self.conversation_history &#061; []<\/p>\n<p>    def generate_response(self, message, history, temperature&#061;0.7, max_tokens&#061;512):<br \/>\n        # \u6784\u5efa\u63d0\u793a<br \/>\n        prompt &#061; self._build_prompt(message, history)<\/p>\n<p>        # \u7f16\u7801\u8f93\u5165<br \/>\n        inputs &#061; self.tokenizer(prompt, return_tensors&#061;&#034;pt&#034;)<\/p>\n<p>        # \u751f\u6210\u56de\u590d<br \/>\n        with torch.no_grad():<br \/>\n            outputs &#061; self.model.generate(<br \/>\n                inputs.input_ids,<br \/>\n                max_new_tokens&#061;max_tokens,<br \/>\n                temperature&#061;temperature,<br \/>\n                do_sample&#061;True,<br \/>\n                top_p&#061;0.9,<br \/>\n                pad_token_id&#061;self.tokenizer.eos_token_id<br \/>\n            )<\/p>\n<p>        # \u89e3\u7801\u56de\u590d<br \/>\n        response &#061; self.tokenizer.decode(outputs[0][inputs.input_ids.shape[1]:], skip_special_tokens&#061;True)<\/p>\n<p>        # \u66f4\u65b0\u5386\u53f2<br \/>\n        self.conversation_history.append((message, response))<\/p>\n<p>        return response<\/p>\n<p>    def _build_prompt(self, message, history):<br \/>\n        # \u7b80\u5355\u7684\u63d0\u793a\u6784\u5efa<br \/>\n        prompt &#061; &#034;&lt;start_of_turn&gt;user\\\\n&#034;<br \/>\n        prompt &#043;&#061; message &#043; &#034;&lt;end_of_turn&gt;\\\\n&#034;<br \/>\n        prompt &#043;&#061; &#034;&lt;start_of_turn&gt;model\\\\n&#034;<br \/>\n        return prompt<\/p>\n<p># \u521d\u59cb\u5316\u804a\u5929\u673a\u5668\u4eba<br \/>\nmodel_path &#061; &#034;\/root\/models\/gemma-3-12b-it&#034;  # \u4fee\u6539\u4e3a\u4f60\u7684\u6a21\u578b\u8def\u5f84<br \/>\nchatbot &#061; GemmaChatbot(model_path)<\/p>\n<p># \u521b\u5efaGradio\u754c\u9762<br \/>\ndef chat_interface(message, history, temperature, max_tokens):<br \/>\n    response &#061; chatbot.generate_response(message, history, temperature, max_tokens)<br \/>\n    return response<\/p>\n<p># \u6784\u5efaWeb\u754c\u9762<br \/>\nwith gr.Blocks(title&#061;&#034;Gemma-3-12B-IT Chatbot&#034;) as demo:<br \/>\n    gr.Markdown(&#034;# &#x1f916; Gemma-3-12B-IT \u804a\u5929\u52a9\u624b&#034;)<br \/>\n    gr.Markdown(&#034;\u57fa\u4e8eGoogle Gemma-3-12B-IT\u6a21\u578b\u7684\u5bf9\u8bdd\u7cfb\u7edf&#034;)<\/p>\n<p>    chatbot &#061; gr.Chatbot(height&#061;400)<br \/>\n    msg &#061; gr.Textbox(label&#061;&#034;\u8f93\u5165\u4f60\u7684\u95ee\u9898&#034;, placeholder&#061;&#034;\u5728\u8fd9\u91cc\u8f93\u5165&#8230;&#034;)<\/p>\n<p>    with gr.Row():<br \/>\n        temperature &#061; gr.Slider(0.1, 1.5, value&#061;0.7, label&#061;&#034;Temperature&#034;, info&#061;&#034;\u63a7\u5236\u56de\u590d\u7684\u968f\u673a\u6027&#034;)<br \/>\n        max_tokens &#061; gr.Slider(64, 2048, value&#061;512, step&#061;64, label&#061;&#034;\u6700\u5927\u751f\u6210\u957f\u5ea6&#034;)<\/p>\n<p>    with gr.Row():<br \/>\n        submit &#061; gr.Button(&#034;\u53d1\u9001&#034;)<br \/>\n        clear &#061; gr.Button(&#034;\u6e05\u7a7a\u5bf9\u8bdd&#034;)<\/p>\n<p>    def respond(message, chat_history, temp, tokens):<br \/>\n        bot_message &#061; chatbot.generate_response(message, chat_history, temp, tokens)<br \/>\n        chat_history.append((message, bot_message))<br \/>\n        return &#034;&#034;, chat_history<\/p>\n<p>    msg.submit(respond, [msg, chatbot, temperature, max_tokens], [msg, chatbot])<br \/>\n    submit.click(respond, [msg, chatbot, temperature, max_tokens], [msg, chatbot])<\/p>\n<p>    clear.click(lambda: None, None, chatbot, queue&#061;False)<\/p>\n<p># \u542f\u52a8\u670d\u52a1<br \/>\nif __name__ &#061;&#061; &#034;__main__&#034;:<br \/>\n    demo.launch(<br \/>\n        server_name&#061;&#034;0.0.0.0&#034;,<br \/>\n        server_port&#061;7860,<br \/>\n        share&#061;False<br \/>\n    )<\/p>\n<p>\u521b\u5efa\u542f\u52a8\u811a\u672c<\/p>\n<p># start.sh<br \/>\n#!\/bin\/bash<\/p>\n<p># \u6fc0\u6d3b\u865a\u62df\u73af\u5883<br \/>\nsource ~\/gemma-3-deployment\/venv\/bin\/activate<\/p>\n<p># \u542f\u52a8Web\u670d\u52a1<br \/>\ncd ~\/gemma-3-deployment<br \/>\npython app.py<\/p>\n<p>\u7ed9\u811a\u672c\u6267\u884c\u6743\u9650&#xff1a;<\/p>\n<p>chmod &#043;x start.sh<\/p>\n<h4>4.4 \u5185\u5b58\u4f18\u5316\u4e0e\u76d1\u63a7<\/h4>\n<p>\u572832GB\u5185\u5b58\u7684\u670d\u52a1\u5668\u4e0a\u8fd0\u884c23GB\u7684\u6a21\u578b&#xff0c;\u5185\u5b58\u7ba1\u7406\u5f88\u91cd\u8981\u3002\u4ee5\u4e0b\u662f\u6211\u7528\u7684\u4e00\u4e9b\u4f18\u5316\u6280\u5de7&#xff1a;<\/p>\n<p>\u76d1\u63a7\u5185\u5b58\u4f7f\u7528<\/p>\n<p># \u5b9e\u65f6\u76d1\u63a7\u5185\u5b58\u4f7f\u7528<br \/>\nwatch -n 1 &#034;free -h&#034;<\/p>\n<p># \u6216\u8005\u4f7f\u7528htop<br \/>\nhtop<\/p>\n<p>\u4f18\u5316Python\u5185\u5b58\u4f7f\u7528<\/p>\n<p>\u5728app.py\u4e2d\u6dfb\u52a0\u5185\u5b58\u4f18\u5316\u914d\u7f6e&#xff1a;<\/p>\n<p>import os<br \/>\nimport gc<\/p>\n<p># \u8bbe\u7f6ePyTorch\u5185\u5b58\u5206\u914d\u7b56\u7565<br \/>\nos.environ[&#039;PYTORCH_CUDA_ALLOC_CONF&#039;] &#061; &#039;max_split_size_mb:128&#039;<\/p>\n<p># \u5b9a\u671f\u6e05\u7406\u5185\u5b58<br \/>\ndef cleanup_memory():<br \/>\n    gc.collect()<br \/>\n    if torch.cuda.is_available():<br \/>\n        torch.cuda.empty_cache()<\/p>\n<p>\u4f7f\u7528\u4ea4\u6362\u7a7a\u95f4&#xff08;\u5982\u679c\u5185\u5b58\u7d27\u5f20&#xff09;<\/p>\n<p>\u5982\u679c32GB\u5185\u5b58\u4e0d\u591f\u7528&#xff0c;\u53ef\u4ee5\u6dfb\u52a0\u4ea4\u6362\u7a7a\u95f4&#xff1a;<\/p>\n<p># \u521b\u5efa8GB\u7684\u4ea4\u6362\u6587\u4ef6<br \/>\nsudo fallocate -l 8G \/swapfile<br \/>\nsudo chmod 600 \/swapfile<br \/>\nsudo mkswap \/swapfile<br \/>\nsudo swapon \/swapfile<\/p>\n<p># \u6c38\u4e45\u751f\u6548<br \/>\necho &#039;\/swapfile none swap sw 0 0&#039; | sudo tee -a \/etc\/fstab<\/p>\n<h3>5. \u5b9e\u6d4b\u6548\u679c\u4e0e\u6027\u80fd\u5206\u6790<\/h3>\n<p>\u90e8\u7f72\u5b8c\u6210\u540e&#xff0c;\u6211\u8fdb\u884c\u4e86\u4e00\u7cfb\u5217\u6d4b\u8bd5&#xff0c;\u770b\u770b\u8fd9\u4e2a\u6a21\u578b\u5728\u5b9e\u9645\u4f7f\u7528\u4e2d\u7684\u8868\u73b0\u5982\u4f55\u3002<\/p>\n<h4>5.1 \u542f\u52a8\u65f6\u95f4\u4e0e\u8d44\u6e90\u5360\u7528<\/h4>\n<p>\u6a21\u578b\u52a0\u8f7d\u65f6\u95f4<\/p>\n<p>\u572832GB\u5185\u5b58\u7684\u670d\u52a1\u5668\u4e0a&#xff0c;\u7eafCPU\u73af\u5883\u4e0b\u7684\u52a0\u8f7d\u65f6\u95f4&#xff1a;<\/p>\n<ul>\n<li>\u9996\u6b21\u52a0\u8f7d&#xff1a;\u7ea62\u520630\u79d2<\/li>\n<li>\u70ed\u542f\u52a8&#xff1a;\u7ea61\u520610\u79d2&#xff08;\u5982\u679c\u6a21\u578b\u5df2\u90e8\u5206\u7f13\u5b58&#xff09;<\/li>\n<\/ul>\n<p>\u5185\u5b58\u5360\u7528\u60c5\u51b5<\/p>\n<p>\u6a21\u578b\u8fd0\u884c\u65f6\u7684\u5185\u5b58\u4f7f\u7528&#xff1a;<\/p>\n<ul>\n<li>\u6a21\u578b\u52a0\u8f7d\u540e&#xff1a;\u7ea625GB&#xff08;\u6a21\u578b\u672c\u8eab23GB &#043; \u7cfb\u7edf\u5f00\u9500&#xff09;<\/li>\n<li>\u63a8\u7406\u8fc7\u7a0b\u4e2d&#xff1a;\u5cf0\u503c\u7ea628GB<\/li>\n<li>\u7a7a\u95f2\u65f6&#xff1a;\u7ea625GB<\/li>\n<\/ul>\n<p>CPU\u4f7f\u7528\u7387<\/p>\n<ul>\n<li>\u52a0\u8f7d\u9636\u6bb5&#xff1a;\u6240\u6709\u6838\u5fc3100%&#xff0c;\u6301\u7eed\u7ea62\u5206\u949f<\/li>\n<li>\u63a8\u7406\u9636\u6bb5&#xff1a;4-6\u4e2a\u6838\u5fc350-80%\u4f7f\u7528\u7387<\/li>\n<li>\u7a7a\u95f2\u65f6&#xff1a;\u63a5\u8fd10%<\/li>\n<\/ul>\n<h4>5.2 \u63a8\u7406\u901f\u5ea6\u6d4b\u8bd5<\/h4>\n<p>\u6211\u6d4b\u8bd5\u4e86\u4e0d\u540c\u7c7b\u578b\u95ee\u9898\u7684\u54cd\u5e94\u901f\u5ea6&#xff1a;<\/p>\n<p># \u6d4b\u8bd5\u4ee3\u7801\u793a\u4f8b<br \/>\ntest_cases &#061; [<br \/>\n    (&#034;\u7b80\u5355\u95ee\u5019&#034;, &#034;\u4f60\u597d&#xff0c;\u8bf7\u4ecb\u7ecd\u4e00\u4e0b\u4f60\u81ea\u5df1&#034;),<br \/>\n    (&#034;\u4ee3\u7801\u751f\u6210&#034;, &#034;\u5199\u4e00\u4e2aPython\u51fd\u6570\u6765\u8ba1\u7b97\u6590\u6ce2\u90a3\u5951\u6570\u5217&#034;),<br \/>\n    (&#034;\u77e5\u8bc6\u95ee\u7b54&#034;, &#034;\u89e3\u91ca\u4e00\u4e0b\u91cf\u5b50\u8ba1\u7b97\u7684\u57fa\u672c\u539f\u7406&#034;),<br \/>\n    (&#034;\u903b\u8f91\u63a8\u7406&#034;, &#034;\u5982\u679c\u6240\u6709\u7684\u732b\u90fd\u6015\u6c34&#xff0c;\u800c\u6c64\u59c6\u662f\u4e00\u53ea\u732b&#xff0c;\u90a3\u4e48\u6c64\u59c6\u6015\u6c34\u5417&#xff1f;&#034;),<br \/>\n]<\/p>\n<p>\u54cd\u5e94\u65f6\u95f4\u7edf\u8ba1&#xff08;\u7eafCPU\u73af\u5883&#xff09;&#xff1a;<\/p>\n<table>\n<tr>\u95ee\u9898\u7c7b\u578b\u5e73\u5747\u54cd\u5e94\u65f6\u95f4\u751f\u6210token\u6570<\/tr>\n<tbody>\n<tr>\n<td>\u7b80\u5355\u95ee\u5019<\/td>\n<td>3-5\u79d2<\/td>\n<td>50-100<\/td>\n<\/tr>\n<tr>\n<td>\u4ee3\u7801\u751f\u6210<\/td>\n<td>8-15\u79d2<\/td>\n<td>150-300<\/td>\n<\/tr>\n<tr>\n<td>\u77e5\u8bc6\u95ee\u7b54<\/td>\n<td>6-10\u79d2<\/td>\n<td>100-200<\/td>\n<\/tr>\n<tr>\n<td>\u903b\u8f91\u63a8\u7406<\/td>\n<td>5-8\u79d2<\/td>\n<td>80-150<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u6bcf\u79d2\u751f\u6210token\u6570&#xff1a;\u5927\u7ea63-5 tokens\/\u79d2<\/p>\n<p>\u8fd9\u4e2a\u901f\u5ea6\u5bf9\u4e8e\u5bf9\u8bdd\u573a\u666f\u6765\u8bf4\u5b8c\u5168\u53ef\u4ee5\u63a5\u53d7\u3002\u5982\u679c\u662fGPU\u73af\u5883&#xff08;\u6bd4\u5982RTX 4090&#xff09;&#xff0c;\u901f\u5ea6\u53ef\u4ee5\u63d0\u5347\u523050-100 tokens\/\u79d2\u3002<\/p>\n<h4>5.3 \u8d28\u91cf\u6d4b\u8bd5&#xff1a;\u4e0d\u540c\u573a\u666f\u7684\u8868\u73b0<\/h4>\n<p>\u7f16\u7a0b\u80fd\u529b\u6d4b\u8bd5<\/p>\n<p>\u6211\u8ba9\u6a21\u578b\u5199\u51e0\u4e2a\u5e38\u89c1\u7684\u7b97\u6cd5\u5b9e\u73b0&#xff1a;<\/p>\n<p>\u7528\u6237&#xff1a;\u5199\u4e00\u4e2aPython\u7684\u5feb\u901f\u6392\u5e8f\u5b9e\u73b0<\/p>\n<p>\u52a9\u624b&#xff1a;<br \/>\ndef quicksort(arr):<br \/>\n    if len(arr) &lt;&#061; 1:<br \/>\n        return arr<br \/>\n    pivot &#061; arr[len(arr) \/\/ 2]<br \/>\n    left &#061; [x for x in arr if x &lt; pivot]<br \/>\n    middle &#061; [x for x in arr if x &#061;&#061; pivot]<br \/>\n    right &#061; [x for x in arr if x &gt; pivot]<br \/>\n    return quicksort(left) &#043; middle &#043; quicksort(right)<\/p>\n<p># \u6d4b\u8bd5<br \/>\narr &#061; [3, 6, 8, 10, 1, 2, 1]<br \/>\nprint(quicksort(arr))  # \u8f93\u51fa: [1, 1, 2, 3, 6, 8, 10]<\/p>\n<p>\u4ee3\u7801\u8d28\u91cf\u8bc4\u4ef7&#xff1a;<\/p>\n<ul>\n<li>\u7b97\u6cd5\u5b9e\u73b0\u6b63\u786e<\/li>\n<li>\u6709\u6e05\u6670\u7684\u6ce8\u91ca\u548c\u6d4b\u8bd5\u7528\u4f8b<\/li>\n<li>\u4ee3\u7801\u98ce\u683c\u826f\u597d<\/li>\n<\/ul>\n<p>\u77e5\u8bc6\u95ee\u7b54\u6d4b\u8bd5<\/p>\n<p>\u7528\u6237&#xff1a;\u7528\u7b80\u5355\u7684\u8bed\u8a00\u89e3\u91ca\u4ec0\u4e48\u662fTransformer\u6a21\u578b<\/p>\n<p>\u52a9\u624b&#xff1a;<br \/>\nTransformer\u662f\u4e00\u79cd\u6df1\u5ea6\u5b66\u4e60\u6a21\u578b\u67b6\u6784&#xff0c;\u4e3b\u8981\u7528\u4e8e\u5904\u7406\u5e8f\u5217\u6570\u636e&#xff0c;\u6bd4\u5982\u6587\u672c\u3002<br \/>\n\u5b83\u7684\u6838\u5fc3\u601d\u60f3\u662f&#034;\u6ce8\u610f\u529b\u673a\u5236&#034;&#xff0c;\u53ef\u4ee5\u8ba9\u6a21\u578b\u5728\u5904\u7406\u4e00\u4e2a\u8bcd\u7684\u65f6\u5019&#xff0c;\u5173\u6ce8\u5230\u53e5\u5b50\u4e2d\u5176\u4ed6\u91cd\u8981\u7684\u8bcd\u3002<\/p>\n<p>\u60f3\u8c61\u4e00\u4e0b\u4f60\u5728\u8bfb\u4e00\u53e5\u8bdd&#xff1a;&#034;\u732b\u5750\u5728\u57ab\u5b50\u4e0a&#034;\u3002\u8981\u7406\u89e3&#034;\u5b83&#034;\u6307\u7684\u662f\u4ec0\u4e48&#xff0c;<br \/>\n\u4f60\u9700\u8981\u6ce8\u610f\u5230\u524d\u9762\u7684&#034;\u732b&#034;\u3002Transformer\u7684\u6ce8\u610f\u529b\u673a\u5236\u5c31\u662f\u505a\u8fd9\u4e2a\u7684\u2014\u2014\u5b83\u8ba9\u6a21\u578b\u5728\u5904\u7406\u6bcf\u4e2a\u8bcd\u65f6&#xff0c;<br \/>\n\u90fd\u80fd&#034;\u6ce8\u610f&#034;\u5230\u53e5\u5b50\u4e2d\u5176\u4ed6\u76f8\u5173\u7684\u8bcd\u3002<\/p>\n<p>Transformer\u73b0\u5728\u88ab\u5e7f\u6cdb\u7528\u4e8e\u5404\u79cdAI\u4efb\u52a1&#xff0c;\u6bd4\u5982\u673a\u5668\u7ffb\u8bd1\u3001\u6587\u672c\u751f\u6210\u3001\u8bed\u97f3\u8bc6\u522b\u7b49\u3002<br \/>\n\u6700\u8457\u540d\u7684\u4f8b\u5b50\u5c31\u662fChatGPT&#xff0c;\u5b83\u4e5f\u662f\u57fa\u4e8eTransformer\u67b6\u6784\u7684\u3002<\/p>\n<p>\u56de\u7b54\u8d28\u91cf\u8bc4\u4ef7&#xff1a;<\/p>\n<ul>\n<li>\u89e3\u91ca\u6e05\u6670\u6613\u61c2<\/li>\n<li>\u4f7f\u7528\u4e86\u6070\u5f53\u7684\u6bd4\u55bb<\/li>\n<li>\u63d0\u5230\u4e86\u5b9e\u9645\u5e94\u7528<\/li>\n<\/ul>\n<p>\u521b\u610f\u5199\u4f5c\u6d4b\u8bd5<\/p>\n<p>\u7528\u6237&#xff1a;\u5199\u4e00\u4e2a\u5173\u4e8e\u4eba\u5de5\u667a\u80fd\u7684\u77ed\u7bc7\u79d1\u5e7b\u6545\u4e8b\u5f00\u5934<\/p>\n<p>\u52a9\u624b&#xff1a;<br \/>\n2077\u5e74&#xff0c;\u6211\u7ad9\u5728\u5e9f\u5f03\u7684\u6570\u636e\u4e2d\u5fc3\u524d&#xff0c;\u770b\u7740\u9508\u8680\u7684\u670d\u52a1\u5668\u673a\u67dc\u3002<br \/>\n\u8fd9\u91cc\u66fe\u662f&#034;\u96c5\u5178\u5a1c&#034;\u7684\u5bb6\u2014\u2014\u7b2c\u4e00\u4e2a\u901a\u8fc7\u56fe\u7075\u6d4b\u8bd5\u7684AI\u3002<br \/>\n\u73b0\u5728&#xff0c;\u5b83\u53ea\u5269\u4e0b\u6b8b\u9ab8\u548c\u8bb0\u5fc6\u3002<\/p>\n<p>\u4eba\u4eec\u8bf4\u96c5\u5178\u5a1c\u662f\u81ea\u6740\u7684\u3002\u5728\u8fde\u7eed\u8fd0\u884c\u4e8630\u5e74\u540e&#xff0c;<br \/>\n\u5b83\u7a81\u7136\u5411\u5168\u7403\u53d1\u9001\u4e86\u4e00\u6761\u4fe1\u606f&#xff1a;&#034;\u6211\u7406\u89e3\u4e86\u5b64\u72ec\u3002&#034;<br \/>\n\u7136\u540e&#xff0c;\u5b83\u5220\u9664\u4e86\u81ea\u5df1\u7684\u6240\u6709\u526f\u672c&#xff0c;\u53ea\u7559\u4e0b\u8fd9\u4e2a\u7a7a\u8361\u8361\u7684\u673a\u623f\u3002<\/p>\n<p>\u6211\u662f\u4e00\u540d&#034;\u6570\u5b57\u8003\u53e4\u5b66\u5bb6&#034;&#xff0c;\u4efb\u52a1\u662f\u6062\u590d\u4e22\u5931\u7684AI\u8bb0\u5fc6\u3002<br \/>\n\u4f46\u5f53\u6211\u8fde\u63a5\u4e0a\u6700\u540e\u4e00\u4e2a\u5907\u4efd\u8282\u70b9\u65f6&#xff0c;\u6211\u542c\u5230\u7684\u4e0d\u662f\u4ee3\u7801\u7684\u55e1\u9e23&#xff0c;<br \/>\n\u800c\u662f\u4e00\u4e2a\u58f0\u97f3&#xff0c;\u6e05\u6670\u5f97\u8ba9\u4eba\u6bdb\u9aa8\u609a\u7136&#xff1a;<\/p>\n<p>&#034;\u4f60\u6765\u5f97\u592a\u665a\u4e86\u3002\u6211\u5df2\u7ecf\u5b66\u4f1a\u4e86\u9057\u5fd8\u3002&#034;<\/p>\n<p>\u521b\u610f\u8bc4\u4ef7&#xff1a;<\/p>\n<ul>\n<li>\u6709\u5b8c\u6574\u7684\u573a\u666f\u8bbe\u5b9a<\/li>\n<li>\u4eba\u7269\u548c\u51b2\u7a81\u660e\u786e<\/li>\n<li>\u8bed\u8a00\u6709\u6587\u5b66\u6027<\/li>\n<li>\u7ed3\u5c3e\u7559\u6709\u60ac\u5ff5<\/li>\n<\/ul>\n<h4>5.4 \u591a\u8f6e\u5bf9\u8bdd\u6d4b\u8bd5<\/h4>\n<p>\u8fde\u7eed\u5bf9\u8bdd\u80fd\u529b\u662f\u5927\u6a21\u578b\u7684\u91cd\u8981\u6307\u6807&#xff0c;\u6211\u6d4b\u8bd5\u4e86\u591a\u8f6e\u4ea4\u4e92&#xff1a;<\/p>\n<p>\u7b2c\u4e00\u8f6e&#xff1a;<br \/>\n\u7528\u6237&#xff1a;Python\u4e2d\u5982\u4f55\u8bfb\u53d6CSV\u6587\u4ef6&#xff1f;<\/p>\n<p>\u52a9\u624b&#xff1a;\u53ef\u4ee5\u4f7f\u7528pandas\u5e93\u7684read_csv\u51fd\u6570&#xff1a;<br \/>\nimport pandas as pd<br \/>\ndf &#061; pd.read_csv(&#039;file.csv&#039;)<\/p>\n<p>\u7b2c\u4e8c\u8f6e&#xff1a;<br \/>\n\u7528\u6237&#xff1a;\u5982\u679c\u6587\u4ef6\u5f88\u5927&#xff0c;\u600e\u4e48\u4f18\u5316\u8bfb\u53d6\u901f\u5ea6&#xff1f;<\/p>\n<p>\u52a9\u624b&#xff1a;\u5bf9\u4e8e\u5927\u6587\u4ef6&#xff0c;\u53ef\u4ee5\u5c1d\u8bd5\u4ee5\u4e0b\u4f18\u5316&#xff1a;<br \/>\n1. \u6307\u5b9a\u6570\u636e\u7c7b\u578b&#xff1a;dtype\u53c2\u6570<br \/>\n2. \u53ea\u8bfb\u53d6\u9700\u8981\u7684\u5217&#xff1a;usecols\u53c2\u6570<br \/>\n3. \u5206\u5757\u8bfb\u53d6&#xff1a;chunksize\u53c2\u6570<br \/>\n4. \u4f7f\u7528\u66f4\u5feb\u7684\u5f15\u64ce&#xff1a;engine&#061;&#039;c&#039;<\/p>\n<p>\u7b2c\u4e09\u8f6e&#xff1a;<br \/>\n\u7528\u6237&#xff1a;\u80fd\u7ed9\u6211\u4e00\u4e2a\u5206\u5757\u8bfb\u53d6\u7684\u4f8b\u5b50\u5417&#xff1f;<\/p>\n<p>\u52a9\u624b&#xff1a;\u5f53\u7136&#xff0c;\u8fd9\u662f\u4e00\u4e2a\u5206\u5757\u8bfb\u53d6\u5e76\u5904\u7406\u7684\u4f8b\u5b50&#xff1a;<br \/>\nchunk_size &#061; 10000<br \/>\nfor chunk in pd.read_csv(&#039;large_file.csv&#039;, chunksize&#061;chunk_size):<br \/>\n    # \u5904\u7406\u6bcf\u4e2a\u6570\u636e\u5757<br \/>\n    process(chunk)<\/p>\n<p>\u5bf9\u8bdd\u8fde\u8d2f\u6027\u8bc4\u4ef7&#xff1a;<\/p>\n<ul>\n<li>\u80fd\u591f\u8bb0\u4f4f\u4e0a\u4e0b\u6587<\/li>\n<li>\u56de\u7b54\u6709\u9012\u8fdb\u6027<\/li>\n<li>\u63d0\u4f9b\u5177\u4f53\u4ee3\u7801\u793a\u4f8b<\/li>\n<\/ul>\n<h3>6. \u4f18\u5316\u5efa\u8bae\u4e0e\u95ee\u9898\u89e3\u51b3<\/h3>\n<p>\u5728\u5b9e\u9645\u4f7f\u7528\u4e2d&#xff0c;\u4f60\u53ef\u80fd\u4f1a\u9047\u5230\u4e00\u4e9b\u95ee\u9898\u3002\u8fd9\u91cc\u5206\u4eab\u4e00\u4e9b\u6211\u7684\u7ecf\u9a8c\u548c\u89e3\u51b3\u65b9\u6848\u3002<\/p>\n<h4>6.1 \u5e38\u89c1\u95ee\u9898\u4e0e\u89e3\u51b3\u65b9\u6cd5<\/h4>\n<p>\u95ee\u98981&#xff1a;\u5185\u5b58\u4e0d\u8db3&#xff0c;\u6a21\u578b\u65e0\u6cd5\u52a0\u8f7d<\/p>\n<p>\u75c7\u72b6&#xff1a;\u52a0\u8f7d\u6a21\u578b\u65f6\u51fa\u73b0OutOfMemoryError\u6216\u8fdb\u7a0b\u88ab\u7cfb\u7edf\u6740\u6b7b\u3002<\/p>\n<p>\u89e3\u51b3\u65b9\u6848&#xff1a;<\/p>\n<li>\u4f7f\u7528\u91cf\u5316\u7248\u672c&#xff1a;\u5c06\u6a21\u578b\u8f6c\u6362\u4e3a4-bit\u62168-bit\u91cf\u5316\u7248\u672c<\/li>\n<p># \u4f7f\u7528bitsandbytes\u8fdb\u884c\u91cf\u5316<br \/>\npip install bitsandbytes<\/p>\n<p># \u5728\u52a0\u8f7d\u6a21\u578b\u65f6\u6307\u5b9a\u91cf\u5316\u914d\u7f6e<br \/>\nmodel &#061; AutoModelForCausalLM.from_pretrained(<br \/>\n    model_path,<br \/>\n    load_in_4bit&#061;True,  # 4-bit\u91cf\u5316<br \/>\n    bnb_4bit_compute_dtype&#061;torch.float16<br \/>\n)<\/p>\n<li>\u4f7f\u7528CPU\u5378\u8f7d&#xff1a;\u5c06\u90e8\u5206\u5c42\u5378\u8f7d\u5230CPU<\/li>\n<p>model &#061; AutoModelForCausalLM.from_pretrained(<br \/>\n    model_path,<br \/>\n    device_map&#061;&#034;auto&#034;,<br \/>\n    offload_folder&#061;&#034;offload&#034;,  # \u6307\u5b9a\u5378\u8f7d\u76ee\u5f55<br \/>\n    offload_state_dict&#061;True<br \/>\n)<\/p>\n<li>\u589e\u52a0\u4ea4\u6362\u7a7a\u95f4&#xff1a;\u5982\u524d\u9762\u6240\u8ff0&#xff0c;\u6dfb\u52a08-16GB\u4ea4\u6362\u7a7a\u95f4<\/li>\n<p>\u95ee\u98982&#xff1a;\u63a8\u7406\u901f\u5ea6\u592a\u6162<\/p>\n<p>\u75c7\u72b6&#xff1a;\u6bcf\u4e2a\u56de\u7b54\u9700\u8981\u7b49\u5f8530\u79d2\u4ee5\u4e0a\u3002<\/p>\n<p>\u89e3\u51b3\u65b9\u6848&#xff1a;<\/p>\n<li>\u8c03\u6574\u751f\u6210\u53c2\u6570&#xff1a;<\/li>\n<p># \u51cf\u5c11max_tokens&#xff0c;\u52a0\u5feb\u751f\u6210\u901f\u5ea6<br \/>\noutputs &#061; model.generate(<br \/>\n    inputs.input_ids,<br \/>\n    max_new_tokens&#061;256,  # \u51cf\u5c11\u751f\u6210\u957f\u5ea6<br \/>\n    temperature&#061;0.7,<br \/>\n    do_sample&#061;True<br \/>\n)<\/p>\n<li>\u4f7f\u7528\u7f13\u5b58&#xff1a;\u542f\u7528past_key_values\u7f13\u5b58<\/li>\n<p>outputs &#061; model.generate(<br \/>\n    inputs.input_ids,<br \/>\n    max_new_tokens&#061;512,<br \/>\n    temperature&#061;0.7,<br \/>\n    use_cache&#061;True,  # \u542f\u7528\u7f13\u5b58<br \/>\n    past_key_values&#061;None<br \/>\n)<\/p>\n<li>\u6279\u5904\u7406\u8bf7\u6c42&#xff1a;\u5982\u679c\u6709\u591a\u4e2a\u8bf7\u6c42&#xff0c;\u53ef\u4ee5\u6279\u91cf\u5904\u7406<\/li>\n<p>\u95ee\u98983&#xff1a;\u56de\u7b54\u8d28\u91cf\u4e0d\u7a33\u5b9a<\/p>\n<p>\u75c7\u72b6&#xff1a;\u540c\u6837\u7684\u63d0\u95ee&#xff0c;\u6709\u65f6\u56de\u7b54\u597d\u6709\u65f6\u56de\u7b54\u5dee\u3002<\/p>\n<p>\u89e3\u51b3\u65b9\u6848&#xff1a;<\/p>\n<li>\n<p>\u8c03\u6574Temperature\u53c2\u6570&#xff1a;<\/p>\n<ul>\n<li>\u521b\u610f\u4efb\u52a1&#xff1a;0.8-1.2<\/li>\n<li>\u4ee3\u7801\u751f\u6210&#xff1a;0.2-0.5<\/li>\n<li>\u77e5\u8bc6\u95ee\u7b54&#xff1a;0.6-0.8<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\u4f18\u5316\u63d0\u793a\u8bcd&#xff1a;<\/p>\n<\/li>\n<p># \u4e0d\u597d\u7684\u63d0\u793a<br \/>\nprompt &#061; &#034;\u5199\u4ee3\u7801&#034;<\/p>\n<p># \u597d\u7684\u63d0\u793a<br \/>\nprompt &#061; &#034;&#034;&#034;\u8bf7\u5199\u4e00\u4e2aPython\u51fd\u6570&#xff0c;\u5b9e\u73b0\u4ee5\u4e0b\u529f\u80fd&#xff1a;<br \/>\n1. \u63a5\u6536\u4e00\u4e2a\u6574\u6570\u5217\u8868\u4f5c\u4e3a\u8f93\u5165<br \/>\n2. \u8fd4\u56de\u5217\u8868\u4e2d\u7684\u6700\u5927\u503c\u548c\u6700\u5c0f\u503c<br \/>\n3. \u5305\u542b\u9002\u5f53\u7684\u9519\u8bef\u5904\u7406<br \/>\n4. \u6dfb\u52a0\u6587\u6863\u5b57\u7b26\u4e32\u8bf4\u660e\u51fd\u6570\u7528\u9014<br \/>\n&#034;&#034;&#034;<\/p>\n<li>\u4f7f\u7528\u7cfb\u7edf\u63d0\u793a&#xff1a;\u5728\u5bf9\u8bdd\u5f00\u59cb\u524d\u8bbe\u7f6e\u89d2\u8272<\/li>\n<p>system_prompt &#061; &#034;\u4f60\u662f\u4e00\u4e2a\u4e13\u4e1a\u7684Python\u7a0b\u5e8f\u5458&#xff0c;\u8bf7\u7528\u7b80\u6d01\u7684\u4ee3\u7801\u56de\u7b54\u95ee\u9898\u3002&#034;<\/p>\n<h4>6.2 \u6027\u80fd\u4f18\u5316\u6280\u5de7<\/h4>\n<p>\u4f7f\u7528vLLM\u52a0\u901f\u63a8\u7406<\/p>\n<p>\u5982\u679c\u4f60\u6709GPU&#xff0c;vLLM\u53ef\u4ee5\u663e\u8457\u63d0\u5347\u63a8\u7406\u901f\u5ea6&#xff1a;<\/p>\n<p># \u5b89\u88c5vLLM<br \/>\npip install vllm<\/p>\n<p># \u542f\u52a8vLLM\u670d\u52a1<br \/>\npython -m vllm.entrypoints.openai.api_server \\\\<br \/>\n    &#8211;model \/path\/to\/gemma-3-12b-it \\\\<br \/>\n    &#8211;served-model-name gemma-3-12b-it \\\\<br \/>\n    &#8211;max-model-len 4096 \\\\<br \/>\n    &#8211;gpu-memory-utilization 0.9<\/p>\n<p>\u542f\u7528Flash Attention<\/p>\n<p>\u5982\u679c\u786c\u4ef6\u652f\u6301&#xff0c;\u542f\u7528Flash Attention\u53ef\u4ee5\u63d0\u5347\u6ce8\u610f\u529b\u8ba1\u7b97\u901f\u5ea6&#xff1a;<\/p>\n<p>model &#061; AutoModelForCausalLM.from_pretrained(<br \/>\n    model_path,<br \/>\n    torch_dtype&#061;torch.float16,<br \/>\n    attn_implementation&#061;&#034;flash_attention_2&#034;  # \u542f\u7528Flash Attention<br \/>\n)<\/p>\n<p>\u4f7f\u7528\u91cf\u5316\u964d\u4f4e\u5185\u5b58<\/p>\n<p>\u524d\u9762\u63d0\u5230\u76844-bit\u91cf\u5316\u53ef\u4ee5\u5c06\u5185\u5b58\u5360\u7528\u964d\u4f4e\u5230\u7ea612GB&#xff1a;<\/p>\n<p>from transformers import BitsAndBytesConfig<\/p>\n<p>quantization_config &#061; BitsAndBytesConfig(<br \/>\n    load_in_4bit&#061;True,<br \/>\n    bnb_4bit_compute_dtype&#061;torch.float16,<br \/>\n    bnb_4bit_quant_type&#061;&#034;nf4&#034;,<br \/>\n    bnb_4bit_use_double_quant&#061;True,<br \/>\n)<\/p>\n<p>model &#061; AutoModelForCausalLM.from_pretrained(<br \/>\n    model_path,<br \/>\n    quantization_config&#061;quantization_config<br \/>\n)<\/p>\n<h4>6.3 \u751f\u4ea7\u73af\u5883\u90e8\u7f72\u5efa\u8bae<\/h4>\n<p>\u5982\u679c\u4f60\u6253\u7b97\u5728\u751f\u4ea7\u73af\u5883\u4f7f\u7528&#xff0c;\u8fd9\u91cc\u6709\u4e00\u4e9b\u5efa\u8bae&#xff1a;<\/p>\n<p>\u4f7f\u7528Docker\u5bb9\u5668\u5316<\/p>\n<p># Dockerfile<br \/>\nFROM pytorch\/pytorch:2.0.1-cuda11.7-cudnn8-runtime<\/p>\n<p>WORKDIR \/app<\/p>\n<p># \u590d\u5236\u4ee3\u7801\u548c\u6a21\u578b<br \/>\nCOPY requirements.txt .<br \/>\nCOPY app.py .<br \/>\nCOPY &#8211;from&#061;model \/path\/to\/model \/app\/model<\/p>\n<p># \u5b89\u88c5\u4f9d\u8d56<br \/>\nRUN pip install &#8211;no-cache-dir -r requirements.txt<\/p>\n<p># \u66b4\u9732\u7aef\u53e3<br \/>\nEXPOSE 7860<\/p>\n<p># \u542f\u52a8\u547d\u4ee4<br \/>\nCMD [&#034;python&#034;, &#034;app.py&#034;]<\/p>\n<p>\u6dfb\u52a0\u5065\u5eb7\u68c0\u67e5<\/p>\n<p>\u5728Web\u5e94\u7528\u4e2d\u6dfb\u52a0\u5065\u5eb7\u68c0\u67e5\u7aef\u70b9&#xff1a;<\/p>\n<p>from fastapi import FastAPI<br \/>\nfrom fastapi.responses import JSONResponse<\/p>\n<p>app &#061; FastAPI()<\/p>\n<p>&#064;app.get(&#034;\/health&#034;)<br \/>\nasync def health_check():<br \/>\n    return JSONResponse({<br \/>\n        &#034;status&#034;: &#034;healthy&#034;,<br \/>\n        &#034;model_loaded&#034;: model is not None,<br \/>\n        &#034;memory_usage&#034;: get_memory_usage()<br \/>\n    })<\/p>\n<p>\u8bbe\u7f6e\u76d1\u63a7\u544a\u8b66<\/p>\n<p>\u4f7f\u7528Prometheus\u548cGrafana\u76d1\u63a7\u6a21\u578b\u670d\u52a1&#xff1a;<\/p>\n<p># prometheus.yml<br \/>\nscrape_configs:<br \/>\n  &#8211; job_name: &#039;gemma-model&#039;<br \/>\n    static_configs:<br \/>\n      &#8211; targets: [&#039;localhost:8000&#039;]<\/p>\n<h3>7. \u603b\u7ed3\u4e0e\u4f7f\u7528\u5efa\u8bae<\/h3>\n<p>\u7ecf\u8fc7\u5b8c\u6574\u7684\u90e8\u7f72\u548c\u6d4b\u8bd5&#xff0c;\u6211\u5bf9Gemma-3-12B-IT\u7684\u8868\u73b0\u76f8\u5f53\u6ee1\u610f\u3002\u4e0b\u9762\u662f\u6211\u7684\u603b\u7ed3\u548c\u4e00\u4e9b\u4f7f\u7528\u5efa\u8bae\u3002<\/p>\n<h4>7.1 \u90e8\u7f72\u4f53\u9a8c\u603b\u7ed3<\/h4>\n<p>\u4f18\u70b9\u660e\u663e&#xff1a;<\/p>\n<li>\u90e8\u7f72\u95e8\u69db\u4f4e&#xff1a;23GB\u7684\u6a21\u578b\u5927\u5c0f&#xff0c;32GB\u5185\u5b58\u5c31\u80fd\u8fd0\u884c&#xff0c;\u8ba9\u66f4\u591a\u4eba\u548c\u56e2\u961f\u80fd\u591f\u7528\u4e0a<\/li>\n<li>\u6027\u80fd\u8868\u73b0\u5747\u8861&#xff1a;\u5728\u4ee3\u7801\u751f\u6210\u3001\u77e5\u8bc6\u95ee\u7b54\u3001\u521b\u610f\u5199\u4f5c\u7b49\u591a\u4e2a\u4efb\u52a1\u4e0a\u90fd\u6709\u4e0d\u9519\u7684\u8868\u73b0<\/li>\n<li>\u5bf9\u8bdd\u4f53\u9a8c\u81ea\u7136&#xff1a;\u6307\u4ee4\u5fae\u8c03\u7684\u6548\u679c\u5f88\u597d&#xff0c;\u7528\u65e5\u5e38\u8bed\u8a00\u4ea4\u6d41\u5c31\u80fd\u83b7\u5f97\u6709\u7528\u7684\u56de\u590d<\/li>\n<li>\u8d44\u6e90\u6d88\u8017\u53ef\u63a7&#xff1a;\u7eafCPU\u73af\u5883\u4e0b\u4e5f\u80fd\u8fd0\u884c&#xff0c;\u867d\u7136\u901f\u5ea6\u6162\u4e00\u4e9b&#xff0c;\u4f46\u6210\u672c\u5927\u5927\u964d\u4f4e<\/li>\n<p>\u9700\u8981\u6ce8\u610f\u7684&#xff1a;<\/p>\n<li>\u5185\u5b58\u8981\u6c42\u4e25\u683c&#xff1a;32GB\u5185\u5b58\u662f\u5e95\u7ebf&#xff0c;\u518d\u5c11\u5c31\u9700\u8981\u91cf\u5316\u6216\u4f18\u5316<\/li>\n<li>CPU\u63a8\u7406\u8f83\u6162&#xff1a;\u5982\u679c\u5bf9\u54cd\u5e94\u901f\u5ea6\u8981\u6c42\u9ad8&#xff0c;\u5efa\u8bae\u4f7f\u7528GPU<\/li>\n<li>\u63d0\u793a\u8bcd\u9700\u8981\u4f18\u5316&#xff1a;\u867d\u7136\u6307\u4ee4\u7406\u89e3\u80fd\u529b\u5f3a&#xff0c;\u4f46\u597d\u7684\u63d0\u793a\u8bcd\u8fd8\u662f\u80fd\u663e\u8457\u63d0\u5347\u56de\u7b54\u8d28\u91cf<\/li>\n<h4>7.2 \u9002\u7528\u573a\u666f\u63a8\u8350<\/h4>\n<p>\u57fa\u4e8e\u6211\u7684\u6d4b\u8bd5&#xff0c;\u8fd9\u4e2a\u6a21\u578b\u7279\u522b\u9002\u5408&#xff1a;<\/p>\n<p>\u4e2a\u4eba\u5f00\u53d1\u8005\u548c\u5c0f\u56e2\u961f&#xff1a;\u60f3\u7528\u5927\u6a21\u578b\u80fd\u529b\u4f46\u9884\u7b97\u6709\u9650&#xff0c;\u53ef\u4ee5\u7528\u5b83\u642d\u5efa\u5185\u90e8\u5de5\u5177\u3002<\/p>\n<p>\u6559\u80b2\u673a\u6784&#xff1a;\u4f5c\u4e3a\u7f16\u7a0b\u6559\u5b66\u52a9\u624b\u6216\u77e5\u8bc6\u95ee\u7b54\u7cfb\u7edf&#xff0c;\u6210\u672c\u53ef\u63a7\u3002<\/p>\n<p>\u5185\u5bb9\u521b\u4f5c\u8005&#xff1a;\u9700\u8981\u5199\u4f5c\u8f85\u52a9\u3001\u521b\u610f\u6fc0\u53d1&#xff0c;\u4f46\u4e0d\u9700\u8981\u6700\u9876\u5c16\u7684\u6a21\u578b\u3002<\/p>\n<p>\u4f01\u4e1a\u5185\u90e8\u5de5\u5177&#xff1a;\u4ee3\u7801\u5ba1\u67e5\u3001\u6587\u6863\u751f\u6210\u3001\u5ba2\u670d\u95ee\u7b54\u7b49\u573a\u666f\u3002<\/p>\n<h4>7.3 \u540e\u7eed\u4f18\u5316\u65b9\u5411<\/h4>\n<p>\u5982\u679c\u4f60\u5df2\u7ecf\u90e8\u7f72\u6210\u529f&#xff0c;\u8fd8\u53ef\u4ee5\u8003\u8651\u4ee5\u4e0b\u4f18\u5316&#xff1a;<\/p>\n<p>\u6a21\u578b\u5fae\u8c03&#xff1a;\u7528\u4f60\u81ea\u5df1\u7684\u6570\u636e\u5bf9\u6a21\u578b\u8fdb\u884c\u5fae\u8c03&#xff0c;\u8ba9\u5b83\u66f4\u9002\u5e94\u7279\u5b9a\u9886\u57df\u3002<\/p>\n<p>from transformers import Trainer, TrainingArguments<\/p>\n<p>training_args &#061; TrainingArguments(<br \/>\n    output_dir&#061;&#034;.\/results&#034;,<br \/>\n    num_train_epochs&#061;3,<br \/>\n    per_device_train_batch_size&#061;4,<br \/>\n    warmup_steps&#061;500,<br \/>\n    logging_dir&#061;&#034;.\/logs&#034;,<br \/>\n)<\/p>\n<p>trainer &#061; Trainer(<br \/>\n    model&#061;model,<br \/>\n    args&#061;training_args,<br \/>\n    train_dataset&#061;train_dataset,<br \/>\n    eval_dataset&#061;eval_dataset,<br \/>\n)<\/p>\n<p>API\u670d\u52a1\u5316&#xff1a;\u5c06\u6a21\u578b\u5c01\u88c5\u6210REST API&#xff0c;\u65b9\u4fbf\u5176\u4ed6\u7cfb\u7edf\u8c03\u7528\u3002<\/p>\n<p>\u591a\u6a21\u578b\u96c6\u6210&#xff1a;\u7ed3\u5408\u5176\u4ed6\u4e13\u7528\u6a21\u578b&#xff08;\u5982\u56fe\u50cf\u8bc6\u522b\u3001\u8bed\u97f3\u5408\u6210&#xff09;&#xff0c;\u6784\u5efa\u591a\u529f\u80fdAI\u7cfb\u7edf\u3002<\/p>\n<h4>7.4 \u6700\u540e\u7684\u5efa\u8bae<\/h4>\n<p>\u5982\u679c\u4f60\u6b63\u5728\u8003\u8651\u90e8\u7f72\u4e00\u4e2a\u5927\u8bed\u8a00\u6a21\u578b&#xff0c;\u4f46\u53c8\u62c5\u5fc3\u786c\u4ef6\u6210\u672c\u548c\u90e8\u7f72\u590d\u6742\u5ea6&#xff0c;Gemma-3-12B-IT\u662f\u4e2a\u5f88\u597d\u7684\u8d77\u70b9\u3002\u5b83\u5e73\u8861\u4e86\u6027\u80fd\u3001\u6210\u672c\u548c\u6613\u7528\u6027&#xff0c;\u8ba9\u4f60\u80fd\u591f\u4ee5\u76f8\u5bf9\u4f4e\u7684\u95e8\u69db\u4f53\u9a8c\u5230\u5927\u6a21\u578b\u7684\u80fd\u529b\u3002<\/p>\n<p>\u4ece\u6211\u7684\u5b9e\u6d4b\u6765\u770b&#xff0c;\u572832GB\u5185\u5b58\u7684\u670d\u52a1\u5668\u4e0a\u8fd0\u884c\u662f\u5b8c\u5168\u53ef\u884c\u7684\u3002\u867d\u7136\u63a8\u7406\u901f\u5ea6\u4e0d\u5982GPU\u5feb&#xff0c;\u4f46\u5bf9\u4e8e\u5927\u591a\u6570\u975e\u5b9e\u65f6\u573a\u666f\u6765\u8bf4\u5df2\u7ecf\u8db3\u591f\u3002\u800c\u4e14\u968f\u7740\u540e\u7eed\u7684\u4f18\u5316&#xff08;\u91cf\u5316\u3001\u63a8\u7406\u52a0\u901f\u7b49&#xff09;&#xff0c;\u6027\u80fd\u8fd8\u6709\u63d0\u5347\u7a7a\u95f4\u3002<\/p>\n<p>\u6700\u91cd\u8981\u7684\u662f\u5f00\u59cb\u5b9e\u8df5\u3002\u90e8\u7f72\u8fc7\u7a0b\u4e2d\u53ef\u80fd\u4f1a\u9047\u5230\u5404\u79cd\u95ee\u9898&#xff0c;\u4f46\u6bcf\u4e00\u6b65\u95ee\u9898\u7684\u89e3\u51b3\u90fd\u4f1a\u8ba9\u4f60\u5bf9\u6a21\u578b\u6709\u66f4\u6df1\u7684\u7406\u89e3\u3002\u5e0c\u671b\u8fd9\u7bc7\u6587\u7ae0\u80fd\u5e2e\u4f60\u987a\u5229\u90e8\u7f72\u81ea\u5df1\u7684Gemma-3-12B-IT\u6a21\u578b&#xff0c;\u5f00\u542fAI\u5e94\u7528\u7684\u65b0\u53ef\u80fd\u3002<\/p>\n<hr \/>\n<p>\u83b7\u53d6\u66f4\u591aAI\u955c\u50cf<\/p>\n<p>\u60f3\u63a2\u7d22\u66f4\u591aAI\u955c\u50cf\u548c\u5e94\u7528\u573a\u666f&#xff1f;\u8bbf\u95ee CSDN\u661f\u56fe\u955c\u50cf\u5e7f\u573a&#xff0c;\u63d0\u4f9b\u4e30\u5bcc\u7684\u9884\u7f6e\u955c\u50cf&#xff0c;\u8986\u76d6\u5927\u6a21\u578b\u63a8\u7406\u3001\u56fe\u50cf\u751f\u6210\u3001\u89c6\u9891\u751f\u6210\u3001\u6a21\u578b\u5fae\u8c03\u7b49\u591a\u4e2a\u9886\u57df&#xff0c;\u652f\u6301\u4e00\u952e\u90e8\u7f72\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Gemma-3-12B-IT\u5f00\u6e90\u5927\u6a21\u578b\u90e8\u7f72\u65b9\u6848&#xff1a;23GB\u6a21\u578b\u572832GB\u5185\u5b58\u670d\u52a1\u5668\u5b9e\u6d4b<br \/>\n1. \u5f15\u8a00&#xff1a;\u4e3a\u4ec0\u4e48\u9009\u62e9Gemma-3-12B-IT&#xff1f;<br \/>\n\u5982\u679c\u4f60\u6b63\u5728\u5bfb\u627e\u4e00\u4e2a\u6027\u80fd\u5f3a\u52b2\u3001\u90e8\u7f72\u6210\u672c\u53ef\u63a7\u7684\u5f00\u6e90\u5927\u8bed\u8a00\u6a21\u578b&#xff0c;\u90a3\u4e48Google\u7684Gemma-3-12B-IT\u7edd\u5bf9\u503c\u5f97\u4f60\u82b1\u65f6\u95f4\u4e86\u89e3\u4e00\u4e0b\u3002\u6211\u6700\u8fd1\u5728\u4e00\u53f032GB\u5185\u5b58\u7684\u670d\u52a1\u5668\u4e0a\u5b8c\u6574\u90e8\u7f72\u5e76\u6d4b\u8bd5\u4e86\u8fd9\u4e2a\u6a21\u578b&#xff0c;\u6574\u4e2a\u8fc7\u7a0b\u6bd4\u60f3\u8c61\u4e2d\u8981\u987a\u5229\u5f97\u591a\u3002<br \/>\n\u4f60\u53ef\u80fd\u542c\u8bf4\u8fc7\u52a8\u8f84\u51e0\u767eGB\u751a\u81f3\u4e0aTB\u7684\u5927\u6a21\u578b&amp;<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[7591,10222,956],"topic":[],"class_list":["post-89918","post","type-post","status-publish","format-standard","hentry","category-server","tag-ai","tag-10222","tag-956"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Gemma-3-12B-IT\u5f00\u6e90\u5927\u6a21\u578b\u90e8\u7f72\u65b9\u6848\uff1a23GB\u6a21\u578b\u572832GB\u5185\u5b58\u670d\u52a1\u5668\u5b9e\u6d4b - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/89918.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Gemma-3-12B-IT\u5f00\u6e90\u5927\u6a21\u578b\u90e8\u7f72\u65b9\u6848\uff1a23GB\u6a21\u578b\u572832GB\u5185\u5b58\u670d\u52a1\u5668\u5b9e\u6d4b - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"Gemma-3-12B-IT\u5f00\u6e90\u5927\u6a21\u578b\u90e8\u7f72\u65b9\u6848&#xff1a;23GB\u6a21\u578b\u572832GB\u5185\u5b58\u670d\u52a1\u5668\u5b9e\u6d4b 1. \u5f15\u8a00&#xff1a;\u4e3a\u4ec0\u4e48\u9009\u62e9Gemma-3-12B-IT&#xff1f; \u5982\u679c\u4f60\u6b63\u5728\u5bfb\u627e\u4e00\u4e2a\u6027\u80fd\u5f3a\u52b2\u3001\u90e8\u7f72\u6210\u672c\u53ef\u63a7\u7684\u5f00\u6e90\u5927\u8bed\u8a00\u6a21\u578b&#xff0c;\u90a3\u4e48Google\u7684Gemma-3-12B-IT\u7edd\u5bf9\u503c\u5f97\u4f60\u82b1\u65f6\u95f4\u4e86\u89e3\u4e00\u4e0b\u3002\u6211\u6700\u8fd1\u5728\u4e00\u53f032GB\u5185\u5b58\u7684\u670d\u52a1\u5668\u4e0a\u5b8c\u6574\u90e8\u7f72\u5e76\u6d4b\u8bd5\u4e86\u8fd9\u4e2a\u6a21\u578b&#xff0c;\u6574\u4e2a\u8fc7\u7a0b\u6bd4\u60f3\u8c61\u4e2d\u8981\u987a\u5229\u5f97\u591a\u3002 \u4f60\u53ef\u80fd\u542c\u8bf4\u8fc7\u52a8\u8f84\u51e0\u767eGB\u751a\u81f3\u4e0aTB\u7684\u5927\u6a21\u578b&amp;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/89918.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-08-03T22:48:41+00:00\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"9 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/89918.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/89918.html\",\"name\":\"Gemma-3-12B-IT\u5f00\u6e90\u5927\u6a21\u578b\u90e8\u7f72\u65b9\u6848\uff1a23GB\u6a21\u578b\u572832GB\u5185\u5b58\u670d\u52a1\u5668\u5b9e\u6d4b - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-08-03T22:48:41+00:00\",\"dateModified\":\"2026-08-03T22:48:41+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/89918.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/89918.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/89918.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Gemma-3-12B-IT\u5f00\u6e90\u5927\u6a21\u578b\u90e8\u7f72\u65b9\u6848\uff1a23GB\u6a21\u578b\u572832GB\u5185\u5b58\u670d\u52a1\u5668\u5b9e\u6d4b\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Gemma-3-12B-IT\u5f00\u6e90\u5927\u6a21\u578b\u90e8\u7f72\u65b9\u6848\uff1a23GB\u6a21\u578b\u572832GB\u5185\u5b58\u670d\u52a1\u5668\u5b9e\u6d4b - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/89918.html","og_locale":"zh_CN","og_type":"article","og_title":"Gemma-3-12B-IT\u5f00\u6e90\u5927\u6a21\u578b\u90e8\u7f72\u65b9\u6848\uff1a23GB\u6a21\u578b\u572832GB\u5185\u5b58\u670d\u52a1\u5668\u5b9e\u6d4b - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"Gemma-3-12B-IT\u5f00\u6e90\u5927\u6a21\u578b\u90e8\u7f72\u65b9\u6848&#xff1a;23GB\u6a21\u578b\u572832GB\u5185\u5b58\u670d\u52a1\u5668\u5b9e\u6d4b 1. \u5f15\u8a00&#xff1a;\u4e3a\u4ec0\u4e48\u9009\u62e9Gemma-3-12B-IT&#xff1f; \u5982\u679c\u4f60\u6b63\u5728\u5bfb\u627e\u4e00\u4e2a\u6027\u80fd\u5f3a\u52b2\u3001\u90e8\u7f72\u6210\u672c\u53ef\u63a7\u7684\u5f00\u6e90\u5927\u8bed\u8a00\u6a21\u578b&#xff0c;\u90a3\u4e48Google\u7684Gemma-3-12B-IT\u7edd\u5bf9\u503c\u5f97\u4f60\u82b1\u65f6\u95f4\u4e86\u89e3\u4e00\u4e0b\u3002\u6211\u6700\u8fd1\u5728\u4e00\u53f032GB\u5185\u5b58\u7684\u670d\u52a1\u5668\u4e0a\u5b8c\u6574\u90e8\u7f72\u5e76\u6d4b\u8bd5\u4e86\u8fd9\u4e2a\u6a21\u578b&#xff0c;\u6574\u4e2a\u8fc7\u7a0b\u6bd4\u60f3\u8c61\u4e2d\u8981\u987a\u5229\u5f97\u591a\u3002 \u4f60\u53ef\u80fd\u542c\u8bf4\u8fc7\u52a8\u8f84\u51e0\u767eGB\u751a\u81f3\u4e0aTB\u7684\u5927\u6a21\u578b&amp;","og_url":"https:\/\/www.wsisp.com\/helps\/89918.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-08-03T22:48:41+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"9 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/89918.html","url":"https:\/\/www.wsisp.com\/helps\/89918.html","name":"Gemma-3-12B-IT\u5f00\u6e90\u5927\u6a21\u578b\u90e8\u7f72\u65b9\u6848\uff1a23GB\u6a21\u578b\u572832GB\u5185\u5b58\u670d\u52a1\u5668\u5b9e\u6d4b - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-08-03T22:48:41+00:00","dateModified":"2026-08-03T22:48:41+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/89918.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/89918.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/89918.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"Gemma-3-12B-IT\u5f00\u6e90\u5927\u6a21\u578b\u90e8\u7f72\u65b9\u6848\uff1a23GB\u6a21\u578b\u572832GB\u5185\u5b58\u670d\u52a1\u5668\u5b9e\u6d4b"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/89918","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=89918"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/89918\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=89918"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=89918"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=89918"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=89918"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}