RuntimeError: Index -1 is out of bounds for dimension 1 with size 256 during inference with FarGAN
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 3.3k
- Forks
- 808
- PR merge metrics
- No merged PRs in 30d
Description
Description
Hello, I encountered an issue while testing the retrained FarGAN model after adding a new dataset to tts_speech_negative_16k.sw. Below are the steps I followed:
-
Data Dumping:
./dump_data -train ../../opus/dnn/torch/fargan/tts_speech_negative_16k.sw ../dump_feature/out_features.f32 ../dump_feature/out_speech.pcm -
Training:
python ./train_fargan.py ../dump_feature/out_features.f32 ../dump_feature/out_speech.pcm output_dir --epochs 400 --batch-size 2048 --lr 0.002 --cuda-visible-devices 0 -
Adversarial Training:
python adv_train_fargan.py ../dump_feature/out_features.f32 ../dump_feature/out_speech.pcm output_dir --lr 0.000002 --reg-weight 5 --batch-size 160 --cuda-visible-devices 0 --initial-checkpoint output_dir/checkpoints/fargan_400.pth -
Testing:
python test_fargan.py output_dir/checkpoints/fargan_adv_1.pth ../dump_feature/test_features.f32 output_speech.pcm
During Step 4 (testing), the following error occurred:
File "/home/fxw/SE/deep_enc_dec/fargan_enc_dec/train_fargan/fargan.py", line 255, in forward
pred = torch.gather(exc_mem, 1, idx)
RuntimeError: index -1 is out of bounds for dimension 1 with size 256
The issue arises because idx contains negative values (-1), which is invalid for indexing dimension 1 of a tensor with size 256.
Possible Causes and Questions
- Data Preprocessing: Could the new dataset introduced values that lead to invalid indices during inference?
- Model Compatibility: Does the model architecture or training process require adjustments when adding new data?
- Index Calculation: Is there a potential issue in the code logic that computes
idx(e.g., miscalculations or out-of-range values)?
Request for Help
I would appreciate any insights into why idx might contain negative values and I want to fix it, but I don't know why this is happening. Thank you!
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with fargan.py around line 255 and reproduce Step 4 using test_fargan.py and the checkpoint and feature files from the report. Trace where idx is calculated and compare it with the inference inputs and training data; done means identifying why -1 appears and confirming inference no longer fails with invalid indices.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, pytorch
- Domain
- audio-video-rtc, machine-learning
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100