Open ChillaxBoy opened 5 years ago
环境 python3.5 pytorch1.1.0
把config.py中的load_model_path='checkpoints/model.pth' 改成load_model_path=None
user config: lr_decay 0.95 max_epoch 10 model ResNet34 use_gpu True print_freq 20 train_data_root ./data/train lr 0.1 num_workers 4 env classifier result_file result.csv load_model_path checkpoints/model.pth weight_decay 0.0001 batch_size 128 parse <bound method parse of <config.DefaultConfig object at 0x7f4d2f2f9cc0>> test_data_root ./data/dogs-vs-cats/test1 debug_file /tmp/debug WARNING:root:Setting up a new session... Traceback (most recent call last): File "main.py", line 171, in fire.Fire() File "/home/nj/.local/lib/python3.5/site-packages/fire/core.py", line 138, in Fire component_trace = _Fire(component, args, parsed_flag_args, context, name) File "/home/nj/.local/lib/python3.5/site-packages/fire/core.py", line 471, in _Fire target=component.name) File "/home/nj/.local/lib/python3.5/site-packages/fire/core.py", line 675, in _CallAndUpdateTrace component = fn(*varargs, **kwargs) File "main.py", line 55, in train model.load(opt.load_model_path) File "/home/nj/Downloads/pytorch-best-practice-master/models/BasicModule.py", line 19, in load self.load_state_dict(t.load(path)) File "/home/nj/.local/lib/python3.5/site-packages/torch/serialization.py", line 382, in load f = open(f, 'rb') FileNotFoundError: [Errno 2] No such file or directory: 'checkpoints/model.pth'
把config.py中load_model_path='checkpoints/model.pth' 改为load_model_path=None
把config.py中的load_model_path='checkpoints/model.pth' 改成load_model_path=None
user config: lr_decay 0.95 max_epoch 10 model ResNet34 use_gpu True print_freq 20 train_data_root ./data/train lr 0.1 num_workers 4 env classifier result_file result.csv load_model_path checkpoints/model.pth weight_decay 0.0001 batch_size 128 parse <bound method parse of <config.DefaultConfig object at 0x7f4d2f2f9cc0>> test_data_root ./data/dogs-vs-cats/test1 debug_file /tmp/debug WARNING:root:Setting up a new session... Traceback (most recent call last): File "main.py", line 171, in fire.Fire() File "/home/nj/.local/lib/python3.5/site-packages/fire/core.py", line 138, in Fire component_trace = _Fire(component, args, parsed_flag_args, context, name) File "/home/nj/.local/lib/python3.5/site-packages/fire/core.py", line 471, in _Fire target=component.name) File "/home/nj/.local/lib/python3.5/site-packages/fire/core.py", line 675, in _CallAndUpdateTrace component = fn(*varargs, **kwargs) File "main.py", line 55, in train model.load(opt.load_model_path) File "/home/nj/Downloads/pytorch-best-practice-master/models/BasicModule.py", line 19, in load self.load_state_dict(t.load(path)) File "/home/nj/.local/lib/python3.5/site-packages/torch/serialization.py", line 382, in load f = open(f, 'rb') FileNotFoundError: [Errno 2] No such file or directory: 'checkpoints/model.pth'
把config.py中load_model_path='checkpoints/model.pth' 改为load_model_path=None
解决了,没注意到config默认设置,谢谢老哥
user config: lr_decay 0.95 max_epoch 10 model ResNet34 use_gpu True print_freq 20 train_data_root ./data/train lr 0.1 num_workers 4 env classifier result_file result.csv load_model_path checkpoints/model.pth weight_decay 0.0001 batch_size 128 parse <bound method parse of <config.DefaultConfig object at 0x7f4d2f2f9cc0>> test_data_root ./data/dogs-vs-cats/test1 debug_file /tmp/debug WARNING:root:Setting up a new session... Traceback (most recent call last): File "main.py", line 171, in
fire.Fire()
File "/home/nj/.local/lib/python3.5/site-packages/fire/core.py", line 138, in Fire
component_trace = _Fire(component, args, parsed_flag_args, context, name)
File "/home/nj/.local/lib/python3.5/site-packages/fire/core.py", line 471, in _Fire
target=component.name)
File "/home/nj/.local/lib/python3.5/site-packages/fire/core.py", line 675, in _CallAndUpdateTrace
component = fn(*varargs, **kwargs)
File "main.py", line 55, in train
model.load(opt.load_model_path)
File "/home/nj/Downloads/pytorch-best-practice-master/models/BasicModule.py", line 19, in load
self.load_state_dict(t.load(path))
File "/home/nj/.local/lib/python3.5/site-packages/torch/serialization.py", line 382, in load
f = open(f, 'rb')
FileNotFoundError: [Errno 2] No such file or directory: 'checkpoints/model.pth'