deepmodeling / deepmd-kit

A deep learning package for many-body potential energy representation and molecular dynamics
https://docs.deepmodeling.com/projects/deepmd/
GNU Lesser General Public License v3.0
1.45k stars 499 forks source link

dp freeze failed on the api branch #375

Closed amcadmus closed 3 years ago

amcadmus commented 3 years ago

DeepMD-kit: branch api Python: 3.6 TF: 1.8

To reproduce, firstly change the stop_batch in /path/to/deepmd-kit/deepmd-kit/examples/water/train/water_se_a.json to 1000, then

cd /path/to/deepmd-kit/examples/water/train
dp train water_se_a.json
dp freeze

I got the following error:

Traceback (most recent call last):
  File "/xxxxx/venvs/py3.6-tf1.8/bin/dp", line 11, in <module>
    load_entry_point('deepmd-kit==1.2.3.dev295+g2d9c702.d20210222', 'console_scripts', 'dp')()
  File "/xxxxx/venvs/py3.6-tf1.8/lib/python3.6/site-packages/deepmd_kit-1.2.3.dev295+g2d9c702.d20210222-py3.6-linux-x86_64.egg/deepmd/main.py", line 267, in main
    set_log_handles(args.log_level, Path(args.log_path))
  File "/usr/lib64/python3.6/pathlib.py", line 999, in __new__
    self = cls._from_parts(args, init=False)
  File "/usr/lib64/python3.6/pathlib.py", line 656, in _from_parts
    drv, root, parts = self._parse_args(args)
  File "/usr/lib64/python3.6/pathlib.py", line 640, in _parse_args
    a = os.fspath(a)
TypeError: expected str, bytes or os.PathLike object, not NoneType

The bug should be caused by the improper treatment of the default log file. The set_log_handles(args.log_level, Path(args.log_path)) does not accept args.log_path == None .

amcadmus commented 3 years ago

@marian-code Please check this issue, thanks!

amcadmus commented 3 years ago

Solved