How to used custom dataset in Conv-TasNet

I created a music dataset including vocal and instrument, and I tried to use Conv-tasnet to sepatate the vocal and instrument. I have successfully used other people’s datasets for training first, but when I use my dataset to train, it keeps failing and I can’t find the problem. Here is the error and my datasets. Did I miss something?

1 Like

The code in your screenshots is quite hard to read, so please post code snippets by wrapping them into three backticks ```, as it’s easier to read/debug, and the search engine would be able to index it as well if other users hit similar issues.

Based on what I can see it seems that a local variable is references before its assignment, so you would need to check where its definition is.

Thank you for your reply. I am sorry that I forgot to give the complete code.

“i” is the index of “data”,and there is no other same variable outside the def.

If the data_loader is empty, i will be undefined:

def fun():
    for i in range(0):
        print('inside loop')
    return 1 / i

> UnboundLocalError: local variable 'i' referenced before assignment

PS: I would still recommend to post code snippets directly instead of screenshots.

Hi @userTsai, there is a training recipe of Conv-TasNet in torchaudio. You can follow the implementation here: audio/ at main · pytorch/audio · GitHub for your own dataset.