chenyuntc / pytorch-book

PyTorch tutorials and fun projects including neural talk, neural style, poem writing, anime generation (《深度学习框架PyTorch:入门与实战》)
MIT License
12.11k stars 3.74k forks source link

@bobo0810 你好,我用的第六章,训练过程中报错,一直没解决,能帮忙看下嘛,谢谢。 #151

Closed TravisTorch closed 5 years ago

TravisTorch commented 5 years ago

@bobo0810 你好,我用的第六章,训练过程中报错,一直没解决,能帮忙看下嘛,谢谢。 travis@T:~$ python /home/travis/下载/pytorch-book-master/chapter6-实战指南/main.py train --train-data-root=/home/travis/下载/dogcat/train --use-gpu=False --env=classifier user config: env classifier vis_port 8097 model SqueezeNet train_data_root /home/travis/下载/dogcat/train test_data_root /home/travis/下载/dogcat/test1 load_model_path None batch_size 32 use_gpu False num_workers 4 print_freq 20 debug_file /tmp/debug result_file result.csv max_epoch 10 lr 0.001 lr_decay 0.5 weight_decay 0.0 WARNING:root:Setting up a new session... WARNING:visdom:Without the incoming socket you cannot receive events from the server or register event handlers to your Visdom client. 547it [08:13, 1.17it/s] Traceback (most recent call last): File "/home/travis/下载/pytorch-book-master/chapter6-实战指南/main.py", line 165, in fire.Fire() File "/home/travis/anaconda3/lib/python3.6/site-packages/fire/core.py", line 127, in Fire component_trace = _Fire(component, args, context, name) File "/home/travis/anaconda3/lib/python3.6/site-packages/fire/core.py", line 366, in _Fire component, remaining_args) File "/home/travis/anaconda3/lib/python3.6/site-packages/fire/core.py", line 542, in _CallCallable result = fn(*varargs, **kwargs) File "/home/travis/下载/pytorch-book-master/chapter6-实战指南/main.py", line 109, in train model.save() File "/home/travis/下载/pytorch-book-master/chapter6-实战指南/models/basic_module.py", line 28, in save t.save(self.state_dict(), name) File "/home/travis/anaconda3/lib/python3.6/site-packages/torch/serialization.py", line 224, in save return _with_file_like(f, "wb", lambda f: _save(obj, f, pickle_module, pickle_protocol)) File "/home/travis/anaconda3/lib/python3.6/site-packages/torch/serialization.py", line 147, in _with_file_like f = open(f, mode) FileNotFoundError: [Errno 2] No such file or directory: 'checkpoints/squeezenet_0513_14:35:30.pth'

sdzbft commented 5 years ago

命令行参数 不要写预训练模型的路径,默认为None

bobo0810 commented 5 years ago

@ft-sunshine 嗯

bobo0810 commented 5 years ago

@TravisTorch 建议使用pycharm debug按行调试,并结合 命令行的出错信息。快速定位并解决bug~