Pin memory in Trainer by default (#9857)

Co-authored-by: Sylvain Gugger <35901082+sgugger@users.noreply.github.com>
Co-authored-by: Stas Bekman <stas00@users.noreply.github.com>
This commit is contained in:
abhishek thakur
2021-01-28 08:50:46 +01:00
committed by GitHub
parent 5ed5a54684
commit 25fcb5c171
2 changed files with 8 additions and 2 deletions

View File

@@ -242,8 +242,10 @@ class TrainingArguments:
:obj:`"comet_ml"`, :obj:`"mlflow"`, :obj:`"tensorboard"` and :obj:`"wandb"`.
ddp_find_unused_parameters (:obj:`bool`, `optional`):
When using distributed training, the value of the flag :obj:`find_unused_parameters` passed to
:obj:`DistributedDataParallel`. Will defaut to :obj:`False` if gradient checkpointing is used, :obj:`True`
:obj:`DistributedDataParallel`. Will default to :obj:`False` if gradient checkpointing is used, :obj:`True`
otherwise.
pin_memory (:obj:`bool`, `optional`, defaults to :obj:`True`)):
Whether you want to pin memory in data loaders or not. Will default to :obj:`True`.
"""
output_dir: str = field(
@@ -436,6 +438,7 @@ class TrainingArguments:
"`DistributedDataParallel`."
},
)
pin_memory: bool = field(default=True, metadata={"help": "Whether or not to pin memory for data loaders."})
_n_gpu: int = field(init=False, repr=False, default=-1)
def __post_init__(self):