Skip to content

this follow merlin tts #1

Description

@forwiat

I also found the problem that memory leaks when using python list or python dict in torch.utils.data.Dataset, whenever num_workers > 0 or num_workers == 0 (I think num_workers == 0 just memory leaks slowly). I solved it when using numpy.array().

memory leak:

class traindataset(Dataset):
    def __init__(self):
          self.utt2fpath = {'utt1': './t1.wav', 'utt2': './t2.wav' ...}
          self.utts = list(self.utt2fpath.keys())
    def __getitem__(self, item):
          utt = self.utts[item]
          fpath = self.utt2fpath[utt]
          ...

without memory leak:

import numpy as np
class traindataset(Dataset):
    def __init__(self):
          self.utt2fpath = np.array([['utt1', './t1.wav'], ['utt2', './t2.wav'], ...])
    def __getitem__(self, item):
          utt = self.utt2fpath[item][0]
          fpath = self.utt2fpath[item][1]
          ...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions