Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IndexError: tuple index out of range #65

Open
8acemak1rkey opened this issue Feb 22, 2025 · 2 comments
Open

IndexError: tuple index out of range #65

8acemak1rkey opened this issue Feb 22, 2025 · 2 comments

Comments

@8acemak1rkey
Copy link

when i run the command
python train.py --name three_view_long_share_d0.75_256_s1_google --extra --views 3 --droprate 0.75 --share --stride 1 --h 256 --w 256 --fp16
everything is going on well until Epoch 0/119 starts.
Here is information in detail:

Defaults for this optimization level are:
enabled : True
opt_level : O1
cast_model_type : None
patch_torch_functions : True
keep_batchnorm_fp32 : None
master_weights : None
loss_scale : dynamic
Processing user overrides (additional kwargs that are not None)...
After processing overrides, optimization options are:
enabled : True
opt_level : O1
cast_model_type : None
patch_torch_functions : True
keep_batchnorm_fp32 : None
master_weights : None
loss_scale : dynamic
Epoch 0/119

Traceback (most recent call last):
File "train.py", line 529, in
model = train_model(model, model_test, criterion, optimizer_ft, exp_lr_scheduler,
File "train.py", line 272, in train_model
outputs, outputs2, outputs3, outputs4 = model(inputs, inputs2, inputs3, inputs4)
File "/home/qhc/anaconda3/envs/university/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1130, in _call_impl
return forward_call(*input, **kwargs)
File "/home/qhc/University1652-Baseline-master/University1652-Baseline-master/model.py", line 274, in forward
y2 = self.classifier(x2)
File "/home/qhc/anaconda3/envs/university/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1130, in _call_impl
return forward_call(*input, **kwargs)
File "/home/qhc/University1652-Baseline-master/University1652-Baseline-master/model.py", line 82, in forward
x = self.add_block(x)
File "/home/qhc/anaconda3/envs/university/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1130, in _call_impl
return forward_call(*input, **kwargs)
File "/home/qhc/anaconda3/envs/university/lib/python3.8/site-packages/torch/nn/modules/container.py", line 139, in forward
input = module(input)
File "/home/qhc/anaconda3/envs/university/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1130, in _call_impl
return forward_call(*input, **kwargs)
File "/home/qhc/anaconda3/envs/university/lib/python3.8/site-packages/torch/nn/modules/linear.py", line 114, in forward
return F.linear(input, self.weight, self.bias)
File "/home/qhc/anaconda3/envs/university/lib/python3.8/site-packages/apex-0.1-py3.8-linux-x86_64.egg/apex/amp/wrap.py", line 21, in wrapper
args[i] = utils.cached_cast(cast_fn, args[i], handle.cache)
File "/home/qhc/anaconda3/envs/university/lib/python3.8/site-packages/apex-0.1-py3.8-linux-x86_64.egg/apex/amp/utils.py", line 97, in cached_cast
if cached_x.grad_fn.next_functions[1][0].variable is not x:
IndexError: tuple index out of range
Thanks!!!

@layumi
Copy link
Owner

layumi commented Feb 24, 2025

Hi @8acemak1rkey

You are using apex? Do you install apex successfully?
Could you try the normal trainning without fp16?

@8acemak1rkey
Copy link
Author

Hi @8acemak1rkey

You are using apex? Do you install apex successfully? Could you try the normal trainning without fp16?
Thanks for your reply! Training without apex works. It is a problem with apex. By the way, my apex version is 0.1, I'd like to know yours . Thanks again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants