LLaMA-Factory在华为显卡上的实行记录

鼠扑  金牌会员 | 2024-7-29 16:23:55 | 显示全部楼层 | 阅读模式
打印 上一主题 下一主题

主题 577|帖子 577|积分 1731

如何判断目前所选择的模型是否支持
LLaMA-Factory/src/llamafactory/data/template.py
在项目的这个地址中会有差异模型的支持模版。
这里用目前我最常用的两个模型举例子 一个是智谱的glm4-9B模型
  1. _register_template(
  2.     name="glm4",
  3.     format_user=StringFormatter(slots=["<|user|>\n{{content}}<|assistant|>"]),
  4.     format_assistant=StringFormatter(slots=["\n{{content}}"]),
  5.     format_system=StringFormatter(slots=["<|system|>\n{{content}}"]),
  6.     format_function=FunctionFormatter(slots=["{{name}}\n{{arguments}}"]),
  7.     format_observation=StringFormatter(slots=["<|observation|>\n{{content}}<|assistant|>"]),
  8.     format_tools=ToolFormatter(tool_format="glm4"),
  9.     format_prefix=EmptyFormatter(slots=["[gMASK]<sop>"]),
  10.     stop_words=["<|user|>", "<|observation|>"],
  11.     efficient_eos=True,
  12. )
复制代码
这段代码看起来是在界说一个模板(template)的注册过程,可能是在某个框架或者系统中利用。让我来解释一下每个参数的作用和寄义:
_register_template(...)

这是一个函数或者方法,用来注册一个名为 "glm4" 的模板。
参数解释:


  • name=“glm4”

    • 这里指定了模板的名称,即 "glm4"。

  • format_user=StringFormatter(slots=[“\n{{content}}”])

    • format_user 是用来格式化用户输入的内容的格式器(formatter)。
    • StringFormatter(slots=["\n{{content}}"]) 表现利用字符串格式化器,slots=["\n{{content}}"] 指定了插槽(slots),用于接收用户输入内容,并在格式化时将内容放置在 \n{{content}} 的位置上。

  • format_assistant=StringFormatter(slots=[“\n{{content}}”])

    • format_assistant 是用来格式化助理(assistant)输出的内容的格式器。
    • 同样利用了 StringFormatter,并指定了相同的插槽 ["\n{{content}}"]。

  • format_system=StringFormatter(slots=[“\n{{content}}”])

    • format_system 是用来格式化系统(system)输出的内容的格式器。
    • 同样利用了 StringFormatter,并指定了相同的插槽 ["\n{{content}}"]。

  • format_function=FunctionFormatter(slots=[“{{name}}\n{{arguments}}”])

    • format_function 是用来格式化函数(function)界说的格式器。
    • FunctionFormatter(slots=["{{name}}\n{{arguments}}"]) 表现格式化时会利用 {{name}} 和 {{arguments}} 插槽,用于表现函数名称和参数。

  • format_observation=StringFormatter(slots=[“\n{{content}}”])

    • format_observation 是用来格式化观察(observation)输出的内容的格式器。
    • 同样利用了 StringFormatter,并指定了相同的插槽 ["\n{{content}}"]。

  • format_tools=ToolFormatter(tool_format=“glm4”)

    • format_tools 是用来格式化工具(tools)的格式器。
    • ToolFormatter(tool_format="glm4") 表现工具格式化器将利用 "glm4" 格式。

  • format_prefix=EmptyFormatter(slots=[“[gMASK]”])

    • format_prefix 是用来格式化前缀(prefix)的格式器。
    • EmptyFormatter(slots=["[gMASK]<sop>"]) 表现前缀格式化器将输出 "[gMASK]<sop>"。

  • stop_words=[“”, “”]

    • stop_words 是停用词列表,但在这里给出的示例中,停用词列表为空,即 ["", ""]。

  • efficient_eos=True

    • efficient_eos 是一个布尔值参数,表现是否启用高效的EOS(End of Sentence)处置惩罚。在这里设置为 True,可能意味着系统会优化处置惩罚句子结束的方式。

这段代码的主要作用是界说了一个名为 "glm4" 的模板,包括了各种用于格式化用户输入、助理输出、系统输出、函数界说、观察输出、工具、前缀等内容的格式化器和设置。这种模板的界说通常用于在特定的系统或框架中,为差异范例的输入和输出提供统一的格式化和处置惩罚规则,以便于后续的处置惩罚和展示。
  1. _register_template(
  2.     name="qwen",
  3.     format_user=StringFormatter(slots=["<|im_start|>user\n{{content}}<|im_end|>\n<|im_start|>assistant\n"]),
  4.     format_system=StringFormatter(slots=["<|im_start|>system\n{{content}}<|im_end|>\n"]),
  5.     format_observation=StringFormatter(slots=["<|im_start|>tool\n{{content}}<|im_end|>\n<|im_start|>assistant\n"]),
  6.     format_separator=EmptyFormatter(slots=["\n"]),
  7.     default_system="You are a helpful assistant.",
  8.     stop_words=["<|im_end|>"],
  9.     replace_eos=True,
  10. )
复制代码
目前看全部的qwen模型在llama factory中都用这一套模版。
从最简化的角度来看目前我在三个阶段分别用到的数据结构
预练习数据结构
  1. {"text":""}
复制代码
对应的data_info.json中需要加入以下设置
  1. "pre_dataset_name": {
  2.   "file_name": "预训练数据文件在data目录下的地址",
  3.   "columns": {
  4.     "prompt": "text"
  5.   }
  6. }
