Skip to content

Commit c63bfe9

Browse files
committed
fix: no pinning memory on CPU
1 parent 43504d3 commit c63bfe9

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

deepmd/pt/train/training.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ def get_dataloader_and_iter(_data, _params):
194194
else 0, # setting to 0 diverges the behavior of its iterator; should be >=1
195195
drop_last=False,
196196
collate_fn=lambda batch: batch, # prevent extra conversion
197-
pin_memory=True,
197+
pin_memory=(DEVICE != "cpu"), # pin memory only if not on CPU
198198
)
199199
_data_iter = cycle_iterator(_dataloader)
200200
return _dataloader, _data_iter

0 commit comments

Comments
 (0)