Test a model

7.1. Test a model#

The frozen model can be used in many ways. The most straightforward test can be performed using dp test. A typical usage of dp test is

dp test -m graph.pb -s /path/to/system -n 30

where -m gives the tested model, -s the path to the tested system and -n the number of tested frames. Several other command line options can be passed to dp test, which can be checked with

$ dp test --help

An explanation will be provided

usage: dp test [-h] [-v {DEBUG,3,INFO,2,WARNING,1,ERROR,0}] [-l LOG_PATH]
               [-m MODEL] [-s SYSTEM | -f DATAFILE] [-S SET_PREFIX]
               [-n NUMB_TEST] [-r RAND_SEED] [--shuffle-test] [-d DETAIL_FILE]
               [-a] [--head HEAD]

options:
  -h, --help            show this help message and exit
  -v {DEBUG,3,INFO,2,WARNING,1,ERROR,0}, --log-level {DEBUG,3,INFO,2,WARNING,1,ERROR,0}
                        set verbosity level by string or number, 0=ERROR, 1=WARNING, 2=INFO and 3=DEBUG (default: INFO)
  -l LOG_PATH, --log-path LOG_PATH
                        set log file to log messages to disk, if not specified, the logs will only be output to console (default: None)
  -m MODEL, --model MODEL
                        Frozen model file (prefix) to import. TensorFlow backend: suffix is .pb; PyTorch backend: suffix is .pth. (default: frozen_model)
  -s SYSTEM, --system SYSTEM
                        The system dir. Recursively detect systems in this directory (default: .)
  -f DATAFILE, --datafile DATAFILE
                        The path to the datafile, each line of which is a path to one data system. (default: None)
  -S SET_PREFIX, --set-prefix SET_PREFIX
                        [DEPRECATED] Deprecated argument. (default: None)
  -n NUMB_TEST, --numb-test NUMB_TEST
                        The number of data for test. 0 means all data. (default: 0)
  -r RAND_SEED, --rand-seed RAND_SEED
                        The random seed (default: None)
  --shuffle-test        Shuffle test data (default: False)
  -d DETAIL_FILE, --detail-file DETAIL_FILE
                        The prefix to files where details of energy, force and virial accuracy/accuracy per atom will be written (default: None)
  -a, --atomic          Test the accuracy of atomic label, i.e. energy / tensor (dipole, polar) (default: False)
  --head HEAD           (Supported backend: PyTorch) Task head to test if in multi-task mode. (default: None)

examples:
    dp test -m graph.pb -s /path/to/system -n 30