复制代码
微调练习数据结构
  1. {"input_colum": "根据:TWY:滑行道;BTN:在……之间;TWY:滑行道;AND:与;TWY:滑行道;AVBL:可供使用;FOR:为了;OPS.:作业、运行、经营、操作、运转;DRG:在……期间;FLW:如下,以下;TWY:滑行道;FOR:为了;ACFT:航空器;ACFT:航空器;IN:在;APN:停机坪;FOR:为了;ACFT:航空器;ONLY.:只能;AND:与;ACFT:航空器;ON:在;RWY:跑道,逐词翻译:PORTIONOFTWYMBTNTWYLINK31ANDTWYLINK32NOTAVBLFOROPS.\nDRGTHISPERIODFLWRESTRICTIONSSHALLAPPLY:\n1.COMPATIBILITYOFTWYKRESTRICTEDFORACFTUPTOWINGSPAN68.40M.\n2.ACFTSTAND265INCARGOAPNDOWNGRADEDFORACFTUPTOWINGSPAN68.40MONLY.\n3.MOVEMENTOFA388ANDAN124ACFTONRWY10/28NOTPERMITED.","output_colum": "<部分:PORTION:0> <的:OF:1> <滑行道:TWY:2> <M:M:3> <在:BTN:4.1> <之间:BTN:4.2> <滑行道:TWY:5> <连接:LINK:6> <31:31:7> <与:AND:8> <滑行道:TWY:9> <连接:LINK:10> <32:32:11> <不可用:NOT AVBL:12> <因为:FOR:13> <运行:OPS:14> <.:.:15> <在……期间:DRG:16> <这个:THIS:17> <时期:PERIOD:18> <如下,以下:FLW:19> <限制:RESTRICTIONS:20> <应该:SHALL:21> <适用:APPLY:22> <::::23> <1:1:24> <.:.:25> <兼容:COMPATIBILITY:26> <的:OF:27> <滑行道:TWY:28> <K:K:29> <被限制:RESTRICTED:30> <对于:FOR:31> <航空器:ACFT:32> <到:UPTO:33> <翼展:WINGSPAN:34> <68.40M:68.40M:35> <.:.:36> <2:2:37> <.:.:38> <航空器:ACFT:39> <停在:STAND:40> <265:265:41> <在:IN:42> <货物:CARGO:43> <停机坪:APN:44> <降级:DOWNGRADED:45> <对于:FOR:46> <航空器的:ACFT:47> <到:UPTO:48> <翼展:WING SPAN:49> <68.40M:68.40M:50> <只能:ONLY:51> <.:.:52> <3:3:53> <.:.:54> <移动:MOVEMENT:55> <的:OF:56> <A388:A388:57> <与:AND:58> <AN124:AN124:59> <航空器:ACFT:60> <在:ON:61> <跑道:RWY:62> <10/28:10/28:63> <不:NOT:64> <被允许:PERMITED:65> <.:.:66> "}
复制代码
对应的datainfo中的内容为
  1. "sft_dataset_name": {
  2.   "file_name": "微调数据文件在data目录下的地址",
  3.   "columns": {
  4.     "query": "input_colum",
  5.     "response": "output_colum",
  6.   }
  7. }
复制代码
因为数据量比较大以是利用jsonl,在数据量大的环境下json文件会导致模型报错。
相对于老版本的llamafactory来说新版的加入了多线程分词本领。如许预处置惩罚的过程会更快。
处置惩罚好数据以后我们开始处置惩罚练习命令。这里注意细节,我们的预练习数据叫做pre_dataset_name,微调数据叫做sft_dataset_name。目前我地点的环境是国内。以是这里我们需要一条指令让模型下载通过魔搭社区举行下载。
  1. export USE_MODELSCOPE_HUB=1 # Windows 使用 `set USE_MODELSCOPE_HUB=1`
复制代码
在设置modelscope以后要记得安装modelscope
  1. pip install modelscope -U
复制代码
这里我们用了一种比较落伍的方式实用华为的npu。利用torch-npu模块来举行npu的利用。
在练习之前我们先介绍一下llama factory支持的几种练习模式
LlamaFactory 支持的练习模式的解释:
1、dpo 强化练习 - Data Parallel Optimization 的缩写,数据并行优化。这种方法涉及在多个设备上并行练习模型,每个设备处置惩罚差异的数据批次,以提高练习效率和速度。
2、kto 强化练习 - Knowledge Transfer Optimization 的缩写,知识迁徙优化。这通常涉及将预练习模型的知识迁徙到新的模型上,以改善新模型的性能。
3、ppo 强化练习 - Probabilistic Policy Optimization 的缩写,概率策略优化。这是一种强化学习算法,用于优化策略的期望回报,通常用于练习署理在给定环境中实行特定任务。
4、pt 预练习 - Pre-training 的缩写,预练习。这是在大规模数据集上练习模型的过程,以便模型能够学习通用的语言表现,这些表现可以在各种下游任务中举行微调。
5、rm 强化反馈练习 - 这可能是一种利用强化学习技术的练习方法,此中模型根据收到的反馈(奖励或惩罚)来调整其行为。
6、sft 微调练习 - Supervised Fine-Tuning 的缩写,监视式微调。这是在特定任务上利用标注数据对预练习模型举行微调的过程,以提高模型在该任务上的性能。
第一步我们设置预练习练习的设置文件这里我保举利用glm4
  1. ### model
  2. model_name_or_path: ZhipuAI/glm-4-9b
  3. ### method
  4. stage: pt
  5. do_train: true
  6. finetuning_type: full
  7. deepspeed: examples/deepspeed/ds_z3_config.json
  8. ### dataset
  9. dataset: pre_dataset_name
  10. template: glm4
  11. cutoff_len: 4096
  12. max_samples: 1000
  13. overwrite_cache: true
  14. preprocessing_num_workers: 16
  15. ### output
  16. output_dir: saves/glm-4-9b/full/pt
  17. logging_steps: 10
  18. save_steps: 500
  19. plot_loss: true
  20. overwrite_output_dir: true
  21. ### train
  22. per_device_train_batch_size: 1
  23. gradient_accumulation_steps: 2
  24. learning_rate: 1.0e-4
  25. num_train_epochs: 3.0
  26. lr_scheduler_type: cosine
  27. warmup_ratio: 0.1
  28. fp16: true
  29. ddp_timeout: 180000000
  30. ### eval
  31. val_size: 0.1
  32. per_device_eval_batch_size: 1
  33. eval_strategy: steps
  34. eval_steps: 500
