-
Notifications
You must be signed in to change notification settings - Fork 523
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
23 changed files
with
544 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,42 @@ | ||
Training Parameters | ||
====================================== | ||
.. note:: | ||
One can load, modify, and export the input file by using our effective web-based tool `DP-GUI <https://deepmodeling.com/dpgui/input/deepmd-kit-2.0>`_ online or hosted using the :ref:`command line interface <cli>` :code:`dp gui`. All training parameters below can be set in DP-GUI. By clicking "SAVE JSON", one can download the input file for furthur training. | ||
One can load, modify, and export the input file by using our effective web-based tool `DP-GUI <https://deepmodeling.com/dpgui/input/deepmd-kit-2.0>`_ online or hosted using the :ref:`command line interface <cli>` :code:`dp gui`. All training parameters below can be set in DP-GUI. By clicking "SAVE JSON", one can download the input file for further training. | ||
|
||
.. note:: | ||
One can benefit from IntelliSense and validation when | ||
:ref:`writing JSON files using Visual Studio Code <json_vscode>`. | ||
See :ref:`here <json_vscode>` to learn how to configure. | ||
|
||
.. dargs:: | ||
:module: deepmd.tf.utils.argcheck | ||
:module: deepmd.utils.argcheck | ||
:func: gen_args | ||
|
||
.. _json_vscode: | ||
|
||
Writing JSON files using Visual Studio Code | ||
------------------------------------------- | ||
|
||
When writing JSON files using `Visual Studio Code <https://code.visualstudio.com/>`_, one can benefit from IntelliSense and | ||
validation by adding a `JSON schema <https://json-schema.org/>`_. | ||
To do so, in a VS Code workspace, one can generate a JSON schema file for the input file by running the following command: | ||
|
||
.. code-block:: bash | ||
dp doc-train-input --out-type json_schema > deepmd.json | ||
Then one can `map the schema <https://code.visualstudio.com/docs/languages/json#_mapping-to-a-schema-in-the-workspace>`_ | ||
by updating the workspace settings in the `.vscode/settings.json` file as follows: | ||
|
||
.. code-block:: json | ||
{ | ||
"json.schemas": [ | ||
{ | ||
"fileMatch": [ | ||
"/**/*.json" | ||
], | ||
"url": "./deepmd.json" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# SPDX-License-Identifier: LGPL-3.0-or-later | ||
import io | ||
import json | ||
import unittest | ||
from contextlib import ( | ||
redirect_stdout, | ||
) | ||
|
||
from deepmd.entrypoints.doc import ( | ||
doc_train_input, | ||
) | ||
|
||
|
||
class TestDocTrainInput(unittest.TestCase): | ||
def test_rst(self): | ||
f = io.StringIO() | ||
with redirect_stdout(f): | ||
doc_train_input(out_type="rst") | ||
self.assertNotEqual(f.getvalue(), "") | ||
|
||
def test_json(self): | ||
f = io.StringIO() | ||
with redirect_stdout(f): | ||
doc_train_input(out_type="json") | ||
# validate json | ||
json.loads(f.getvalue()) | ||
|
||
def test_json_schema(self): | ||
f = io.StringIO() | ||
with redirect_stdout(f): | ||
doc_train_input(out_type="json_schema") | ||
# validate json | ||
json.loads(f.getvalue()) |
Oops, something went wrong.