diff --git a/content/docs/command-reference/params/index.md b/content/docs/command-reference/params/index.md index 6309309a12..a54b2c17df 100644 --- a/content/docs/command-reference/params/index.md +++ b/content/docs/command-reference/params/index.md @@ -58,6 +58,10 @@ as the tree path to find those values. Supported types are: string, integer, float, and arrays (groups of params). Note that DVC does not ascribe any specific meaning to these values. +> YAML 1.2 stores very large and very small numbers in scientific notation. Some +> popular libraries still use older versions of the format, and can introduce +> subtle bugs when used. + DVC saves parameter names and values to `dvc.lock` in order to track them over time. They will be compared to the latest params files to determine if the stage is outdated upon `dvc repro` (or `dvc status`). @@ -115,16 +119,20 @@ The `train.py` script will have some code to parse and load the needed parameters. For example: ```py -import yaml +from ruamel.yaml import YAML with open("params.yaml", 'r') as fd: - params = yaml.safe_load(fd) + yaml = YAML() + params = yaml.load(fd) lr = params['lr'] epochs = params['train']['epochs'] layers = params['train']['layers'] ``` +> Note that some popular libraries (like PyYAML) do not support YAML 1.2 and +> should be avoided whenever possible. + You can find that each parameter was defined in `dvc.yaml`, as well as saved to `dvc.lock` along with the values. These are compared to the params files when `dvc repro` is used, to determine if the parameter dependency has changed.