CuriousAI / mean-teacher

A state-of-the-art semi-supervised method for image recognition
https://arxiv.org/abs/1703.01780
Other
1.56k stars 331 forks source link

Pytorch version #27

Closed lukk47 closed 5 years ago

lukk47 commented 5 years ago

May I know the version you were using? The code is not compatible with latest pytorch. Thank yoU!

tarvaina commented 5 years ago

Yeah, this was written in 2017 before PyTorch merged variables and tensors. I must have used PyTorch 0.2.0 or even 0.1.12 but I guess 0.3.1 would work too. Sorry for not documenting this.

lukk47 commented 5 years ago

Thanks, I will try and post the version that works.

tarvaina commented 5 years ago

Hi, I tested it out and pytorch 0.3.1 works but 0.2.0 doesn't. I must have updated the code to 0.3.1 at some point.

lukk47 commented 5 years ago

Cool, I will start will 0.3.1 then. Thanks!

lukk47 commented 5 years ago

0.3.1 works. But from the first iteration, I came across with this loss explosion problem. I use the original source code with 8 GPUs. Do you any suggestions?

Epoch: [0][0/7207] Time 59.704 (59.704) Data 11.010 (11.010) Class 3.5564 (3.5564) Cons 0.0247 (0.0247) Prec@1 0.000 (0.000) Prec@5 0.000 (0.000) Traceback (most recent call last): File "/opt/conda/lib/python3.6/runpy.py", line 193, in _run_module_as_main "main", mod_spec) File "/opt/conda/lib/python3.6/runpy.py", line 85, in _run_code exec(code, run_globals) File "/scratch/project/pytorch/experiments/imagenet_valid.py", line 82, in run(**run_params) File "/scratch/project/pytorch/experiments/imagenet_valid.py", line 77, in run main.main(context) File "/scratch/project/pytorch/main.py", line 104, in main train(train_loader, model, ema_model, optimizer, epoch, training_log) File "/scratch/project/pytorch/main.py", line 270, in train assert not (np.isnan(loss.data[0]) or loss.data[0] > 1e5), 'Loss explosion: {}'.format(loss.data[0]) AssertionError: Loss explosion: 160967.515625

lukk47 commented 5 years ago

I move following question to a previous issue

liangzimei commented 5 years ago

in my case, pytorch0.4.1 + py3 can't work.

jessica-santos commented 5 years ago

Hi, the code will be update for a new version of pytorch?

I'm trying to do this by my own, but I'm new to pytorch and finding some issues. After changing the .data to item, I try to run the code but receive RuntimeError: cuDNN error: CUDNN_STATUS_BAD_PARAM