{"id":84370,"date":"2026-07-26T12:25:29","date_gmt":"2026-07-26T04:25:29","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/84370.html"},"modified":"2026-07-26T12:25:29","modified_gmt":"2026-07-26T04:25:29","slug":"%e5%a4%9a%e5%8f%b0%e6%9c%8d%e5%8a%a1%e5%99%a8%e5%90%8c%e6%97%b6%e8%ae%ad%e7%bb%83llamfactory-%e5%a4%a7%e8%af%ad%e8%a8%80%e6%a8%a1%e5%9e%8b-%e5%9b%bd%e5%ae%b6%e8%b6%85%e7%ae%97%e4%b8%ad%e5%bf%83-slurm","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/84370.html","title":{"rendered":"\u591a\u53f0\u670d\u52a1\u5668\u540c\u65f6\u8bad\u7ec3llamfactory \u5927\u8bed\u8a00\u6a21\u578b \u56fd\u5bb6\u8d85\u7b97\u4e2d\u5fc3 Slurm \u662f\u76ee\u524d\u5168\u7403\u6700\u4e3b\u6d41\u7684\u5f00\u6e90\u3001\u9ad8\u6027\u80fd\u8ba1\u7b97\uff08HPC\uff09\u96c6\u7fa4\u8d44\u6e90\u7ba1\u7406\u4e0e\u4f5c\u4e1a\u8c03\u5ea6\u7cfb\u7edf"},"content":{"rendered":"<h3>\u591a\u53f0\u670d\u52a1\u5668\u540c\u65f6\u8bad\u7ec3llamfactory \u5927\u8bed\u8a00\u6a21\u578b \u56fd\u5bb6\u8d85\u7b97\u4e2d\u5fc3 Slurm \u662f\u76ee\u524d\u5168\u7403\u6700\u4e3b\u6d41\u7684\u5f00\u6e90\u3001\u9ad8\u6027\u80fd\u8ba1\u7b97&#xff08;HPC&#xff09;\u96c6\u7fa4\u8d44\u6e90\u7ba1\u7406\u4e0e\u4f5c\u4e1a\u8c03\u5ea6\u7cfb\u7edf<\/h3>\n<p>\u5b8c\u5168\u53ef\u4ee5\u300210 \u5f20 64GB Blackwell \u8de8 5 \u8282\u70b9\u5206\u5e03\u5f0f\u8bad\u7ec3 14B&#043;LoRA \u4e0d\u4ec5\u53ef\u884c&#xff0c;\u800c\u4e14\u5355\u5361\u663e\u5b58\u975e\u5e38\u5bbd\u88d5\u3002<\/p>\n<hr \/>\n<h3>1. \u663e\u5b58\u6838\u7b97&#xff08;\u6253\u6d88\u987e\u8651&#xff09;<\/h3>\n<table>\n<tr>\u9879\u76ee\u5360\u7528\u4f30\u7b97\u8bf4\u660e<\/tr>\n<tbody>\n<tr>\n<td>14B \u57fa\u5ea7 (BF16)<\/td>\n<td>~28 GB<\/td>\n<td>\u53c2\u6570\u672c\u8eab<\/td>\n<\/tr>\n<tr>\n<td>LoRA \u53ef\u8bad\u7ec3\u53c2\u6570 (r&#061;128)<\/td>\n<td>~0.2 GB<\/td>\n<td>\u4f4e\u79e9\u77e9\u9635<\/td>\n<\/tr>\n<tr>\n<td>\u4f18\u5316\u5668\u72b6\u6001 (AdamW)<\/td>\n<td>~0.6 GB<\/td>\n<td>\u53ea\u5b58 LoRA \u7684 momentum<\/td>\n<\/tr>\n<tr>\n<td>\u6fc0\u6d3b\u503c (seq&#061;768, bs&#061;4)<\/td>\n<td>~4-8 GB<\/td>\n<td>\u4e0e\u957f\u5ea6\u6b63\u76f8\u5173<\/td>\n<\/tr>\n<tr>\n<td>KV Cache \/ \u788e\u7247<\/td>\n<td>~2 GB<\/td>\n<td>\u9884\u7559<\/td>\n<\/tr>\n<tr>\n<td>\u5355\u5361\u603b\u8ba1<\/td>\n<td>&lt; 40 GB<\/td>\n<td>64GB \u5361\u5269\u4f59 24GB&#043;<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u7ed3\u8bba&#xff1a;\u5355\u5361\u5c31\u80fd\u72ec\u7acb\u653e\u4e0b\u5b8c\u6574\u6a21\u578b&#043;LoRA&#xff0c;\u4e0d\u9700\u8981 ZeRO-3 \u5207\u5206\u53c2\u6570\u3002\u591a\u8282\u70b9\u8bad\u7ec3\u672c\u8d28\u662f\u7eaf\u6570\u636e\u5e76\u884c&#xff08;DDP&#xff09;&#xff0c;\u901a\u4fe1\u91cf\u6781\u5c0f&#xff08;\u53ea\u540c\u6b65 LoRA \u68af\u5ea6\u7684\u51e0\u767e MB&#xff09;\u3002<\/p>\n<hr \/>\n<h3>2. \u7f51\u7edc\u74f6\u9888\u8bc4\u4f30&#xff08;\u5173\u952e\u524d\u63d0&#xff09;<\/h3>\n<p>5 \u53f0\u673a\u5668\u8bad\u7ec3&#xff0c;\u8282\u70b9\u95f4\u7f51\u7edc\u662f\u552f\u4e00\u53ef\u80fd\u5361\u4f60\u7684\u5730\u65b9&#xff1a;<\/p>\n<table>\n<tr>\u7f51\u7edc\u7c7b\u578b\u662f\u5426\u53ef\u7528\u5efa\u8bae<\/tr>\n<tbody>\n<tr>\n<td>InfiniBand (200Gbps&#043;)<\/td>\n<td>\u2705 \u6700\u4f18<\/td>\n<td>\u76f4\u63a5\u8dd1&#xff0c;\u65e0\u74f6\u9888<\/td>\n<\/tr>\n<tr>\n<td>RDMA RoCE (25Gbps&#043;)<\/td>\n<td>\u2705 \u53ef\u7528<\/td>\n<td>\u8bbe\u7f6e NCCL \u73af\u5883\u53d8\u91cf\u5373\u53ef<\/td>\n<\/tr>\n<tr>\n<td>\u666e\u901a\u4ee5\u592a\u7f51 (1Gbps)<\/td>\n<td>\u26a0\ufe0f \u80fd\u7528\u4f46\u6162<\/td>\n<td>\u589e\u5927 gradient accumulation&#xff0c;\u51cf\u5c11\u901a\u4fe1\u9891\u6b21<\/td>\n<\/tr>\n<tr>\n<td>\u8de8\u516c\u7f51\/\u5f02\u5730<\/td>\n<td>\u274c \u4e0d\u5efa\u8bae<\/td>\n<td>\u5ef6\u8fdf\u592a\u9ad8&#xff0c;NCCL \u4f1a\u8d85\u65f6<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u68c0\u6d4b\u547d\u4ee4&#xff08;\u6bcf\u53f0\u6267\u884c&#xff09;&#xff1a;<\/p>\n<p><span class=\"token comment\"># \u770b\u7f51\u5361\u901f\u5ea6<\/span><br \/>\n<span class=\"token function\">ethtool<\/span> eth0 <span class=\"token operator\">|<\/span> <span class=\"token function\">grep<\/span> Speed<br \/>\n<span class=\"token comment\"># \u5982\u679c\u662f 25000Mb\/s \u4ee5\u4e0a&#xff0c;\u653e\u5fc3\u8dd1&#xff1b;\u5982\u679c\u662f 1000Mb\/s&#xff0c;\u770b\u4e0b\u65b9\u964d\u7ea7\u65b9\u6848<\/span><\/p>\n<hr \/>\n<h3>3. \u65b9\u6848 A&#xff1a;\u591a\u8282\u70b9\u5206\u5e03\u5f0f\u8bad\u7ec3\u4e00\u4e2a\u4efb\u52a1&#xff08;\u63a8\u8350&#xff09;<\/h3>\n<h4>3.1 \u8bad\u7ec3\u4ee3\u7801\u6700\u5c0f\u6539\u52a8<\/h4>\n<p>\u4f60\u53ea\u9700\u8981\u5728\u539f\u6709 train.py \u4e0a\u52a0\u51e0\u884c\u5206\u5e03\u5f0f\u521d\u59cb\u5316&#xff1a;<\/p>\n<p><span class=\"token keyword\">import<\/span> os<br \/>\n<span class=\"token keyword\">import<\/span> torch<br \/>\n<span class=\"token keyword\">import<\/span> torch<span class=\"token punctuation\">.<\/span>distributed <span class=\"token keyword\">as<\/span> dist<br \/>\n<span class=\"token keyword\">from<\/span> torch<span class=\"token punctuation\">.<\/span>nn<span class=\"token punctuation\">.<\/span>parallel <span class=\"token keyword\">import<\/span> DistributedDataParallel <span class=\"token keyword\">as<\/span> DDP<br \/>\n<span class=\"token keyword\">from<\/span> torch<span class=\"token punctuation\">.<\/span>utils<span class=\"token punctuation\">.<\/span>data <span class=\"token keyword\">import<\/span> DataLoader<br \/>\n<span class=\"token keyword\">from<\/span> torch<span class=\"token punctuation\">.<\/span>utils<span class=\"token punctuation\">.<\/span>data<span class=\"token punctuation\">.<\/span>distributed <span class=\"token keyword\">import<\/span> DistributedSampler<br \/>\n<span class=\"token keyword\">from<\/span> transformers <span class=\"token keyword\">import<\/span> AutoModelForCausalLM<span class=\"token punctuation\">,<\/span> AutoTokenizer<span class=\"token punctuation\">,<\/span> TrainingArguments<span class=\"token punctuation\">,<\/span> Trainer<br \/>\n<span class=\"token keyword\">from<\/span> peft <span class=\"token keyword\">import<\/span> get_peft_model<span class=\"token punctuation\">,<\/span> LoraConfig<br \/>\n<span class=\"token keyword\">from<\/span> datasets <span class=\"token keyword\">import<\/span> load_dataset<\/p>\n<p><span class=\"token keyword\">def<\/span> <span class=\"token function\">main<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">:<\/span><br \/>\n    <span class=\"token comment\"># \u5206\u5e03\u5f0f\u73af\u5883\u53d8\u91cf\u7531 torchrun \u81ea\u52a8\u6ce8\u5165<\/span><br \/>\n    local_rank <span class=\"token operator\">&#061;<\/span> <span class=\"token builtin\">int<\/span><span class=\"token punctuation\">(<\/span>os<span class=\"token punctuation\">.<\/span>environ<span class=\"token punctuation\">[<\/span><span class=\"token string\">&#034;LOCAL_RANK&#034;<\/span><span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">)<\/span><br \/>\n    torch<span class=\"token punctuation\">.<\/span>cuda<span class=\"token punctuation\">.<\/span>set_device<span class=\"token punctuation\">(<\/span>local_rank<span class=\"token punctuation\">)<\/span><\/p>\n<p>    <span class=\"token comment\"># \u521d\u59cb\u5316\u8fdb\u7a0b\u7ec4&#xff08;NCCL \u662f NVIDIA \u591a\u5361\u901a\u4fe1\u540e\u7aef&#xff09;<\/span><br \/>\n    dist<span class=\"token punctuation\">.<\/span>init_process_group<span class=\"token punctuation\">(<\/span>backend<span class=\"token operator\">&#061;<\/span><span class=\"token string\">&#034;nccl&#034;<\/span><span class=\"token punctuation\">)<\/span><br \/>\n    global_rank <span class=\"token operator\">&#061;<\/span> dist<span class=\"token punctuation\">.<\/span>get_rank<span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><br \/>\n    world_size <span class=\"token operator\">&#061;<\/span> dist<span class=\"token punctuation\">.<\/span>get_world_size<span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span>  <span class=\"token comment\"># \u5e94\u8be5\u662f 10<\/span><\/p>\n<p>    <span class=\"token comment\"># \u53ea\u5728\u4e3b\u8282\u70b9\u6253\u5370&#xff0c;\u907f\u514d 10 \u4efd\u65e5\u5fd7\u5237\u5c4f<\/span><br \/>\n    <span class=\"token keyword\">if<\/span> global_rank <span class=\"token operator\">&#061;&#061;<\/span> <span class=\"token number\">0<\/span><span class=\"token punctuation\">:<\/span><br \/>\n        <span class=\"token keyword\">print<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string-interpolation\"><span class=\"token string\">f&#034;Total GPUs: <\/span><span class=\"token interpolation\"><span class=\"token punctuation\">{<\/span>world_size<span class=\"token punctuation\">}<\/span><\/span><span class=\"token string\">, Local rank: <\/span><span class=\"token interpolation\"><span class=\"token punctuation\">{<\/span>local_rank<span class=\"token punctuation\">}<\/span><\/span><span class=\"token string\">&#034;<\/span><\/span><span class=\"token punctuation\">)<\/span><\/p>\n<p>    <span class=\"token comment\"># \u52a0\u8f7d\u6a21\u578b&#xff08;\u8ddf\u4e4b\u524d\u4e00\u6837&#xff09;<\/span><br \/>\n    model <span class=\"token operator\">&#061;<\/span> AutoModelForCausalLM<span class=\"token punctuation\">.<\/span>from_pretrained<span class=\"token punctuation\">(<\/span><br \/>\n        <span class=\"token string\">&#034;deepseek-ai\/DeepSeek-R1-Distill-Qwen-14B&#034;<\/span><span class=\"token punctuation\">,<\/span><br \/>\n        torch_dtype<span class=\"token operator\">&#061;<\/span>torch<span class=\"token punctuation\">.<\/span>bfloat16<span class=\"token punctuation\">,<\/span><br \/>\n        device_map<span class=\"token operator\">&#061;<\/span><span class=\"token punctuation\">{<\/span><span class=\"token string\">&#034;&#034;<\/span><span class=\"token punctuation\">:<\/span> local_rank<span class=\"token punctuation\">}<\/span><span class=\"token punctuation\">,<\/span>  <span class=\"token comment\"># \u5173\u952e&#xff1a;\u6307\u5b9a\u5f53\u524d\u5361<\/span><br \/>\n        trust_remote_code<span class=\"token operator\">&#061;<\/span><span class=\"token boolean\">True<\/span><br \/>\n    <span class=\"token punctuation\">)<\/span><\/p>\n<p>    <span class=\"token comment\"># LoRA<\/span><br \/>\n    lora_config <span class=\"token operator\">&#061;<\/span> LoraConfig<span class=\"token punctuation\">(<\/span><br \/>\n        r<span class=\"token operator\">&#061;<\/span><span class=\"token number\">128<\/span><span class=\"token punctuation\">,<\/span> lora_alpha<span class=\"token operator\">&#061;<\/span><span class=\"token number\">256<\/span><span class=\"token punctuation\">,<\/span><br \/>\n        target_modules<span class=\"token operator\">&#061;<\/span><span class=\"token punctuation\">[<\/span><span class=\"token string\">&#034;q_proj&#034;<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token string\">&#034;k_proj&#034;<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token string\">&#034;v_proj&#034;<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token string\">&#034;o_proj&#034;<\/span><span class=\"token punctuation\">,<\/span><br \/>\n                       <span class=\"token string\">&#034;gate_proj&#034;<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token string\">&#034;up_proj&#034;<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token string\">&#034;down_proj&#034;<\/span><span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">,<\/span><br \/>\n        lora_dropout<span class=\"token operator\">&#061;<\/span><span class=\"token number\">0.05<\/span><span class=\"token punctuation\">,<\/span> bias<span class=\"token operator\">&#061;<\/span><span class=\"token string\">&#034;none&#034;<\/span><span class=\"token punctuation\">,<\/span><br \/>\n        task_type<span class=\"token operator\">&#061;<\/span><span class=\"token string\">&#034;CAUSAL_LM&#034;<\/span><br \/>\n    <span class=\"token punctuation\">)<\/span><br \/>\n    model <span class=\"token operator\">&#061;<\/span> get_peft_model<span class=\"token punctuation\">(<\/span>model<span class=\"token punctuation\">,<\/span> lora_config<span class=\"token punctuation\">)<\/span><\/p>\n<p>    <span class=\"token comment\"># \u5173\u952e&#xff1a;\u5305\u88c5\u4e3a DDP\u3002\u6ce8\u610f device_ids \u5fc5\u987b\u8bbe&#xff0c;\u5426\u5219\u9ed8\u8ba4\u7528\u6240\u6709\u53ef\u89c1\u5361<\/span><br \/>\n    model <span class=\"token operator\">&#061;<\/span> DDP<span class=\"token punctuation\">(<\/span>model<span class=\"token punctuation\">,<\/span> device_ids<span class=\"token operator\">&#061;<\/span><span class=\"token punctuation\">[<\/span>local_rank<span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">,<\/span> output_device<span class=\"token operator\">&#061;<\/span>local_rank<span class=\"token punctuation\">)<\/span><\/p>\n<p>    <span class=\"token comment\"># \u52a0\u8f7d\u6570\u636e<\/span><br \/>\n    dataset <span class=\"token operator\">&#061;<\/span> load_dataset<span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;json&#034;<\/span><span class=\"token punctuation\">,<\/span> data_files<span class=\"token operator\">&#061;<\/span><span class=\"token string\">&#034;week1_mixed.jsonl&#034;<\/span><span class=\"token punctuation\">,<\/span> split<span class=\"token operator\">&#061;<\/span><span class=\"token string\">&#034;train&#034;<\/span><span class=\"token punctuation\">)<\/span><\/p>\n<p>    <span class=\"token comment\"># \u5173\u952e&#xff1a;DistributedSampler \u4fdd\u8bc1\u6bcf\u53f0\u673a\u5668\u53ea\u5904\u7406\u81ea\u5df1\u90a3\u6279\u6570\u636e<\/span><br \/>\n    sampler <span class=\"token operator\">&#061;<\/span> DistributedSampler<span class=\"token punctuation\">(<\/span>dataset<span class=\"token punctuation\">,<\/span> num_replicas<span class=\"token operator\">&#061;<\/span>world_size<span class=\"token punctuation\">,<\/span> rank<span class=\"token operator\">&#061;<\/span>global_rank<span class=\"token punctuation\">,<\/span> shuffle<span class=\"token operator\">&#061;<\/span><span class=\"token boolean\">True<\/span><span class=\"token punctuation\">)<\/span><\/p>\n<p>    <span class=\"token comment\"># \u6ce8\u610f&#xff1a;\u8fd9\u91cc\u7684 batch_size \u662f\u5355\u5361 batch_size&#xff01;<\/span><br \/>\n    <span class=\"token comment\"># \u603b global batch &#061; 4 * 10 * grad_accum<\/span><br \/>\n    dataloader <span class=\"token operator\">&#061;<\/span> DataLoader<span class=\"token punctuation\">(<\/span><br \/>\n        dataset<span class=\"token punctuation\">,<\/span><br \/>\n        sampler<span class=\"token operator\">&#061;<\/span>sampler<span class=\"token punctuation\">,<\/span><br \/>\n        batch_size<span class=\"token operator\">&#061;<\/span><span class=\"token number\">4<\/span><span class=\"token punctuation\">,<\/span>           <span class=\"token comment\"># \u5355\u5361 batch<\/span><br \/>\n        num_workers<span class=\"token operator\">&#061;<\/span><span class=\"token number\">4<\/span><span class=\"token punctuation\">,<\/span><br \/>\n        pin_memory<span class=\"token operator\">&#061;<\/span><span class=\"token boolean\">True<\/span><br \/>\n    <span class=\"token punctuation\">)<\/span><\/p>\n<p>    <span class=\"token comment\"># \u4f18\u5316\u5668<\/span><br \/>\n    optimizer <span class=\"token operator\">&#061;<\/span> torch<span class=\"token punctuation\">.<\/span>optim<span class=\"token punctuation\">.<\/span>AdamW<span class=\"token punctuation\">(<\/span>model<span class=\"token punctuation\">.<\/span>parameters<span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">,<\/span> lr<span class=\"token operator\">&#061;<\/span><span class=\"token number\">5e-6<\/span><span class=\"token punctuation\">,<\/span> weight_decay<span class=\"token operator\">&#061;<\/span><span class=\"token number\">0.1<\/span><span class=\"token punctuation\">)<\/span><\/p>\n<p>    <span class=\"token comment\"># \u8bad\u7ec3\u5faa\u73af<\/span><br \/>\n    model<span class=\"token punctuation\">.<\/span>train<span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><br \/>\n    <span class=\"token keyword\">for<\/span> epoch <span class=\"token keyword\">in<\/span> <span class=\"token builtin\">range<\/span><span class=\"token punctuation\">(<\/span><span class=\"token number\">3<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">:<\/span><br \/>\n        sampler<span class=\"token punctuation\">.<\/span>set_epoch<span class=\"token punctuation\">(<\/span>epoch<span class=\"token punctuation\">)<\/span>  <span class=\"token comment\"># \u5173\u952e&#xff1a;\u4fdd\u8bc1\u591a\u8282\u70b9 shuffle \u968f\u673a\u6027<\/span><br \/>\n        <span class=\"token keyword\">for<\/span> step<span class=\"token punctuation\">,<\/span> batch <span class=\"token keyword\">in<\/span> <span class=\"token builtin\">enumerate<\/span><span class=\"token punctuation\">(<\/span>dataloader<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">:<\/span><br \/>\n            <span class=\"token comment\"># \u6570\u636e\u8fc1\u79fb\u5230\u5f53\u524d GPU<\/span><br \/>\n            input_ids <span class=\"token operator\">&#061;<\/span> batch<span class=\"token punctuation\">[<\/span><span class=\"token string\">&#034;input_ids&#034;<\/span><span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">.<\/span>to<span class=\"token punctuation\">(<\/span>local_rank<span class=\"token punctuation\">)<\/span><br \/>\n            attention_mask <span class=\"token operator\">&#061;<\/span> batch<span class=\"token punctuation\">[<\/span><span class=\"token string\">&#034;attention_mask&#034;<\/span><span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">.<\/span>to<span class=\"token punctuation\">(<\/span>local_rank<span class=\"token punctuation\">)<\/span><br \/>\n            labels <span class=\"token operator\">&#061;<\/span> batch<span class=\"token punctuation\">[<\/span><span class=\"token string\">&#034;labels&#034;<\/span><span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">.<\/span>to<span class=\"token punctuation\">(<\/span>local_rank<span class=\"token punctuation\">)<\/span><\/p>\n<p>            outputs <span class=\"token operator\">&#061;<\/span> model<span class=\"token punctuation\">(<\/span>input_ids<span class=\"token operator\">&#061;<\/span>input_ids<span class=\"token punctuation\">,<\/span> attention_mask<span class=\"token operator\">&#061;<\/span>attention_mask<span class=\"token punctuation\">,<\/span> labels<span class=\"token operator\">&#061;<\/span>labels<span class=\"token punctuation\">)<\/span><br \/>\n            loss <span class=\"token operator\">&#061;<\/span> outputs<span class=\"token punctuation\">.<\/span>loss<\/p>\n<p>            <span class=\"token comment\"># \u68af\u5ea6\u7d2f\u79ef&#xff08;\u53ef\u9009&#xff0c;\u51cf\u5c11\u901a\u4fe1\u9891\u6b21&#xff09;<\/span><br \/>\n            loss <span class=\"token operator\">&#061;<\/span> loss <span class=\"token operator\">\/<\/span> <span class=\"token number\">4<\/span>  <span class=\"token comment\"># \u5047\u8bbe grad_accum&#061;4<\/span><br \/>\n            loss<span class=\"token punctuation\">.<\/span>backward<span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><\/p>\n<p>            <span class=\"token keyword\">if<\/span> <span class=\"token punctuation\">(<\/span>step <span class=\"token operator\">&#043;<\/span> <span class=\"token number\">1<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token operator\">%<\/span> <span class=\"token number\">4<\/span> <span class=\"token operator\">&#061;&#061;<\/span> <span class=\"token number\">0<\/span><span class=\"token punctuation\">:<\/span><br \/>\n                optimizer<span class=\"token punctuation\">.<\/span>step<span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><br \/>\n                optimizer<span class=\"token punctuation\">.<\/span>zero_grad<span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><\/p>\n<p>            <span class=\"token keyword\">if<\/span> global_rank <span class=\"token operator\">&#061;&#061;<\/span> <span class=\"token number\">0<\/span> <span class=\"token keyword\">and<\/span> step <span class=\"token operator\">%<\/span> <span class=\"token number\">50<\/span> <span class=\"token operator\">&#061;&#061;<\/span> <span class=\"token number\">0<\/span><span class=\"token punctuation\">:<\/span><br \/>\n                <span class=\"token keyword\">print<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string-interpolation\"><span class=\"token string\">f&#034;Epoch <\/span><span class=\"token interpolation\"><span class=\"token punctuation\">{<\/span>epoch<span class=\"token punctuation\">}<\/span><\/span><span class=\"token string\">, Step <\/span><span class=\"token interpolation\"><span class=\"token punctuation\">{<\/span>step<span class=\"token punctuation\">}<\/span><\/span><span class=\"token string\">, Loss: <\/span><span class=\"token interpolation\"><span class=\"token punctuation\">{<\/span>loss<span class=\"token punctuation\">.<\/span>item<span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">:<\/span><span class=\"token format-spec\">.4f<\/span><span class=\"token punctuation\">}<\/span><\/span><span class=\"token string\">&#034;<\/span><\/span><span class=\"token punctuation\">)<\/span><\/p>\n<p>        <span class=\"token comment\"># \u53ea\u5728\u4e3b\u8282\u70b9\u4fdd\u5b58<\/span><br \/>\n        <span class=\"token keyword\">if<\/span> global_rank <span class=\"token operator\">&#061;&#061;<\/span> <span class=\"token number\">0<\/span><span class=\"token punctuation\">:<\/span><br \/>\n            <span class=\"token comment\"># \u4fdd\u5b58\u65f6\u8981\u7528 model.module&#xff08;\u56e0\u4e3a DDP \u5305\u88c5\u4e86\u4e00\u5c42&#xff09;<\/span><br \/>\n            model<span class=\"token punctuation\">.<\/span>module<span class=\"token punctuation\">.<\/span>save_pretrained<span class=\"token punctuation\">(<\/span><span class=\"token string-interpolation\"><span class=\"token string\">f&#034;checkpoint_epoch_<\/span><span class=\"token interpolation\"><span class=\"token punctuation\">{<\/span>epoch<span class=\"token punctuation\">}<\/span><\/span><span class=\"token string\">&#034;<\/span><\/span><span class=\"token punctuation\">)<\/span><br \/>\n            <span class=\"token keyword\">print<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string-interpolation\"><span class=\"token string\">f&#034;Saved checkpoint at epoch <\/span><span class=\"token interpolation\"><span class=\"token punctuation\">{<\/span>epoch<span class=\"token punctuation\">}<\/span><\/span><span class=\"token string\">&#034;<\/span><\/span><span class=\"token punctuation\">)<\/span><\/p>\n<p>    dist<span class=\"token punctuation\">.<\/span>destroy_process_group<span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><\/p>\n<p><span class=\"token keyword\">if<\/span> __name__ <span class=\"token operator\">&#061;&#061;<\/span> <span class=\"token string\">&#034;__main__&#034;<\/span><span class=\"token punctuation\">:<\/span><br \/>\n    main<span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><\/p>\n<h4>3.2 \u4e00\u952e\u542f\u52a8\u811a\u672c<\/h4>\n<p>\u8282\u70b9 1&#xff08;\u4e3b\u8282\u70b9&#xff0c;\u5047\u8bbe IP \u4e3a 192.168.1.10&#xff09;&#xff1a;<\/p>\n<p><span class=\"token comment\"># node1.sh<\/span><br \/>\n<span class=\"token builtin class-name\">export<\/span> <span class=\"token assign-left variable\">NCCL_DEBUG<\/span><span class=\"token operator\">&#061;<\/span>INFO          <span class=\"token comment\"># \u8c03\u8bd5\u7528&#xff0c;\u8dd1\u901a\u540e\u53ef\u5220<\/span><br \/>\n<span class=\"token builtin class-name\">export<\/span> <span class=\"token assign-left variable\">NCCL_IB_DISABLE<\/span><span class=\"token operator\">&#061;<\/span><span class=\"token number\">0<\/span>        <span class=\"token comment\"># \u5982\u679c\u6709 IB&#xff0c;\u4fdd\u6301 0&#xff1b;\u5982\u679c\u7eaf\u4ee5\u592a\u7f51&#xff0c;\u8bbe 1<\/span><br \/>\n<span class=\"token builtin class-name\">export<\/span> <span class=\"token assign-left variable\">NCCL_SOCKET_IFNAME<\/span><span class=\"token operator\">&#061;<\/span>eth0  <span class=\"token comment\"># \u6539\u6210\u4f60\u7684\u5b9e\u9645\u7f51\u5361\u540d&#xff08;ifconfig \u770b&#xff09;<\/span><\/p>\n<p>torchrun <span class=\"token punctuation\">\\\\<\/span><br \/>\n    <span class=\"token parameter variable\">&#8211;nnodes<\/span><span class=\"token operator\">&#061;<\/span><span class=\"token number\">5<\/span> <span class=\"token punctuation\">\\\\<\/span><br \/>\n    <span class=\"token parameter variable\">&#8211;nproc_per_node<\/span><span class=\"token operator\">&#061;<\/span><span class=\"token number\">2<\/span> <span class=\"token punctuation\">\\\\<\/span><br \/>\n    <span class=\"token parameter variable\">&#8211;rdzv_id<\/span><span class=\"token operator\">&#061;<\/span>druggpt_job <span class=\"token punctuation\">\\\\<\/span><br \/>\n    <span class=\"token parameter variable\">&#8211;rdzv_backend<\/span><span class=\"token operator\">&#061;<\/span>c10d <span class=\"token punctuation\">\\\\<\/span><br \/>\n    <span class=\"token parameter variable\">&#8211;rdzv_endpoint<\/span><span class=\"token operator\">&#061;<\/span><span class=\"token number\">192.168<\/span>.1.10:29500 <span class=\"token punctuation\">\\\\<\/span><br \/>\n    train.py<\/p>\n<p>\u8282\u70b9 2~5&#xff08;\u5de5\u4f5c\u8282\u70b9&#xff09;&#xff1a;<\/p>\n<p><span class=\"token comment\"># node2.sh&#xff08;\u5176\u4ed6\u8282\u70b9\u552f\u4e00\u533a\u522b\u662f rdzv_endpoint \u6307\u5411\u4e3b\u8282\u70b9&#xff09;<\/span><br \/>\n<span class=\"token builtin class-name\">export<\/span> <span class=\"token assign-left variable\">NCCL_DEBUG<\/span><span class=\"token operator\">&#061;<\/span>INFO<br \/>\n<span class=\"token builtin class-name\">export<\/span> <span class=\"token assign-left variable\">NCCL_IB_DISABLE<\/span><span class=\"token operator\">&#061;<\/span><span class=\"token number\">0<\/span><br \/>\n<span class=\"token builtin class-name\">export<\/span> <span class=\"token assign-left variable\">NCCL_SOCKET_IFNAME<\/span><span class=\"token operator\">&#061;<\/span>eth0<\/p>\n<p>torchrun <span class=\"token punctuation\">\\\\<\/span><br \/>\n    <span class=\"token parameter variable\">&#8211;nnodes<\/span><span class=\"token operator\">&#061;<\/span><span class=\"token number\">5<\/span> <span class=\"token punctuation\">\\\\<\/span><br \/>\n    <span class=\"token parameter variable\">&#8211;nproc_per_node<\/span><span class=\"token operator\">&#061;<\/span><span class=\"token number\">2<\/span> <span class=\"token punctuation\">\\\\<\/span><br \/>\n    <span class=\"token parameter variable\">&#8211;rdzv_id<\/span><span class=\"token operator\">&#061;<\/span>druggpt_job <span class=\"token punctuation\">\\\\<\/span><br \/>\n    <span class=\"token parameter variable\">&#8211;rdzv_backend<\/span><span class=\"token operator\">&#061;<\/span>c10d <span class=\"token punctuation\">\\\\<\/span><br \/>\n    <span class=\"token parameter variable\">&#8211;rdzv_endpoint<\/span><span class=\"token operator\">&#061;<\/span><span class=\"token number\">192.168<\/span>.1.10:29500 <span class=\"token punctuation\">\\\\<\/span><br \/>\n    train.py<\/p>\n<p>\u6267\u884c\u65b9\u5f0f&#xff1a;<\/p>\n<p><span class=\"token comment\"># \u5728 5 \u53f0\u673a\u5668\u4e0a\u540c\u65f6\u6267\u884c\u5404\u81ea\u811a\u672c&#xff08;\u7528 tmux\/screen\/ssh \u5e76\u884c&#xff09;<\/span><br \/>\n<span class=\"token comment\"># \u6216\u8005\u5982\u679c\u4f60\u7528 Kubernetes\/Slurm&#xff0c;\u7531\u8c03\u5ea6\u7cfb\u7edf\u7edf\u4e00\u542f\u52a8<\/span><\/p>\n<hr \/>\n<h3>4. \u65b9\u6848 B&#xff1a;\u7528 Accelerate \u5e93&#xff08;\u66f4\u7701\u4e8b&#xff09;<\/h3>\n<p>HuggingFace Accelerate \u80fd\u81ea\u52a8\u751f\u6210\u591a\u8282\u70b9\u547d\u4ee4&#xff0c;\u4e0d\u7528\u624b\u5199 DDP&#xff1a;<\/p>\n<p><span class=\"token comment\"># 1. \u5728\u6bcf\u53f0\u673a\u5668\u4e0a\u751f\u6210\u914d\u7f6e<\/span><br \/>\naccelerate config <span class=\"token parameter variable\">&#8211;config_file<\/span> ds_config.yaml<br \/>\n<span class=\"token comment\"># \u4ea4\u4e92\u5f0f\u9009\u62e9&#xff1a;multi-node, 2 GPUs per node, DeepSpeed\/DDP<\/span><\/p>\n<p><span class=\"token comment\"># 2. \u4e3b\u8282\u70b9\u542f\u52a8&#xff08;Accelerate \u4f1a\u81ea\u52a8\u901a\u8fc7 rdzv \u53d1\u73b0\u5176\u4ed6\u8282\u70b9&#xff09;<\/span><br \/>\naccelerate launch <span class=\"token punctuation\">\\\\<\/span><br \/>\n    <span class=\"token parameter variable\">&#8211;config_file<\/span> ds_config.yaml <span class=\"token punctuation\">\\\\<\/span><br \/>\n    <span class=\"token parameter variable\">&#8211;main_process_ip<\/span> <span class=\"token number\">192.168<\/span>.1.10 <span class=\"token punctuation\">\\\\<\/span><br \/>\n    <span class=\"token parameter variable\">&#8211;main_process_port<\/span> <span class=\"token number\">29500<\/span> <span class=\"token punctuation\">\\\\<\/span><br \/>\n    <span class=\"token parameter variable\">&#8211;machine_rank<\/span> <span class=\"token number\">0<\/span> <span class=\"token punctuation\">\\\\<\/span><br \/>\n    <span class=\"token parameter variable\">&#8211;num_machines<\/span> <span class=\"token number\">5<\/span> <span class=\"token punctuation\">\\\\<\/span><br \/>\n    <span class=\"token parameter variable\">&#8211;num_processes<\/span> <span class=\"token number\">10<\/span> <span class=\"token punctuation\">\\\\<\/span><br \/>\n    train.py<\/p>\n<p>train.py \u51e0\u4e4e\u4e0d\u7528\u6539&#xff0c;\u628a model &#061; DDP(&#8230;) \u5220\u6389&#xff0c;Accelerate \u4f1a\u81ea\u52a8\u5904\u7406\u3002<\/p>\n<hr \/>\n<h3>5. \u65b9\u6848 C&#xff1a;\u5982\u679c\u7f51\u7edc\u5f88\u5dee&#xff08;\u964d\u7ea7&#xff09;<\/h3>\n<p>\u5982\u679c\u8282\u70b9\u95f4\u53ea\u6709\u5343\u5146\u7f51&#xff08;1Gbps&#xff09;&#xff0c;All-Reduce \u4f1a\u6210\u4e3a\u74f6\u9888\u3002\u6b64\u65f6\u4e0d\u8981\u5206\u5e03\u5f0f\u8bad\u4e00\u4e2a\u4efb\u52a1&#xff0c;\u800c\u662f&#xff1a;<\/p>\n<table>\n<tr>\u673a\u5668\u4efb\u52a1\u6570\u636e<\/tr>\n<tbody>\n<tr>\n<td>\u8282\u70b9 1-2<\/td>\n<td>\u8bad Week 1&#xff08;\u5168\u957f70%&#043;Domain30%&#xff09;<\/td>\n<td>\u6570\u636e\u5206\u7247 A<\/td>\n<\/tr>\n<tr>\n<td>\u8282\u70b9 3-4<\/td>\n<td>\u8bad Week 2&#xff08;\u5168\u957f30%&#043;Domain70%&#xff09;<\/td>\n<td>\u6570\u636e\u5206\u7247 B<\/td>\n<\/tr>\n<tr>\n<td>\u8282\u70b9 5<\/td>\n<td>\u8bad Week 3&#xff08;Domain50%&#043;Pocket50%&#xff09;<\/td>\n<td>\u6570\u636e\u5206\u7247 C<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u8fd9\u4e0d\u662f\u5206\u5e03\u5f0f&#xff0c;\u662f\u5e76\u884c\u8dd1\u5b9e\u9a8c\u3002\u6bcf\u53f0\u673a\u5668\u5185\u90e8 2 \u5f20\u5361\u7528 torchrun &#8211;nproc_per_node&#061;2 \u505a\u672c\u5730 DDP\u3002<\/p>\n<p>\u7ed3\u679c&#xff1a;5 \u4e2a\u5b9e\u9a8c\u540c\u65f6\u8dd1&#xff0c;3 \u5468\u540e\u9009\u6700\u4f18\u6a21\u578b\u3002\u9002\u5408\u7f51\u7edc\u5dee\u3001\u60f3\u5feb\u901f\u8bd5\u9519\u7684\u60c5\u51b5\u3002<\/p>\n<hr \/>\n<h3>6. \u5173\u952e\u68c0\u67e5\u6e05\u5355&#xff08;\u8dd1\u524d\u5fc5\u505a&#xff09;<\/h3>\n<p><span class=\"token comment\"># 1. \u786e\u8ba4 5 \u53f0\u673a\u5668 NCCL \u80fd\u4e92\u76f8\u53d1\u73b0&#xff08;\u5728\u4e3b\u8282\u70b9\u6267\u884c&#xff09;<\/span><br \/>\npython <span class=\"token parameter variable\">-c<\/span> <span class=\"token string\">&#034;import torch; print(torch.cuda.device_count())&#034;<\/span>  <span class=\"token comment\"># \u5e94\u8f93\u51fa 2<\/span><\/p>\n<p><span class=\"token comment\"># 2. \u786e\u8ba4\u7aef\u53e3\u4e92\u901a<\/span><br \/>\n<span class=\"token comment\"># \u5728\u8282\u70b9 2 \u4e0a&#xff1a;telnet 192.168.1.10 29500<\/span><br \/>\n<span class=\"token comment\"># \u5fc5\u987b\u80fd\u901a&#xff0c;\u5426\u5219 torchrun \u4f1a\u5361\u6b7b<\/span><\/p>\n<p><span class=\"token comment\"># 3. \u786e\u8ba4\u6240\u6709\u8282\u70b9 PyTorch\/CUDA\/NCCL \u7248\u672c\u4e00\u81f4<\/span><br \/>\npython <span class=\"token parameter variable\">-c<\/span> <span class=\"token string\">&#034;import torch; print(torch.__version__, torch.version.cuda)&#034;<\/span><\/p>\n<p><span class=\"token comment\"># 4. \u6570\u636e\u53ef\u89c1\u6027<\/span><br \/>\n<span class=\"token comment\"># \u6240\u6709\u8282\u70b9\u5fc5\u987b\u80fd\u8bfb\u53d6 week1_mixed.jsonl&#xff08;NFS \u6302\u8f7d\u6216\u6bcf\u53f0\u672c\u5730\u590d\u5236\u4e00\u4efd&#xff09;<\/span><\/p>\n<p><span class=\"token comment\"># 5. \u9632\u706b\u5899<\/span><br \/>\n<span class=\"token function\">sudo<\/span> ufw allow <span class=\"token number\">29500<\/span>\/tcp  <span class=\"token comment\"># Ubuntu \u793a\u4f8b<\/span><\/p>\n<hr \/>\n<h3>7. \u663e\u5b58\u4e0e\u901f\u5ea6\u9884\u671f<\/h3>\n<table>\n<tr>\u914d\u7f6e\u5355\u5361\u663e\u5b58\u5360\u7528\u5168\u5c40 Batch Size\u9884\u4f30\u901f\u5ea6<\/tr>\n<tbody>\n<tr>\n<td>\u5355\u5361\u72ec\u7acb (1&#215;2)<\/td>\n<td>~35 GB<\/td>\n<td>4<\/td>\n<td>1x<\/td>\n<\/tr>\n<tr>\n<td>\u5355\u673a\u53cc\u5361 (1&#215;2 DDP)<\/td>\n<td>~38 GB<\/td>\n<td>8<\/td>\n<td>~1.9x<\/td>\n<\/tr>\n<tr>\n<td>5\u673a10\u5361 (5&#215;2 DDP)<\/td>\n<td>~38 GB<\/td>\n<td>40<\/td>\n<td>~9x<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>10 \u5f20\u5361\u7406\u8bba\u4e0a\u80fd\u628a\u4f60\u7684\u8bad\u7ec3\u65f6\u95f4\u538b\u7f29\u5230\u539f\u6765\u7684 1\/9\u300230 \u4e07\u6b65\u5982\u679c\u539f\u6765\u8981 7 \u5929&#xff0c;\u73b0\u5728\u7ea6 18 \u5c0f\u65f6\u4e00\u4e2a epoch\u3002<\/p>\n<hr \/>\n<h3>8. \u603b\u7ed3<\/h3>\n<table>\n<tr>\u4f60\u7684\u60c5\u51b5\u63a8\u8350\u65b9\u6848<\/tr>\n<tbody>\n<tr>\n<td>\u8282\u70b9\u95f4\u6709 25Gbps&#043; \/ IB<\/td>\n<td>\u65b9\u6848 A&#xff1a;5\u673a10\u5361\u5206\u5e03\u5f0f\u8bad\u4e00\u4e2a\u4efb\u52a1<\/td>\n<\/tr>\n<tr>\n<td>\u8282\u70b9\u95f4\u53ea\u6709\u5343\u5146\u7f51<\/td>\n<td>\u65b9\u6848 C&#xff1a;\u6bcf\u53f0\u72ec\u7acb\u8dd1\u4e0d\u540c Week \u5b9e\u9a8c<\/td>\n<\/tr>\n<tr>\n<td>\u4e0d\u60f3\u6539\u4ee3\u7801<\/td>\n<td>\u65b9\u6848 B&#xff1a;Accelerate \u81ea\u52a8\u5206\u5e03\u5f0f<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u73b0\u5728\u6700\u8be5\u505a\u7684&#xff1a;<\/p>\n<li>\u9009\u4e00\u53f0\u673a\u5668&#xff0c;\u5148\u5355\u673a torchrun &#8211;nproc_per_node&#061;2 train.py \u8dd1\u901a<\/li>\n<li>\u786e\u8ba4\u80fd\u8dd1\u540e&#xff0c;5 \u53f0\u540c\u65f6\u542f\u52a8&#xff0c;\u52a0 &#8211;nnodes&#061;5<\/li>\n<li>\u89c2\u5bdf NCCL \u65e5\u5fd7&#xff0c;\u786e\u4fdd global rank 0-9 \u5168\u90e8\u4e0a\u7ebf<\/li>\n<p>\u9700\u8981\u6211\u63d0\u4f9b DeepSpeed ZeRO-1 \u7684\u591a\u8282\u70b9\u914d\u7f6e\u6587\u4ef6&#xff08;\u8fdb\u4e00\u6b65\u538b\u69a8\u901a\u4fe1\u6548\u7387&#xff09;&#xff0c;\u6216\u8005 Slurm \u96c6\u7fa4\u7684 sbatch \u63d0\u4ea4\u811a\u672c \u5417&#xff1f;<\/p>\n<p>Slurm&#xff08;\u5168\u79f0 Simple Linux Utility for Resource Management&#xff09;\u662f\u76ee\u524d\u5168\u7403\u6700\u4e3b\u6d41\u7684\u5f00\u6e90\u3001\u9ad8\u6027\u80fd\u8ba1\u7b97&#xff08;HPC&#xff09;\u96c6\u7fa4\u8d44\u6e90\u7ba1\u7406\u4e0e\u4f5c\u4e1a\u8c03\u5ea6\u7cfb\u7edf&#xff0c;\u88ab\u8d85\u7b97 TOP500 \u4e2d\u8d85\u8fc7\u534a\u6570\u7684\u7cfb\u7edf\u91c7\u7528\u3002<\/p>\n<h4>\u4e00\u3001\u6838\u5fc3\u5b9a\u4f4d\u4e0e\u4f5c\u7528<\/h4>\n<p>Slurm \u4f5c\u4e3a\u96c6\u7fa4\u201c\u64cd\u4f5c\u7cfb\u7edf\u201d&#xff0c;\u4e3b\u8981\u89e3\u51b3\u4e09\u5927\u95ee\u9898&#xff1a;<\/p>\n<li>\u8d44\u6e90\u5206\u914d&#xff1a;\u4e3a\u7528\u6237\u5206\u914d\u8ba1\u7b97\u8282\u70b9\u3001CPU\u3001GPU\u3001\u5185\u5b58\u3001\u7f51\u7edc\u7b49\u8d44\u6e90&#xff08;\u72ec\u5360\/\u5171\u4eab&#xff09;\u3002<\/li>\n<li>\u4f5c\u4e1a\u6267\u884c&#xff1a;\u63d0\u4f9b\u6846\u67b6\u542f\u52a8\u3001\u8fd0\u884c\u3001\u76d1\u63a7\u5e76\u884c\/\u4e32\u884c\u4f5c\u4e1a&#xff08;\u5982 MPI\u3001AI \u8bad\u7ec3&#xff09;\u3002<\/li>\n<li>\u8c03\u5ea6\u4ef2\u88c1&#xff1a;\u7ba1\u7406\u4f5c\u4e1a\u961f\u5217&#xff0c;\u6309\u7b56\u7565\u8c03\u5ea6\u3001\u89e3\u51b3\u8d44\u6e90\u7ade\u4e89\u3002<\/li>\n<h4>\u4e8c\u3001\u57fa\u672c\u67b6\u6784&#xff08;\u6838\u5fc3\u7ec4\u4ef6&#xff09;<\/h4>\n<ul>\n<li>slurmctld&#xff08;\u4e2d\u592e\u63a7\u5236\u5668&#xff09;\n<ul>\n<li>\u96c6\u7fa4\u5927\u8111&#xff1a;\u76d1\u63a7\u8d44\u6e90\u3001\u7ba1\u7406\u961f\u5217\u3001\u5206\u914d\u8d44\u6e90\u3001\u8c03\u5ea6\u4f5c\u4e1a\u3002<\/li>\n<li>\u652f\u6301\u4e3b\u5907\u5197\u4f59&#xff08;\u9ad8\u53ef\u7528&#xff09;\u3002<\/li>\n<\/ul>\n<\/li>\n<li>slurmd&#xff08;\u8282\u70b9\u5b88\u62a4&#xff09;\n<ul>\n<li>\u6bcf\u4e2a\u8ba1\u7b97\u8282\u70b9\u8fd0\u884c\u4e00\u4e2a&#xff1a;\u63a5\u6536\u6307\u4ee4\u3001\u542f\u52a8\u4efb\u52a1\u3001\u76d1\u63a7\u8282\u70b9\u72b6\u6001\u3002<\/li>\n<\/ul>\n<\/li>\n<li>slurmdbd&#xff08;\u8bb0\u8d26\u6570\u636e\u5e93&#xff09;\n<ul>\n<li>\u96c6\u4e2d\u5b58\u50a8\u4f5c\u4e1a\u5386\u53f2\u3001\u8d44\u6e90\u4f7f\u7528\u3001\u7528\u6237\u914d\u989d\u3001\u8d26\u5355\u6570\u636e\u3002<\/li>\n<\/ul>\n<\/li>\n<li>slurmstepd\n<ul>\n<li>\u4f5c\u4e1a\u6b65\u5b88\u62a4&#xff1a;\u7ba1\u7406\u5355\u4e2a\u4f5c\u4e1a\u5185\u4efb\u52a1\u7684 I\/O\u3001\u4fe1\u53f7\u3001\u8d44\u6e90\u9650\u5236\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\u7528\u6237\u547d\u4ee4\n<ul>\n<li>sbatch&#xff1a;\u6279\u5904\u7406\u4f5c\u4e1a\u63d0\u4ea4<\/li>\n<li>srun&#xff1a;\u4ea4\u4e92\u5f0f\/\u5b9e\u65f6\u8fd0\u884c<\/li>\n<li>salloc&#xff1a;\u7533\u8bf7\u8d44\u6e90\u5e76\u8fdb\u5165\u4f1a\u8bdd<\/li>\n<li>sinfo&#xff1a;\u67e5\u770b\u96c6\u7fa4\/\u8282\u70b9\u72b6\u6001<\/li>\n<li>squeue&#xff1a;\u67e5\u770b\u6392\u961f\/\u8fd0\u884c\u4f5c\u4e1a<\/li>\n<li>scancel&#xff1a;\u53d6\u6d88\u4f5c\u4e1a<\/li>\n<li>sacct&#xff1a;\u67e5\u8be2\u5386\u53f2\u8bb0\u8d26<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h4>\u4e09\u3001\u5173\u952e\u7279\u6027<\/h4>\n<ul>\n<li>\u6781\u81f4\u53ef\u6269\u5c55&#xff1a;\u5355\u96c6\u7fa4\u53ef\u7ba1\u7406\u6570\u767e\u4e07 CPU \u6838\u5fc3\u3001\u6570\u4e07\u8282\u70b9\u3002<\/li>\n<li>\u9ad8\u53ef\u7528&#xff1a;\u63a7\u5236\u5668\u4e3b\u5907\u3001\u8282\u70b9\u6545\u969c\u9694\u79bb\u3001\u65e0\u5355\u70b9\u5931\u6548\u3002<\/li>\n<li>\u4e30\u5bcc\u8c03\u5ea6\u7b56\u7565\n<ul>\n<li>FIFO\u3001\u516c\u5e73\u5171\u4eab&#xff08;Fair-share&#xff09;\u3001\u56de\u586b\u8c03\u5ea6&#xff08;Backfill&#xff09;<\/li>\n<li>\u4f18\u5148\u7ea7\u3001\u62a2\u5360\u3001\u9884\u7559\u3001GANG \u8c03\u5ea6&#xff08;\u5206\u65f6&#xff09;<\/li>\n<\/ul>\n<\/li>\n<li>\u8d44\u6e90\u7cbe\u7ec6\u5316\u7ba1\u7406\n<ul>\n<li>\u652f\u6301 CPU\/GPU\/\u5185\u5b58\/\u7f51\u5361\/IB \u7b49\u7ed1\u5b9a\u4e0e\u9694\u79bb<\/li>\n<li>\u5206\u533a&#xff08;Partition&#xff09;\u3001QoS\u3001\u7528\u6237\/\u8d26\u6237\u914d\u989d\u3001\u65f6\u9650<\/li>\n<\/ul>\n<\/li>\n<li>\u4f5c\u4e1a\u9ad8\u7ea7\u7279\u6027\n<ul>\n<li>\u4f5c\u4e1a\u4f9d\u8d56\u3001\u4f5c\u4e1a\u6570\u7ec4\u3001\u6570\u7ec4\u4efb\u52a1\u3001\u4fe1\u53f7\u63a7\u5236<\/li>\n<li>\u6807\u51c6\u8f93\u51fa\/\u9519\u8bef\u91cd\u5b9a\u5411\u3001\u5b9e\u65f6 attach \u4f5c\u4e1a&#xff08;sattach&#xff09;<\/li>\n<\/ul>\n<\/li>\n<li>\u63d2\u4ef6\u5316&#xff1a;\u8c03\u5ea6\u3001\u8bb0\u8d26\u3001\u8ba4\u8bc1\u3001\u7f51\u7edc\u7b49\u5747\u4e3a\u63d2\u4ef6&#xff0c;\u6613\u6269\u5c55\u3002<\/li>\n<li>\u5f00\u6e90\u514d\u8d39&#xff1a;GPLv2 \u534f\u8bae&#xff0c;\u793e\u533a\u6d3b\u8dc3\u3002<\/li>\n<\/ul>\n<h4>\u56db\u3001\u5178\u578b\u4f7f\u7528\u6d41\u7a0b&#xff08;\u7528\u6237\u89c6\u89d2&#xff09;<\/h4>\n<li>\u7528 sinfo \u770b\u53ef\u7528\u8d44\u6e90\u3002<\/li>\n<li>\u5199\u811a\u672c&#xff08;job.sh&#xff09;&#xff0c;\u6307\u5b9a\u8d44\u6e90&#xff1a;<span class=\"token shebang important\">#!\/bin\/bash<\/span><br \/>\n<span class=\"token comment\">#SBATCH &#8211;job-name&#061;my_train<\/span><br \/>\n<span class=\"token comment\">#SBATCH &#8211;nodes&#061;2<\/span><br \/>\n<span class=\"token comment\">#SBATCH &#8211;ntasks-per-node&#061;8<\/span><br \/>\n<span class=\"token comment\">#SBATCH &#8211;gres&#061;gpu:4<\/span><br \/>\n<span class=\"token comment\">#SBATCH &#8211;time&#061;12:00:00<\/span><br \/>\npython train.py<\/p>\n<\/li>\n<li>\u63d0\u4ea4&#xff1a;sbatch job.sh<\/li>\n<li>\u67e5\u770b&#xff1a;squeue\u3001sacct<\/li>\n<li>\u53d6\u6d88&#xff1a;scancel &lt;jobid&gt;<\/li>\n<h4>\u4e94\u3001\u5e94\u7528\u573a\u666f<\/h4>\n<ul>\n<li>\u8d85\u7b97\u4e2d\u5fc3\u3001\u9ad8\u6821\/\u79d1\u7814\u96c6\u7fa4<\/li>\n<li>AI \u8bad\u7ec3\u96c6\u7fa4&#xff08;\u5927\u6a21\u578b\u3001\u6df1\u5ea6\u5b66\u4e60&#xff09;<\/li>\n<li>\u4e91\u8ba1\u7b97\u3001\u79c1\u6709\u4e91\u8d44\u6e90\u8c03\u5ea6<\/li>\n<li>\u5927\u89c4\u6a21\u79d1\u5b66\u8ba1\u7b97\u3001\u6570\u503c\u6a21\u62df\u3001\u751f\u7269\u4fe1\u606f\u3001\u6c14\u8c61\u3001CAE \u7b49<\/li>\n<\/ul>\n<h4>\u516d\u3001\u4e0e\u540c\u7c7b\u5bf9\u6bd4<\/h4>\n<ul>\n<li>\u6bd4 PBS Pro\u3001LSF \u66f4\u8f7b\u91cf\u3001\u5f00\u6e90\u3001\u751f\u6001\u5f3a\u3002<\/li>\n<li>\u6bd4 Kubernetes \u66f4\u9002\u5408\u957f\u65f6\u3001\u6279\u5904\u7406\u3001MPI \u5e76\u884c\u3001GPU \u5bc6\u96c6\u7684 HPC \u573a\u666f\u3002<\/li>\n<\/ul>\n<p>\u8981\u4e0d\u8981\u6211\u7ed9\u4f60\u4e00\u4efd\u53ef\u76f4\u63a5\u590d\u5236\u7684 Slurm \u5e38\u7528\u547d\u4ee4\u901f\u67e5\u8868&#xff08;\u542b\u63d0\u4ea4\u3001\u67e5\u8be2\u3001\u76d1\u63a7\u3001\u53d6\u6d88\u3001\u8d44\u6e90\u67e5\u770b&#xff09;&#xff1f;<\/p>\n<p>\u8fd9\u4efd\u662f\u8d85\u7cbe\u7b80\u3001\u53ef\u76f4\u63a5\u590d\u5236\u7c98\u8d34\u7684 Slurm \u5e38\u7528\u547d\u4ee4\u901f\u67e5\u8868&#xff0c;\u65e5\u5e38HPC\/AI\u8bad\u7ec3\u5b8c\u5168\u591f\u7528\u3002<\/p>\n<hr \/>\n<h2>Slurm \u5e38\u7528\u547d\u4ee4\u901f\u67e5<\/h2>\n<h3>\u4e00\u3001\u67e5\u770b\u96c6\u7fa4\u4e0e\u8d44\u6e90<\/h3>\n<p><span class=\"token comment\"># \u67e5\u770b\u6240\u6709\u8282\u70b9\/\u5206\u533a\u72b6\u6001<\/span><br \/>\nsinfo<\/p>\n<p><span class=\"token comment\"># \u53ea\u770b\u7a7a\u95f2\u8282\u70b9<\/span><br \/>\nsinfo <span class=\"token parameter variable\">-N<\/span> <span class=\"token parameter variable\">-l<\/span> <span class=\"token operator\">|<\/span> <span class=\"token function\">grep<\/span> idle<\/p>\n<p><span class=\"token comment\"># \u67e5\u770b GPU \u8d44\u6e90&#xff08;\u9700\u8981\u96c6\u7fa4\u914d\u7f6e gres&#xff09;<\/span><br \/>\nsinfo <span class=\"token parameter variable\">-o<\/span> <span class=\"token string\">&#034;%N %P %T %G&#034;<\/span><\/p>\n<p><span class=\"token comment\"># \u67e5\u770b\u8282\u70b9\u8be6\u7ec6\u4fe1\u606f<\/span><br \/>\nscontrol show <span class=\"token function\">node<\/span> <span class=\"token operator\">&lt;<\/span>\u8282\u70b9\u540d<span class=\"token operator\">&gt;<\/span><\/p>\n<hr \/>\n<h3>\u4e8c\u3001\u4f5c\u4e1a\u63d0\u4ea4&#xff08;\u6700\u5e38\u7528&#xff09;<\/h3>\n<h4>1. \u63d0\u4ea4\u6279\u5904\u7406\u811a\u672c<\/h4>\n<p>sbatch job.sh<\/p>\n<h4>2. \u5e38\u7528 #SBATCH \u53c2\u6570&#xff08;\u5199\u5728\u811a\u672c\u5f00\u5934&#xff09;<\/h4>\n<p><span class=\"token shebang important\">#!\/bin\/bash<\/span><br \/>\n<span class=\"token comment\">#SBATCH &#8211;job-name&#061;myjob       # \u4f5c\u4e1a\u540d<\/span><br \/>\n<span class=\"token comment\">#SBATCH &#8211;partition&#061;your_part  # \u5206\u533a<\/span><br \/>\n<span class=\"token comment\">#SBATCH &#8211;nodes&#061;1              # \u8282\u70b9\u6570<\/span><br \/>\n<span class=\"token comment\">#SBATCH &#8211;ntasks-per-node&#061;8     # \u6bcf\u8282\u70b9\u4efb\u52a1\u6570<\/span><br \/>\n<span class=\"token comment\">#SBATCH &#8211;gres&#061;gpu:1           # GPU \u6570\u91cf<\/span><br \/>\n<span class=\"token comment\">#SBATCH &#8211;mem&#061;32G              # \u603b\u5185\u5b58<\/span><br \/>\n<span class=\"token comment\">#SBATCH &#8211;time&#061;12:00:00        # \u6700\u5927\u8fd0\u884c\u65f6\u95f4<\/span><br \/>\n<span class=\"token comment\">#SBATCH &#8211;output&#061;%j.out        # \u8f93\u51fa\u65e5\u5fd7<\/span><br \/>\n<span class=\"token comment\">#SBATCH &#8211;error&#061;%j.err         # \u9519\u8bef\u65e5\u5fd7<\/span><br \/>\n<span class=\"token comment\">#SBATCH &#8211;mail-type&#061;END        # \u7ed3\u675f\u65f6\u53d1\u90ae\u4ef6<\/span><\/p>\n<h4>3. \u76f4\u63a5\u4ea4\u4e92\u5f0f\u8fd0\u884c<\/h4>\n<p>srun <span class=\"token parameter variable\">-p<\/span> \u5206\u533a <span class=\"token parameter variable\">&#8211;gres<\/span><span class=\"token operator\">&#061;<\/span>gpu:1 nvidia-smi<\/p>\n<h4>4. \u7533\u8bf7\u8d44\u6e90\u8fdb\u5165\u8282\u70b9<\/h4>\n<p>salloc <span class=\"token parameter variable\">-p<\/span> \u5206\u533a <span class=\"token parameter variable\">&#8211;gres<\/span><span class=\"token operator\">&#061;<\/span>gpu:1 <span class=\"token parameter variable\">&#8211;time<\/span><span class=\"token operator\">&#061;<\/span><span class=\"token number\">2<\/span>:00:00<br \/>\n<span class=\"token comment\"># \u8fdb\u5165\u540e&#xff1a;ssh \u8282\u70b9\u540d<\/span><\/p>\n<hr \/>\n<h3>\u4e09\u3001\u67e5\u770b\u4f5c\u4e1a<\/h3>\n<p><span class=\"token comment\"># \u67e5\u770b\u81ea\u5df1\u7684\u4f5c\u4e1a<\/span><br \/>\nsqueue<\/p>\n<p><span class=\"token comment\"># \u67e5\u770b\u6240\u6709\u4eba\u7684\u4f5c\u4e1a<\/span><br \/>\nsqueue <span class=\"token parameter variable\">-a<\/span><\/p>\n<p><span class=\"token comment\"># \u53ea\u770b\u81ea\u5df1<\/span><br \/>\nsqueue <span class=\"token parameter variable\">-u<\/span> <span class=\"token environment constant\">$USER<\/span><\/p>\n<p><span class=\"token comment\"># \u67e5\u770b\u4f5c\u4e1a\u8be6\u7ec6\u4fe1\u606f<\/span><br \/>\nscontrol show job <span class=\"token operator\">&lt;<\/span>jobid<span class=\"token operator\">&gt;<\/span><\/p>\n<p><span class=\"token comment\"># \u67e5\u770b\u5386\u53f2\u4f5c\u4e1a&#xff08;\u7ed3\u675f\u7684\u4f5c\u4e1a&#xff09;<\/span><br \/>\nsacct<br \/>\nsacct <span class=\"token parameter variable\">-j<\/span> <span class=\"token operator\">&lt;<\/span>jobid<span class=\"token operator\">&gt;<\/span><br \/>\nsacct <span class=\"token parameter variable\">-u<\/span> <span class=\"token environment constant\">$USER<\/span> <span class=\"token parameter variable\">&#8211;format<\/span><span class=\"token operator\">&#061;<\/span>jobid,jobname,partition,state,elapsed<\/p>\n<hr \/>\n<h3>\u56db\u3001\u63a7\u5236\u4f5c\u4e1a<\/h3>\n<p><span class=\"token comment\"># \u53d6\u6d88\u4e00\u4e2a\u4f5c\u4e1a<\/span><br \/>\nscancel <span class=\"token operator\">&lt;<\/span>jobid<span class=\"token operator\">&gt;<\/span><\/p>\n<p><span class=\"token comment\"># \u53d6\u6d88\u81ea\u5df1\u6240\u6709\u4f5c\u4e1a<\/span><br \/>\nscancel <span class=\"token parameter variable\">-u<\/span> <span class=\"token environment constant\">$USER<\/span><\/p>\n<p><span class=\"token comment\"># \u6682\u505c\/\u6062\u590d\u4f5c\u4e1a<\/span><br \/>\nscontrol hold <span class=\"token operator\">&lt;<\/span>jobid<span class=\"token operator\">&gt;<\/span><br \/>\nscontrol release <span class=\"token operator\">&lt;<\/span>jobid<span class=\"token operator\">&gt;<\/span><\/p>\n<p><span class=\"token comment\"># \u4fee\u6539\u4f5c\u4e1a\u6700\u5927\u65f6\u9650<\/span><br \/>\nscontrol update <span class=\"token assign-left variable\">jobid<\/span><span class=\"token operator\">&#061;<\/span><span class=\"token operator\">&lt;<\/span>jobid<span class=\"token operator\">&gt;<\/span> <span class=\"token assign-left variable\">timelimit<\/span><span class=\"token operator\">&#061;<\/span><span class=\"token number\">24<\/span>:00:00<\/p>\n<hr \/>\n<h3>\u4e94\u3001\u67e5\u770b\u8d26\u6237\u4e0e\u914d\u989d<\/h3>\n<p><span class=\"token comment\"># \u67e5\u770b\u8d26\u6237\u4fe1\u606f<\/span><br \/>\nsacctmgr show assoc <span class=\"token assign-left variable\">user<\/span><span class=\"token operator\">&#061;<\/span><span class=\"token environment constant\">$USER<\/span><\/p>\n<p><span class=\"token comment\"># \u67e5\u770b QoS \u9650\u5236<\/span><br \/>\nsacctmgr show qos<\/p>\n<hr \/>\n<h3>\u516d\u3001\u5e38\u7528\u72b6\u6001\u8bf4\u660e<\/h3>\n<ul>\n<li>PD&#xff1a;Pending \u6392\u961f<\/li>\n<li>R&#xff1a;Running \u8fd0\u884c\u4e2d<\/li>\n<li>CG&#xff1a;Completing \u6b63\u5728\u7ed3\u675f<\/li>\n<li>F&#xff1a;Failed \u5931\u8d25<\/li>\n<li>TO&#xff1a;TimeOut \u8d85\u65f6<\/li>\n<li>CA&#xff1a;Canceled \u88ab\u53d6\u6d88<\/li>\n<\/ul>\n<hr \/>\n<p>\u5982\u679c\u4f60\u544a\u8bc9\u6211\u4f60\u7528\u7684\u662fCPU \u8fd8\u662f GPU \u8bad\u7ec3&#xff0c;\u6211\u53ef\u4ee5\u76f4\u63a5\u7ed9\u4f60\u4e00\u4e2a\u53ef\u76f4\u63a5\u7528\u7684\u901a\u7528 sbatch \u811a\u672c\u6a21\u677f\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u591a\u53f0\u670d\u52a1\u5668\u540c\u65f6\u8bad\u7ec3llamfactory \u5927\u8bed\u8a00\u6a21\u578b \u56fd\u5bb6\u8d85\u7b97\u4e2d\u5fc3 Slurm \u662f\u76ee\u524d\u5168\u7403\u6700\u4e3b\u6d41\u7684\u5f00\u6e90\u3001\u9ad8\u6027\u80fd\u8ba1\u7b97&#xff08;HPC&#xff09;\u96c6\u7fa4\u8d44\u6e90\u7ba1\u7406\u4e0e\u4f5c\u4e1a\u8c03\u5ea6\u7cfb\u7edf<br \/>\n\u5b8c\u5168\u53ef\u4ee5\u300210 \u5f20 64GB Blackwell \u8de8 5 \u8282\u70b9\u5206\u5e03\u5f0f\u8bad\u7ec3 14BLoRA \u4e0d\u4ec5\u53ef\u884c&#xff0c;\u800c\u4e14\u5355\u5361\u663e\u5b58\u975e\u5e38\u5bbd\u88d5\u30021. \u663e\u5b58\u6838\u7b97&#xff08;\u6253\u6d88\u987e\u8651&#xff09;\u9879\u76ee\u5360\u7528\u4f30\u7b97\u8bf4\u660e14B \u57fa\u5ea7 (BF16)~28 GB\u53c2\u6570\u672c\u8eabLoRA \u53ef\u8bad\u7ec3\u53c2\u6570 (r128)~0.2 GB<\/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":[227,43,51],"topic":[],"class_list":["post-84370","post","type-post","status-publish","format-standard","hentry","category-server","tag-227","tag-43","tag-51"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u591a\u53f0\u670d\u52a1\u5668\u540c\u65f6\u8bad\u7ec3llamfactory \u5927\u8bed\u8a00\u6a21\u578b \u56fd\u5bb6\u8d85\u7b97\u4e2d\u5fc3 Slurm \u662f\u76ee\u524d\u5168\u7403\u6700\u4e3b\u6d41\u7684\u5f00\u6e90\u3001\u9ad8\u6027\u80fd\u8ba1\u7b97\uff08HPC\uff09\u96c6\u7fa4\u8d44\u6e90\u7ba1\u7406\u4e0e\u4f5c\u4e1a\u8c03\u5ea6\u7cfb\u7edf - \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\/84370.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u591a\u53f0\u670d\u52a1\u5668\u540c\u65f6\u8bad\u7ec3llamfactory \u5927\u8bed\u8a00\u6a21\u578b \u56fd\u5bb6\u8d85\u7b97\u4e2d\u5fc3 Slurm \u662f\u76ee\u524d\u5168\u7403\u6700\u4e3b\u6d41\u7684\u5f00\u6e90\u3001\u9ad8\u6027\u80fd\u8ba1\u7b97\uff08HPC\uff09\u96c6\u7fa4\u8d44\u6e90\u7ba1\u7406\u4e0e\u4f5c\u4e1a\u8c03\u5ea6\u7cfb\u7edf - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u591a\u53f0\u670d\u52a1\u5668\u540c\u65f6\u8bad\u7ec3llamfactory \u5927\u8bed\u8a00\u6a21\u578b \u56fd\u5bb6\u8d85\u7b97\u4e2d\u5fc3 Slurm \u662f\u76ee\u524d\u5168\u7403\u6700\u4e3b\u6d41\u7684\u5f00\u6e90\u3001\u9ad8\u6027\u80fd\u8ba1\u7b97&#xff08;HPC&#xff09;\u96c6\u7fa4\u8d44\u6e90\u7ba1\u7406\u4e0e\u4f5c\u4e1a\u8c03\u5ea6\u7cfb\u7edf \u5b8c\u5168\u53ef\u4ee5\u300210 \u5f20 64GB Blackwell \u8de8 5 \u8282\u70b9\u5206\u5e03\u5f0f\u8bad\u7ec3 14BLoRA \u4e0d\u4ec5\u53ef\u884c&#xff0c;\u800c\u4e14\u5355\u5361\u663e\u5b58\u975e\u5e38\u5bbd\u88d5\u30021. \u663e\u5b58\u6838\u7b97&#xff08;\u6253\u6d88\u987e\u8651&#xff09;\u9879\u76ee\u5360\u7528\u4f30\u7b97\u8bf4\u660e14B \u57fa\u5ea7 (BF16)~28 GB\u53c2\u6570\u672c\u8eabLoRA \u53ef\u8bad\u7ec3\u53c2\u6570 (r128)~0.2 GB\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/84370.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-07-26T04:25:29+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=\"6 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/84370.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/84370.html\",\"name\":\"\u591a\u53f0\u670d\u52a1\u5668\u540c\u65f6\u8bad\u7ec3llamfactory \u5927\u8bed\u8a00\u6a21\u578b \u56fd\u5bb6\u8d85\u7b97\u4e2d\u5fc3 Slurm \u662f\u76ee\u524d\u5168\u7403\u6700\u4e3b\u6d41\u7684\u5f00\u6e90\u3001\u9ad8\u6027\u80fd\u8ba1\u7b97\uff08HPC\uff09\u96c6\u7fa4\u8d44\u6e90\u7ba1\u7406\u4e0e\u4f5c\u4e1a\u8c03\u5ea6\u7cfb\u7edf - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-07-26T04:25:29+00:00\",\"dateModified\":\"2026-07-26T04:25:29+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/84370.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/84370.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/84370.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u591a\u53f0\u670d\u52a1\u5668\u540c\u65f6\u8bad\u7ec3llamfactory \u5927\u8bed\u8a00\u6a21\u578b \u56fd\u5bb6\u8d85\u7b97\u4e2d\u5fc3 Slurm \u662f\u76ee\u524d\u5168\u7403\u6700\u4e3b\u6d41\u7684\u5f00\u6e90\u3001\u9ad8\u6027\u80fd\u8ba1\u7b97\uff08HPC\uff09\u96c6\u7fa4\u8d44\u6e90\u7ba1\u7406\u4e0e\u4f5c\u4e1a\u8c03\u5ea6\u7cfb\u7edf\"}]},{\"@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":"\u591a\u53f0\u670d\u52a1\u5668\u540c\u65f6\u8bad\u7ec3llamfactory \u5927\u8bed\u8a00\u6a21\u578b \u56fd\u5bb6\u8d85\u7b97\u4e2d\u5fc3 Slurm \u662f\u76ee\u524d\u5168\u7403\u6700\u4e3b\u6d41\u7684\u5f00\u6e90\u3001\u9ad8\u6027\u80fd\u8ba1\u7b97\uff08HPC\uff09\u96c6\u7fa4\u8d44\u6e90\u7ba1\u7406\u4e0e\u4f5c\u4e1a\u8c03\u5ea6\u7cfb\u7edf - \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\/84370.html","og_locale":"zh_CN","og_type":"article","og_title":"\u591a\u53f0\u670d\u52a1\u5668\u540c\u65f6\u8bad\u7ec3llamfactory \u5927\u8bed\u8a00\u6a21\u578b \u56fd\u5bb6\u8d85\u7b97\u4e2d\u5fc3 Slurm \u662f\u76ee\u524d\u5168\u7403\u6700\u4e3b\u6d41\u7684\u5f00\u6e90\u3001\u9ad8\u6027\u80fd\u8ba1\u7b97\uff08HPC\uff09\u96c6\u7fa4\u8d44\u6e90\u7ba1\u7406\u4e0e\u4f5c\u4e1a\u8c03\u5ea6\u7cfb\u7edf - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u591a\u53f0\u670d\u52a1\u5668\u540c\u65f6\u8bad\u7ec3llamfactory \u5927\u8bed\u8a00\u6a21\u578b \u56fd\u5bb6\u8d85\u7b97\u4e2d\u5fc3 Slurm \u662f\u76ee\u524d\u5168\u7403\u6700\u4e3b\u6d41\u7684\u5f00\u6e90\u3001\u9ad8\u6027\u80fd\u8ba1\u7b97&#xff08;HPC&#xff09;\u96c6\u7fa4\u8d44\u6e90\u7ba1\u7406\u4e0e\u4f5c\u4e1a\u8c03\u5ea6\u7cfb\u7edf \u5b8c\u5168\u53ef\u4ee5\u300210 \u5f20 64GB Blackwell \u8de8 5 \u8282\u70b9\u5206\u5e03\u5f0f\u8bad\u7ec3 14BLoRA \u4e0d\u4ec5\u53ef\u884c&#xff0c;\u800c\u4e14\u5355\u5361\u663e\u5b58\u975e\u5e38\u5bbd\u88d5\u30021. \u663e\u5b58\u6838\u7b97&#xff08;\u6253\u6d88\u987e\u8651&#xff09;\u9879\u76ee\u5360\u7528\u4f30\u7b97\u8bf4\u660e14B \u57fa\u5ea7 (BF16)~28 GB\u53c2\u6570\u672c\u8eabLoRA \u53ef\u8bad\u7ec3\u53c2\u6570 (r128)~0.2 GB","og_url":"https:\/\/www.wsisp.com\/helps\/84370.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-07-26T04:25:29+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"6 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/84370.html","url":"https:\/\/www.wsisp.com\/helps\/84370.html","name":"\u591a\u53f0\u670d\u52a1\u5668\u540c\u65f6\u8bad\u7ec3llamfactory \u5927\u8bed\u8a00\u6a21\u578b \u56fd\u5bb6\u8d85\u7b97\u4e2d\u5fc3 Slurm \u662f\u76ee\u524d\u5168\u7403\u6700\u4e3b\u6d41\u7684\u5f00\u6e90\u3001\u9ad8\u6027\u80fd\u8ba1\u7b97\uff08HPC\uff09\u96c6\u7fa4\u8d44\u6e90\u7ba1\u7406\u4e0e\u4f5c\u4e1a\u8c03\u5ea6\u7cfb\u7edf - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-07-26T04:25:29+00:00","dateModified":"2026-07-26T04:25:29+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/84370.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/84370.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/84370.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"\u591a\u53f0\u670d\u52a1\u5668\u540c\u65f6\u8bad\u7ec3llamfactory \u5927\u8bed\u8a00\u6a21\u578b \u56fd\u5bb6\u8d85\u7b97\u4e2d\u5fc3 Slurm \u662f\u76ee\u524d\u5168\u7403\u6700\u4e3b\u6d41\u7684\u5f00\u6e90\u3001\u9ad8\u6027\u80fd\u8ba1\u7b97\uff08HPC\uff09\u96c6\u7fa4\u8d44\u6e90\u7ba1\u7406\u4e0e\u4f5c\u4e1a\u8c03\u5ea6\u7cfb\u7edf"}]},{"@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\/84370","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=84370"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/84370\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=84370"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=84370"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=84370"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=84370"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}