复制代码
这里我们指定了练习模式是pt也就是预练习,在openi平台最高可以选择4卡910显卡举行练习。也就是4*32G显存。这是充足举行预练习的。
假如需要更好的预练习结果可以通过调节以下几个参数来实现。
  1. ### train
  2. per_device_train_batch_size: 1
  3. gradient_accumulation_steps: 2
  4. learning_rate: 1.0e-4
  5. num_train_epochs: 3.0
  6. lr_scheduler_type: cosine
  7. warmup_ratio: 0.1
复制代码
这一部分的设置文件详细描述了练习过程的具体参数:
train



  • per_device_train_batch_size: 这个参数指定了每个练习设备(比方,GPU或TPU)上的批量巨细。在这里,它被设置为1,这意味着每个设备在每个练习步骤中处置惩罚一个样本。较小的批量巨细可以减少内存需求,但可能需要更多的练习步骤来达到收敛。
  • gradient_accumulation_steps: 这个参数界说了在实行权重更新之前累积梯度的步骤数。在这里,它被设置为2,意味着模型将在累积了两步的梯度之后才举行权重更新。这种方法可以在不增加内存利用的环境下模拟更大的批量巨细。
  • learning_rate: 学习率是决定模型参数更新速度的关键因素。在这里,它被设置为1.0e-4(即0.0001),这是一个常见的初始学习率值。学习率的选择对模型练习至关紧张,过高的学习率可能导致练习不稳定,而过低的学习率可能导致练习过程迟钝。
  • num_train_epochs: 这个参数指定了模型将在练习数据上运行的完备次数。在这里,它被设置为3.0,意味着模型将看到整个练习数据集三次。增加练习轮数可以提高模型的性能,但也可能导致过拟合。
  • lr_scheduler_type: 学习率调度器用于在练习过程中动态调整学习率。在这里,它被设置为“cosine”,这意味着学习率将按照余弦函数的规律变革。余弦调度器通常在练习开始时保持较高的学习率,并在练习过程中徐徐降低。
  • warmup_ratio: 这个参数界说了学习率热身期间的比例。在这里,它被设置为0.1,这意味着在练习的前10%时间内,学习率将从0徐徐增加到初始学习率。热身阶段有助于在练习初期稳定模型的学习。
    这些参数共同决定了模型练习的效率和质量。调整这些参数可以资助优化模型的性能,同时确保练习过程的有效性和稳定性。
    我们开始安装在npu中的llama factory练习框架
    第一步安装npu版本的llama factory
  1. pip install -e '.[torch-npu,metrics]'
复制代码
第二步安装npu环境
  1. # 请替换 URL 为 CANN 版本和设备型号对应的 URL
  2. # 安装 CANN Toolkit
  3. wget https://ascend-repo.obs.cn-east-2.myhuaweicloud.com/Milan-ASL/Milan-ASL%20V100R001C17SPC701/Ascend-cann-toolkit_8.0.RC1.alpha001_linux-"$(uname -i)".run
  4. bash Ascend-cann-toolkit_8.0.RC1.alpha001_linux-"$(uname -i)".run --install
  5. # 安装 CANN Kernels
  6. wget https://ascend-repo.obs.cn-east-2.myhuaweicloud.com/Milan-ASL/Milan-ASL%20V100R001C17SPC701/Ascend-cann-kernels-910b_8.0.RC1.alpha001_linux.run
  7. bash Ascend-cann-kernels-910b_8.0.RC1.alpha001_linux.run --install
  8. # 设置环境变量
  9. source /usr/local/Ascend/ascend-toolkit/set_env.sh
复制代码
第三步在我安装的时候遇到了一个小bug,因为没有云平台的root权限,以是这里我才用了conda举行环境安装。
  1. conda install -c conda-forge libsndfile
复制代码
另有一个提升性能的库
  1. conda install conda-forge::libaio
复制代码
单机多卡环境下利用deepspeed zero3会带来相对原生的单机多卡更高的盘算效率。
第四步安装deepspeed。
  1. pip install deepspeed
复制代码
接下来我们运行命令开始举行练习
  1. llamafactory-cli train LLaMA-Factory/examples/train_full/glm4_full_pt_ds3.yaml
复制代码
成功练习的日志的样子
  1. [2024-07-09 09:10:46,149] [INFO] [real_accelerator.py:203:get_accelerator] Setting ds_accelerator to npu (auto detect)
  2. [WARNING]  async_io requires the dev libaio .so object and headers but these were not found.
  3. [WARNING]  async_io: please install the libaio-devel package with yum
  4. [WARNING]  If libaio is already installed (perhaps from source), try setting the CFLAGS and LDFLAGS environment variables to where it can be found.
  5. 07/09/2024 09:11:02 - INFO - llamafactory.hparams.parser - Process rank: 0, device: npu:0, n_gpu: 1, distributed training: False, compute dtype: torch.float16
  6. Downloading: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1.35k/1.35k [00:00<00:00, 4.44kB/s]
  7. Downloading: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 36.0/36.0 [00:00<00:00, 86.4B/s]
  8. Downloading: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 2.21k/2.21k [00:00<00:00, 5.46kB/s]
  9. Downloading: 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 205/205 [00:00<00:00, 451B/s]
  10. Downloading: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 6.34k/6.34k [00:00<00:00, 19.5kB/s]
  11. Downloading: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1.81G/1.81G [01:23<00:00, 23.2MB/s]
  12. Downloading: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1.69G/1.69G [01:36<00:00, 18.8MB/s]
  13. Downloading: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1.69G/1.69G [01:36<00:00, 18.8MB/s]
  14. Downloading: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1.83G/1.83G [01:18<00:00, 25.1MB/s]
  15. Downloading: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1.80G/1.80G [01:19<00:00, 24.1MB/s]
  16. Downloading: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1.69G/1.69G [01:15<00:00, 24.0MB/s]
  17. Downloading: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1.83G/1.83G [01:22<00:00, 24.0MB/s]
  18. Downloading: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1.80G/1.80G [01:12<00:00, 26.4MB/s]
  19. Downloading: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1.69G/1.69G [01:03<00:00, 28.6MB/s]
  20. Downloading: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1.83G/1.83G [01:10<00:00, 27.8MB/s]
  21. Downloading: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1.54G/1.54G [01:00<00:00, 27.1MB/s]
  22. Downloading: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 28.4k/28.4k [00:00<00:00, 65.7kB/s]
  23. Downloading: 100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 57.1k/57.1k [00:00<00:00, 100kB/s]
  24. Downloading: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 3.34k/3.34k [00:00<00:00, 11.8kB/s]
  25. Downloading: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 3.78k/3.78k [00:00<00:00, 12.2kB/s]
  26. Downloading: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 15.3k/15.3k [00:00<00:00, 28.9kB/s]
  27. Downloading: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 2.50M/2.50M [00:00<00:00, 3.07MB/s]
  28. Downloading: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 3.12k/3.12k [00:00<00:00, 9.51kB/s]
  29. [INFO|tokenization_utils_base.py:2159] 2024-07-09 09:24:48,669 >> loading file tokenizer.model
  30. [INFO|tokenization_utils_base.py:2159] 2024-07-09 09:24:48,669 >> loading file added_tokens.json
  31. [INFO|tokenization_utils_base.py:2159] 2024-07-09 09:24:48,669 >> loading file special_tokens_map.json
  32. [INFO|tokenization_utils_base.py:2159] 2024-07-09 09:24:48,669 >> loading file tokenizer_config.json
  33. [INFO|tokenization_utils_base.py:2159] 2024-07-09 09:24:48,669 >> loading file tokenizer.json
  34. [WARNING|logging.py:313] 2024-07-09 09:24:49,392 >> Special tokens have been added in the vocabulary, make sure the associated word embeddings are fine-tuned or trained.
  35. 07/09/2024 09:24:49 - INFO - llamafactory.data.template - Add <|user|>,<|observation|> to stop words.
  36. 07/09/2024 09:24:49 - INFO - llamafactory.data.loader - Loading dataset identity.json...
  37. Generating train split: 91 examples [00:00, 1770.27 examples/s]
  38. Converting format of dataset (num_proc=16): 100%|████████████████████████████████████████████████████████████████████████████████████████████████| 91/91 [00:00<00:00, 187.32 examples/s]
  39. 07/09/2024 09:25:01 - INFO - llamafactory.data.loader - Loading dataset alpaca_en_demo.json...
  40. Generating train split: 1000 examples [00:00, 19614.77 examples/s]
  41. Converting format of dataset (num_proc=16): 100%|███████████████████████████████████████████████████████████████████████████████████████████| 1000/1000 [00:00<00:00, 2385.01 examples/s]
  42. Running tokenizer on dataset (num_proc=16): 100%|█████████████████████████████████████████████████████████████████████████████████████████████| 1091/1091 [00:43<00:00, 24.98 examples/s]
  43. input_ids:
  44. [151331, 151333, 151336, 198, 6023, 151337, 198, 9703, 0, 358, 1079, 5867, 606, 37953, 458, 15223, 17821, 7881, 553, 5867, 3094, 3417, 13, 2585, 646, 358, 7789, 498, 3351, 30, 151329]
  45. inputs:
  46. [gMASK] <sop> <|user|>
  47. hi <|assistant|>
  48. Hello! I am {{name}}, an AI assistant developed by {{author}}. How can I assist you today? <|endoftext|>
  49. label_ids:
  50. [-100, -100, -100, -100, -100, -100, 198, 9703, 0, 358, 1079, 5867, 606, 37953, 458, 15223, 17821, 7881, 553, 5867, 3094, 3417, 13, 2585, 646, 358, 7789, 498, 3351, 30, 151329]
  51. labels:
  52. Hello! I am {{name}}, an AI assistant developed by {{author}}. How can I assist you today? <|endoftext|>
  53. [INFO|configuration_utils.py:731] 2024-07-09 09:26:01,831 >> loading configuration file /root/.cache/modelscope/hub/ZhipuAI/glm-4-9b/config.json
  54. [INFO|configuration_utils.py:731] 2024-07-09 09:26:01,844 >> loading configuration file /root/.cache/modelscope/hub/ZhipuAI/glm-4-9b/config.json
  55. [INFO|configuration_utils.py:800] 2024-07-09 09:26:01,846 >> Model config ChatGLMConfig {
  56.   "_name_or_path": "/root/.cache/modelscope/hub/ZhipuAI/glm-4-9b",
  57.   "add_bias_linear": false,
  58.   "add_qkv_bias": true,
  59.   "apply_query_key_layer_scaling": true,
  60.   "apply_residual_connection_post_layernorm": false,
  61.   "architectures": [
  62.     "ChatGLMModel"
  63.   ],
  64.   "attention_dropout": 0.0,
  65.   "attention_softmax_in_fp32": true,
  66.   "auto_map": {
  67.     "AutoConfig": "configuration_chatglm.ChatGLMConfig",
  68.     "AutoModel": "modeling_chatglm.ChatGLMForConditionalGeneration",
  69.     "AutoModelForCausalLM": "modeling_chatglm.ChatGLMForConditionalGeneration",
  70.     "AutoModelForSeq2SeqLM": "modeling_chatglm.ChatGLMForConditionalGeneration",
  71.     "AutoModelForSequenceClassification": "modeling_chatglm.ChatGLMForSequenceClassification"
  72.   },
  73.   "bias_dropout_fusion": true,
  74.   "classifier_dropout": null,
  75.   "eos_token_id": [
  76.     151329,
  77.     151336,
  78.     151338
  79.   ],
  80.   "ffn_hidden_size": 13696,
  81.   "fp32_residual_connection": false,
  82.   "hidden_dropout": 0.0,
  83.   "hidden_size": 4096,
  84.   "kv_channels": 128,
  85.   "layernorm_epsilon": 1.5625e-07,
  86.   "model_type": "chatglm",
  87.   "multi_query_attention": true,
  88.   "multi_query_group_num": 2,
  89.   "num_attention_heads": 32,
  90.   "num_layers": 40,
  91.   "original_rope": true,
  92.   "pad_token_id": 151329,
  93.   "padded_vocab_size": 151552,
  94.   "post_layer_norm": true,
  95.   "rmsnorm": true,
  96.   "rope_ratio": 1,
  97.   "seq_length": 8192,
  98.   "tie_word_embeddings": false,
  99.   "torch_dtype": "bfloat16",
  100.   "transformers_version": "4.42.3",
  101.   "use_cache": true,
  102.   "vocab_size": 151552
  103. }
  104. [INFO|modeling_utils.py:3553] 2024-07-09 09:26:01,975 >> loading weights file /root/.cache/modelscope/hub/ZhipuAI/glm-4-9b/model.safetensors.index.json
  105. [INFO|modeling_utils.py:3698] 2024-07-09 09:26:01,976 >> Detected DeepSpeed ZeRO-3: activating zero.init() for this model
  106. [2024-07-09 09:26:01,979] [INFO] [comm.py:637:init_distributed] cdb=None
  107. [2024-07-09 09:26:01,979] [INFO] [comm.py:652:init_distributed] Not using the DeepSpeed or dist launchers, attempting to detect MPI environment...
复制代码
日志解读
根据你提供的日志信息,这是一个涉及呆板学习模型练习的过程。我会渐渐解释每个部分的寄义和可能的影响:

  • INFO 和 WARNING 日志

    • Setting ds_accelerator to npu (auto detect):指示程序将利用NPU(神经处置惩罚单元)加快器,系统自动检测到这一设置。
    • async_io requires the dev libaio .so object and headers but these were not found.:警告提示缺少 libaio 库,这可能影响异步IO的性能。
    • If libaio is already installed (perhaps from source), try setting the CFLAGS and LDFLAGS environment variables to where it can be found.:建议假如已经安装了 libaio,可以实验设置 CFLAGS 和 LDFLAGS 环境变量来正确定位该库。

  • 下载和处置惩罚数据集

    • 大量的 Downloading 和 Converting format of dataset 行指示正在下载和转换数据集,这是模型练习过程中常见的操作。

  • 模型设置和加载

    • 模型设置信息表现了模型的参数设置,如层数、隐藏单元巨细等。
    • loading weights file /root/.cache/modelscope/hub/ZhipuAI/glm-4-9b/model.safetensors.index.json 表现正在加载模型的权重文件。
    • Detected DeepSpeed ZeRO-3: activating zero.init() for this model 表现检测到利用了 DeepSpeed ZeRO-3 技术,这是一种优化模型练习内存利用和效率的方法。

  • MPI 环境检测

    • Not using the DeepSpeed or dist launchers, attempting to detect MPI environment... 检测到不是利用 DeepSpeed 或分布式启动器,正在实验检测 MPI 环境。

综上所述,日志记录了一个利用 NPU 加快器的呆板学习模型练习过程,涉及数据集下载、模型加载和设置,以及一些系统环境的警告和优化建议。
这里报了个错误。mpi环境失败手动安装mpi环境
  1. conda install -c conda-forge mpi4py openmpi
复制代码
安装的时候返回了一段日志。对这段日志举行解读。
  1. On Linux, Open MPI is built with UCX support but it is disabled by default.                                                                                                              
  2. To enable it, first install UCX (conda install -c conda-forge ucx).                                                                                                                     
  3. Afterwards, set the environment variables                                                                                                                                                
  4. OMPI_MCA_pml=ucx OMPI_MCA_osc=ucx                                                                                                                                                        
  5. before launching your MPI processes.                                                                                                                                                     
  6. Equivalently, you can set the MCA parameters in the command line:
  7. mpiexec --mca pml ucx --mca osc ucx ...
  8. On Linux, Open MPI is built with CUDA awareness but it is disabled by default.
  9. To enable it, please set the environment variable
  10. OMPI_MCA_opal_cuda_support=true
  11. before launching your MPI processes.
  12. Equivalently, you can set the MCA parameter in the command line:
  13. mpiexec --mca opal_cuda_support 1 ...
  14. Note that you might also need to set UCX_MEMTYPE_CACHE=n for CUDA awareness via
  15. UCX. Please consult UCX documentation for further details.
  16. done
复制代码
这段日志是在告知如何在Linux系统中启用Open MPI的UCX(Unified Communication X)支持和CUDA(Compute Unified Device Architecture)意识支持。UCX是一个高性能通信库,用于支持差异通信机制(如InfiniBand, RoCE, TCP/IP等),而CUDA是由NVIDIA开发的并行盘算平台和编程模型。
以下是日志的解读:

  • 启用UCX支持

    • Open MPI在Linux上编译时包含了UCX支持,但默认是禁用的。
    • 要启用UCX支持,起首需要安装UCX。可以通过conda包管理器安装,命令是 conda install -c conda-forge ucx。
    • 安装UCX后,在启动MPI进程之前,需要设置环境变量 OMPI_MCA_pml=ucx 和 OMPI_MCA_osc=ucx。
    • 或者,可以在命令行中设置MCA参数,利用命令 mpiexec --mca pml ucx --mca osc ucx ...。

  • 启用CUDA意识支持

    • Open MPI在Linux上编译时也包含了CUDA意识支持,但默认也是禁用的。
    • 要启用CUDA意识支持,需要设置环境变量 OMPI_MCA_opal_cuda_support=true。
    • 同样,可以在命令行中设置MCA参数,利用命令 mpiexec --mca opal_cuda_support 1 ...。
    • 假如要通过UCX启用CUDA意识支持,可能还需要设置 UCX_MEMTYPE_CACHE=n。具体细节可以查阅UCX的文档。

