小编Mar*_*ien的帖子

使用 spacy v3 我应该在配置文件中更改哪个参数来解决 CUDA 内存不足问题?batch_size vs max_length vs batcher.size

使用 spacy v3,我尝试使用camemBert 训练分类器,但遇到了CUDA out of memory问题。为了解决这个问题,我读到应该减小批量大小,但我很困惑应该更改哪个参数:

  • [nlp] 批量大小
  • [components.transformer] max_batch_items
  • [corpora.train 或 dev] max_length
  • [训练.批处理程序] 大小
  • [trainning.batcher] 缓冲区

我试图理解每个参数之间的区别:

  1. [nlp] 批量大小

管道和评估的默认批量大小。默认为 1000。

培训/评估过程中是否使用了这些功能?
在快速启动小部件(https://spacy.io/usage/training#quickstart)中,为什么该值根据硬件而不同?CPU 为 1000,GPU 为 128。
训练过程中,这个值低的话评估会不会慢一些?

  1. [components.transformer] max_batch_items

填充批次的最大尺寸。默认为 4096。

根据警告消息:Token indices sequence length is longer than the specified maximum sequence length for this model (556 > 512). Running this sequence through the model will result in indexing errors此处解释(https://github.com/explosion/spaCy/issues/6939),Camembert模型指定的最大序列长度为 512。

参数 max_batch_item 是否重载到该值?我应该将该值更改为 512 吗?

  1. [corpora.train 或 …

machine-learning spacy-transformers huggingface-transformers spacy-3

5
推荐指数
1
解决办法
1579
查看次数