kenshohara / 3D-ResNets-PyTorch

3D ResNets for Action Recognition (CVPR 2018)
MIT License
3.9k stars 932 forks source link

problem about saving checkpoint #213

Closed TitaniumOne closed 4 years ago

TitaniumOne commented 4 years ago

Hi, I can not save the checkpoint, but I can save the val.log, train.log, train_batch.log and opts.json. Can you help me? Thank you!!!

Traceback (most recent call last):
  File "main.py", line 434, in <module>
    main_worker(-1, opt)
  File "main.py", line 398, in main_worker
    scheduler)
  File "main.py", line 316, in save_checkpoint
    torch.save(save_states, save_file_path)
  File "/usr/local/lib/python3.5/dist-packages/torch/serialization.py", line 224, in save
    return _with_file_like(f, "wb", lambda f: _save(obj, f, pickle_module, pickle_protocol))
  File "/usr/local/lib/python3.5/dist-packages/torch/serialization.py", line 147, in _with_file_like
    f = open(f, mode)
TypeError: invalid file: PosixPath('/home/liuhao/testCode/ResNets_3D_PyTorch/data/results/save_10.pth')
Dongjiuqing commented 3 years ago

Excuse me, I got the same error as yours. So, could you please tell me how you deal with it? Thanks a lot.

loading pretrained model data/results_hmdb51/r2p1d50_K_200ep.pth Traceback (most recent call last): File "main.py", line 428, in main_worker(-1, opt) File "main.py", line 343, in main_worker opt.n_finetune_classes) File "/home/dong/Desktop/3D-ResNets-PyTorch-master/model.py", line 100, in load_pretrained_model pretrain = torch.load(pretrain_path, map_location='cpu') File "/home/dong/anaconda3/envs/2sAGCN/lib/python3.5/site-packages/torch/serialization.py", line 301, in load f = open(f, 'rb') TypeError: invalid file: PosixPath('data/results_hmdb51/r2p1d50_K_200ep.pth')

guilhermesurek commented 3 years ago

@Dongjiuqing Could you post the command line call that you are running? Check the relative paths.

Dongjiuqing commented 3 years ago

@Dongjiuqing Could you post the command line call that you are running? Check the relative paths

Thank you for your reply. I have solved this error. I found that my python-version is 3.5. I create an env. whit a python 3.7 . It works.