starrytong / SCNet

MIT License
59 stars 5 forks source link

Training model with target source #4

Closed lyndonlauder closed 4 months ago

lyndonlauder commented 4 months ago

Hello thank you for releasing training and inference code.

In Demucs it is possible to train the model to target one source with the Weights arg (https://github.com/facebookresearch/demucs/blob/e976d93ecc3865e5757426930257e200846a520a/conf/config.yaml#L58)

Please can you tell me if this is possible with SCNet and how i can do this?

starrytong commented 4 months ago

Change config.yaml.

model:
  sources: ['vocals']

Change solver. py

            sources = sources.to(self.device)
            if train:
                sources = self.augment(sources)
                mix = sources.sum(dim=1)

                # data.sources: ['drums', 'bass', 'other', 'vocals']    ---vocal_idx=4
                sources = sources[:, idx-1:idx]
            else:
                mix = sources[:, 0]
                # sources = sources[:, 1:]

                sources = sources[:, idx:idx+1]  
lyndonlauder commented 4 months ago

@starrytong

I received this error after copy and pasting your code, i will try and debug because it might just be my PC.

  File "SCNet/scnet/solver.py", line 222, in _run_one_epoch
    assert estimate.shape == sources.shape, (estimate.shape, sources.shape)
AssertionError: (torch.Size([2, 1, 2, 44100]), torch.Size([2, 0, 2, 44100]))
starrytong commented 4 months ago

This is just a piece of pseudo code. “idx” has been used in the previous code,you need to redefine a variable.

lyndonlauder commented 4 months ago

unfortunately i do not know code so i cant do this.

but thank you for trying to help me.