本来早点结束 。嘿嘿又爆出了新的问题。
  1. Traceback (most recent call last):
  2.   File "/home/ma-user/anaconda3/envs/MindSpore/bin/llamafactory-cli", line 8, in <module>
  3.     sys.exit(main())
  4.   File "/tmp/code/LLaMA-Factory/src/llamafactory/cli.py", line 110, in main
  5.     run_exp()
  6.   File "/tmp/code/LLaMA-Factory/src/llamafactory/train/tuner.py", line 47, in run_exp
  7.     run_sft(model_args, data_args, training_args, finetuning_args, generating_args, callbacks)
  8.   File "/tmp/code/LLaMA-Factory/src/llamafactory/train/sft/workflow.py", line 49, in run_sft
  9.     model = load_model(tokenizer, model_args, finetuning_args, training_args.do_train)
  10.   File "/tmp/code/LLaMA-Factory/src/llamafactory/model/loader.py", line 151, in load_model
  11.     model = AutoModelForCausalLM.from_pretrained(**init_kwargs)
  12.   File "/home/ma-user/anaconda3/envs/MindSpore/lib/python3.9/site-packages/transformers/models/auto/auto_factory.py", line 559, in from_pretrained
  13.     return model_class.from_pretrained(
  14.   File "/home/ma-user/anaconda3/envs/MindSpore/lib/python3.9/site-packages/transformers/modeling_utils.py", line 3710, in from_pretrained
  15.     model = cls(config, *model_args, **model_kwargs)
  16.   File "/home/ma-user/anaconda3/envs/MindSpore/lib/python3.9/site-packages/deepspeed/runtime/zero/partition_parameters.py", line 506, in wrapper
  17.     f(module, *args, **kwargs)
  18.   File "/root/.cache/huggingface/modules/transformers_modules/glm-4-9b/modeling_chatglm.py", line 928, in __init__
  19.     self.transformer = ChatGLMModel(config, empty_init=empty_init, device=device)
  20.   File "/home/ma-user/anaconda3/envs/MindSpore/lib/python3.9/site-packages/deepspeed/runtime/zero/partition_parameters.py", line 506, in wrapper
  21.     f(module, *args, **kwargs)
  22.   File "/root/.cache/huggingface/modules/transformers_modules/glm-4-9b/modeling_chatglm.py", line 852, in __init__
  23.     self.rotary_pos_emb = RotaryEmbedding(rotary_dim // 2, rope_ratio=config.rope_ratio,
  24.   File "/home/ma-user/anaconda3/envs/MindSpore/lib/python3.9/site-packages/deepspeed/runtime/zero/partition_parameters.py", line 506, in wrapper
  25.     f(module, *args, **kwargs)
  26.   File "/root/.cache/huggingface/modules/transformers_modules/glm-4-9b/modeling_chatglm.py", line 96, in __init__
  27.     inv_freq = 1.0 / (10000 ** (torch.arange(0, dim, 2, device=device).to(dtype=dtype) / dim))
  28. RuntimeError: call aclnnCast failed, detail:EZ1001: 2024-07-09-09:38:52.309.843 The param dtype not implemented for DT_BFLOAT16, should be in dtype support list [DT_FLOAT16,DT_FLOAT,DT_DOUBLE,DT_INT8,DT_UINT8,DT_INT16,DT_INT32,DT_INT64,DT_UINT16,DT_UINT32,DT_UINT64,DT_BOOL,DT_COMPLEX64,DT_COMPLEX128,].
  29. [ERROR] 2024-07-09-09:38:52 (PID:17196, Device:0, RankID:0) ERR01005 OPS internal error
复制代码
先解读一下非常。
这段日志是Python程序运行时出现的错误堆栈,具体是利用DeepSpeed库(一种用于深度学习练习的库)在MindSpore(一种深度学习框架)上运行时遇到的。错误信息表明在实行模型初始化时出现了运行时错误,导致无法创建模型。
错误信息表现在实验创建模型的某些组件时,由于某种缘故原由,无法将参数的数据范例转换为DeepSpeed支持的范例。具体来说,问题出如今创建RotaryEmbedding对象时,这个对象需要一个rotary_dim参数,但是在转换过程中遇到了问题。
错误堆栈的详细部分如下:

  • RuntimeError: call aclnnCast failed, detail:EZ1001: 2024-07-09-09:38:52.309.843 The param dtype not implemented for DT_BFLOAT16, should be in dtype support list [DT_FLOAT16,DT_FLOAT,DT_DOUBLE,DT_INT8,DT_UINT8,DT_INT16,DT_INT32,DT_INT64,DT_UINT16,DT_UINT32,DT_UINT64,DT_BOOL,DT_COMPLEX64,DT_COMPLEX128,].
    这段信息表明,在实验将数据范例从DT_BFLOAT16转换为DeepSpeed支持的范例时失败了。DT_BFLOAT16不在DeepSpeed支持的范例列表中,以是转换失败。
  • [ERROR] 2024-07-09-09:38:52 (PID:17196, Device:0, RankID:0) ERR01005 OPS internal error
    这表明DeepSpeed内部的某个操作(可能是模型初始化的一部分)遇到了内部错误。
    解决这个问题的方法可能包括:


  • 查抄模型的设置,确保rotary_dim参数的数据范例是DeepSpeed支持的范例之一。
  • 假如rotary_dim参数的值不是DeepSpeed支持的范例,实验将值转换为支持的范例。
  • 查抄DeepSpeed的文档,相识如何设置或调整以支持DT_BFLOAT16范例。
  • 联系DeepSpeed或MindSpore的支持团队,寻求资助解决这个特定问题。
    由于这涉及到具体的代码和库设置,最直接的方法是联系项目的开发者或社区,他们可能提供更具体的解决方案或工作around。
哎嘿 910 盘算芯片版本 不支持 DT_BFLOAT16。以是我们要改deepspeed的设置文件。这时候最绝望的事情来了。写到末了发现一个无法逾越的问题。
  1. Traceback (most recent call last):
  2.   File "/home/ma-user/anaconda3/envs/MindSpore/bin/llamafactory-cli", line 8, in <module>
  3.     sys.exit(main())
  4.   File "/tmp/code/LLaMA-Factory/src/llamafactory/cli.py", line 110, in main
  5.     run_exp()
  6.   File "/tmp/code/LLaMA-Factory/src/llamafactory/train/tuner.py", line 47, in run_exp
  7.     run_sft(model_args, data_args, training_args, finetuning_args, generating_args, callbacks)
  8.   File "/tmp/code/LLaMA-Factory/src/llamafactory/train/sft/workflow.py", line 88, in run_sft
  9.     train_result = trainer.train(resume_from_checkpoint=training_args.resume_from_checkpoint)
  10.   File "/home/ma-user/anaconda3/envs/MindSpore/lib/python3.9/site-packages/transformers/trainer.py", line 1932, in train
  11.     return inner_training_loop(
  12.   File "/home/ma-user/anaconda3/envs/MindSpore/lib/python3.9/site-packages/transformers/trainer.py", line 2268, in _inner_training_loop
  13.     tr_loss_step = self.training_step(model, inputs)
  14.   File "/home/ma-user/anaconda3/envs/MindSpore/lib/python3.9/site-packages/transformers/trainer.py", line 3307, in training_step
  15.     loss = self.compute_loss(model, inputs)
  16.   File "/home/ma-user/anaconda3/envs/MindSpore/lib/python3.9/site-packages/transformers/trainer.py", line 3338, in compute_loss
  17.     outputs = model(**inputs)
  18.   File "/home/ma-user/anaconda3/envs/MindSpore/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1518, in _wrapped_call_impl
  19.     return self._call_impl(*args, **kwargs)
  20.   File "/home/ma-user/anaconda3/envs/MindSpore/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1527, in _call_impl
  21.     return forward_call(*args, **kwargs)
  22.   File "/home/ma-user/anaconda3/envs/MindSpore/lib/python3.9/site-packages/accelerate/utils/operations.py", line 819, in forward
  23.     return model_forward(*args, **kwargs)
  24.   File "/home/ma-user/anaconda3/envs/MindSpore/lib/python3.9/site-packages/accelerate/utils/operations.py", line 807, in __call__
  25.     return convert_to_fp32(self.model_forward(*args, **kwargs))
  26.   File "/home/ma-user/anaconda3/envs/MindSpore/lib/python3.9/site-packages/torch/amp/autocast_mode.py", line 16, in decorate_autocast
  27.     return func(*args, **kwargs)
  28.   File "/home/ma-user/anaconda3/envs/MindSpore/lib/python3.9/site-packages/transformers/models/qwen2/modeling_qwen2.py", line 1221, in forward
  29.     outputs = self.model(
  30.   File "/home/ma-user/anaconda3/envs/MindSpore/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1518, in _wrapped_call_impl
  31.     return self._call_impl(*args, **kwargs)
  32.   File "/home/ma-user/anaconda3/envs/MindSpore/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1527, in _call_impl
  33.     return forward_call(*args, **kwargs)
  34.   File "/home/ma-user/anaconda3/envs/MindSpore/lib/python3.9/site-packages/transformers/models/qwen2/modeling_qwen2.py", line 1012, in forward
  35.     layer_outputs = self._gradient_checkpointing_func(
  36.   File "/tmp/code/LLaMA-Factory/src/llamafactory/model/model_utils/checkpointing.py", line 65, in custom_gradient_checkpointing_func
  37.     return gradient_checkpointing_func(func, *args, **kwargs)
  38.   File "/home/ma-user/anaconda3/envs/MindSpore/lib/python3.9/site-packages/torch/_compile.py", line 24, in inner
  39.     return torch._dynamo.disable(fn, recursive)(*args, **kwargs)
  40.   File "/home/ma-user/anaconda3/envs/MindSpore/lib/python3.9/site-packages/torch/_dynamo/eval_frame.py", line 328, in _fn
  41.     return fn(*args, **kwargs)
  42.   File "/home/ma-user/anaconda3/envs/MindSpore/lib/python3.9/site-packages/torch/_dynamo/external_utils.py", line 17, in inner
  43.     return fn(*args, **kwargs)
  44.   File "/home/ma-user/anaconda3/envs/MindSpore/lib/python3.9/site-packages/torch/utils/checkpoint.py", line 451, in checkpoint
  45.     return CheckpointFunction.apply(function, preserve, *args)
  46.   File "/home/ma-user/anaconda3/envs/MindSpore/lib/python3.9/site-packages/torch/autograd/function.py", line 539, in apply
  47.     return super().apply(*args, **kwargs)  # type: ignore[misc]
  48.   File "/home/ma-user/anaconda3/envs/MindSpore/lib/python3.9/site-packages/torch/utils/checkpoint.py", line 230, in forward
  49.     outputs = run_function(*args)
  50.   File "/home/ma-user/anaconda3/envs/MindSpore/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1518, in _wrapped_call_impl
  51.     return self._call_impl(*args, **kwargs)
  52.   File "/home/ma-user/anaconda3/envs/MindSpore/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1527, in _call_impl
  53.     return forward_call(*args, **kwargs)
  54.   File "/home/ma-user/anaconda3/envs/MindSpore/lib/python3.9/site-packages/transformers/models/qwen2/modeling_qwen2.py", line 763, in forward
  55.     hidden_states, self_attn_weights, present_key_value = self.self_attn(
  56.   File "/home/ma-user/anaconda3/envs/MindSpore/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1518, in _wrapped_call_impl
  57.     return self._call_impl(*args, **kwargs)
  58.   File "/home/ma-user/anaconda3/envs/MindSpore/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1527, in _call_impl
  59.     return forward_call(*args, **kwargs)
  60.   File "/home/ma-user/anaconda3/envs/MindSpore/lib/python3.9/site-packages/transformers/models/qwen2/modeling_qwen2.py", line 257, in forward
  61.     query_states = self.q_proj(hidden_states)
  62.   File "/home/ma-user/anaconda3/envs/MindSpore/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1518, in _wrapped_call_impl
  63.     return self._call_impl(*args, **kwargs)
  64.   File "/home/ma-user/anaconda3/envs/MindSpore/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1527, in _call_impl
  65.     return forward_call(*args, **kwargs)
  66.   File "/home/ma-user/anaconda3/envs/MindSpore/lib/python3.9/site-packages/torch/nn/modules/linear.py", line 114, in forward
  67.     return F.linear(input, self.weight, self.bias)
  68.   File "/home/ma-user/anaconda3/envs/MindSpore/lib/python3.9/site-packages/deepspeed/runtime/zero/linear.py", line 111, in zero3_linear_wrap
  69.     return LinearFunctionForZeroStage3.apply(input, weight, bias)
  70.   File "/home/ma-user/anaconda3/envs/MindSpore/lib/python3.9/site-packages/torch/autograd/function.py", line 539, in apply
  71.     return super().apply(*args, **kwargs)  # type: ignore[misc]
  72.   File "/home/ma-user/anaconda3/envs/MindSpore/lib/python3.9/site-packages/torch_npu/npu/amp/autocast_mode.py", line 113, in decorate_fwd
  73.     return fwd(*args, **kwargs)
  74.   File "/home/ma-user/anaconda3/envs/MindSpore/lib/python3.9/site-packages/deepspeed/runtime/zero/linear.py", line 59, in forward
  75.     output += bias
  76. RuntimeError: call aclnnInplaceAdd failed, detail:EZ1001: 2024-07-09-10:40:00.116.800 the size of tensor selfRef [1,120] must match the size of tensor other [0].
  77.         TraceBack (most recent call last):
  78.         120 and 0 cannot broadcast.
  79.         the size of tensor selfRef [1,120] must match the size of tensor other [0].
  80. [ERROR] 2024-07-09-10:40:00 (PID:21727, Device:0, RankID:0) ERR01005 OPS internal error
复制代码
更换成qwen2-7B举行微调练习出现了tensor 不匹配的问题。对非常日志举行解读。
从日志来看,报错的缘故原由是发生了张量操作的维度不匹配。具体来说,错误信息 the size of tensor selfRef [1,120] must match the size of tensor other [0] 表现在举行 aclnnInplaceAdd 操作时,一个张量的维度是 [1,120],另一个张量的维度是 [0],导致无法举行广播操作。这通常是由于数据输入的外形或巨细设置不正确引起的。以下是详细的解读及可能的解决方案:
错误日志解读


  • 主函数调用
    1. sys.exit(main())
    复制代码
    程序从主函数 main 开始实行。
  • 实行实行
    1. run_exp()
    复制代码
    在 run_exp 函数中运行实行。
  • 运行 SFT(Supervised Fine-Tuning)
    1. run_sft(model_args, data_args, training_args, finetuning_args, generating_args, callbacks)
    复制代码
    在 run_sft 中举行模型的监视微调。
  • 练习模型
    1. train_result = trainer.train(resume_from_checkpoint=training_args.resume_from_checkpoint)
    复制代码
    在 trainer.train 中举行练习,并可能从查抄点恢复练习。
  • 练习步骤
    1. tr_loss_step = self.training_step(model, inputs)
    复制代码
    举行练习的单步操作 training_step。
  • 盘算丧失
    1. loss = self.compute_loss(model, inputs)
    复制代码
    盘算模型的丧失。
  • 模型前向流传
    1. outputs = model(**inputs)
    复制代码
    举行模型的前向流传。
  • 深度学习库内部调用
    这里涉及多个内部函数调用,最终在 aclnnInplaceAdd 时出错:
    1. RuntimeError: call aclnnInplaceAdd failed, detail:EZ1001: 2024-07-09-10:40:00.116.800 the size of tensor selfRef [1,120] must match the size of tensor other [0].
    复制代码
可能的解决方案


  • 查抄数据输入

    • 确保输入数据的外形和巨细正确。尤其是在数据预处置惩罚步骤中,确认数据没有丢失或者外形不匹配。

  • 模型设置查抄

    • 查抄模型的设置,尤其是线性层(如 self.q_proj)的输入输出维度是否与数据匹配。

  • 查抄自界说函数

    • 假如有自界说的梯度查抄点函数 custom_gradient_checkpointing_func,确保其实现正确,并且不会改变输入数据的外形。

  • 更新库和框架

    • 确保利用的库(如 transformers, torch, deepspeed 等)是最新版本,因为新版本可能包含错误修复和改进。

  • 调试信息

    • 在模型前向流传的关键步骤添加调试信息,打印张量的外形以便确定错误发生的位置和缘故原由。

具体到这个错误,可以起首查抄 self.q_proj 的输入 hidden_states 的外形,并在出错前打印相关张量的外形,确保其维度匹配。假如问题仍旧存在,建议进一步简化代码并渐渐调试,以确定确切的错误缘故原由。
接下来我们去撤消deepspeed设置项。
发生以下非常
  1. Traceback (most recent call last):  File "/home/ma-user/anaconda3/envs/MindSpore/bin/llamafactory-cli", line 8, in <module>    sys.exit(main())
  2.   File "/tmp/code/LLaMA-Factory/src/llamafactory/cli.py", line 110, in main    run_exp()
  3.   File "/tmp/code/LLaMA-Factory/src/llamafactory/train/tuner.py", line 47, in run_exp    run_sft(model_args, data_args, training_args, finetuning_args, generating_args, callbacks)
  4.   File "/tmp/code/LLaMA-Factory/src/llamafactory/train/sft/workflow.py", line 49, in run_sft    model = load_model(tokenizer, model_args, finetuning_args, training_args.do_train)  File "/tmp/code/LLaMA-Factory/src/llamafactory/model/loader.py", line 160, in load_model    model = init_adapter(config, model, model_args, finetuning_args, is_trainable)  File "/tmp/code/LLaMA-Factory/src/llamafactory/model/adapter.py", line 306, in init_adapter    _setup_full_tuning(model, model_args, finetuning_args, is_trainable, cast_trainable_params_to_fp32)  File "/tmp/code/LLaMA-Factory/src/llamafactory/model/adapter.py", line 59, in _setup_full_tuning    param.data = param.data.to(torch.float32)RuntimeError: NPU out of memory. Tried to allocate 2.03 GiB (NPU 0; 32.00 GiB total capacity; 29.19 GiB already allocated; 29.19 GiB current active; 412.09 MiB free; 30.43 GiB reserved in total by PyTorch) If reserved memory is >> allocated memory try setting max_split_size_mb to avoid fragmentation.
复制代码
到时间了 重新想办法 本日必须把这个代码跑通

免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。
回复

使用道具 举报

0 个回复

倒序浏览

快速回复

您需要登录后才可以回帖 登录 or 立即注册

本版积分规则

鼠扑

金牌会员
这个人很懒什么都没写!

标签云

快速回复 返回顶部 返回列表