tomgoldstein / loss-landscape

Code for visualizing the loss landscape of neural nets
MIT License
2.82k stars 397 forks source link

IndexError when plotting 2D plots #32

Open seanswyi opened 3 years ago

seanswyi commented 3 years ago

I currently downloaded the provided models and am running the command:

python plot_surface.py \
    --cuda \
    --model resnet56 \
    --x=-1:1:51 \
    --y=-1:1:51 \
    --model_file cifar10/trained_nets/resnet56_sgd_lr=0.1_bs=128_wd=0.0005/model_300.t7 \
    --dir_type weights \
    --xnorm filter \
    --xignore biasbn \
    --ynorm filter \
    --ignore biasbn \
    --plot

and am getting the following error at net_plotter.set_weights:36: IndexError: invalid index to scalar variable.

Checking the value of step shows that it's -1.0 and since we cannot index scalar values I'm assuming this is the problem. Am I running something wrong, or is this a bug?

Granted, I'm not using MPI. Could that be the cause of the issue?

Thanks.

henryp12345 commented 3 years ago

I'm having this same issue and I am using MPI, so that's not the issue. Did you manage to resolve this?

seanswyi commented 3 years ago

@henryp12345 No, I haven't. Granted, I haven't really spent a lot of time tryin to debug or solve the issue though.

AlbertiPot commented 1 year ago

I currently downloaded the provided models and am running the command:

python plot_surface.py \
    --cuda \
    --model resnet56 \
    --x=-1:1:51 \
    --y=-1:1:51 \
    --model_file cifar10/trained_nets/resnet56_sgd_lr=0.1_bs=128_wd=0.0005/model_300.t7 \
    --dir_type weights \
    --xnorm filter \
    --xignore biasbn \
    --ynorm filter \
    --ignore biasbn \
    --plot

and am getting the following error at net_plotter.set_weights:36: IndexError: invalid index to scalar variable.

Checking the value of step shows that it's -1.0 and since we cannot index scalar values I'm assuming this is the problem. Am I running something wrong, or is this a bug?

Granted, I'm not using MPI. Could that be the cause of the issue?

Thanks.

Hi, I have encountered this issue too. Sooner I found that this is because I have stored an h5 file holding a single direction in the last run, so it may conflict with the next run which tries to plot two directions. When I delete all the cached h5 files and re-run, the issues do not happen.

may it help