Open gathierry opened 4 years ago
Same Problem @Lyken17
@xieydd @gathierry can u share the version of your torch and py-lmdb?
In my case, torch==1.4.0+cu92 and lmdb==0.98
I have similar problem. I have used 'ImageFolderLMDB' function in folder2lmdb.py and during iteration of dataloader, ram usage continuously increased. Problem may be caused by "txn.get(self.keys[index])", but i don't know how to fix it.
I did a simple test using imagenet dataset, however, I failed to observe any memory leakage
from folder2lmdb import ImageFolderLMDB
dst = ImageFolderLMDB(
"/ImageNet/train.lmdb",
transform=transforms.Compose([
transforms.CenterCrop(224),
transforms.ToTensor()
]))
train_loader = torch.utils.data.DataLoader(
dst, batch_size=64, num_workers=40, pin_memory=True)
for i, _ in enumerate(train_loader):
if i % 10 == 0:
print("[%d/%d]" % (i, len(train_loader)))
The memory usage showed in htop does not increase over time.
Though I notice there are some issues mentioning this https://github.com/pytorch/vision/issues/619, could you provide more detailed settings (e.g., a sample snippet that leads to memory leak)?
Maybe you need to remove the param max_readers=1
?
I tried without max_readers=1
but it doesn't change anything. Do you think it's because started the program with mp.spawn so that it's run in a multiprocess context?
Hi, I'm training faster-rcnn on 4 gpus with coco dataset converted to LMDB. I used num_worker=4 for the dataloader and I found that the memory occupation is almost 60Gb. I suspect that the whole dataset is read into memory. But per your description in readme,
LMDB shouldn't perform like this. Any thought about this? I can share part of my dataset code