Skip to main content

Description

Retrieve parameters tracked in a DVC repository. Without arguments, this function retrieves all parameters from all tracked parameter files for the current working tree. Parameters are typically stored in YAML, JSON, TOML, or Python files and tracked in dvc.yaml. This function provides programmatic access to these parameters for analysis, comparison, or dynamic configuration.

Signature

Parameters

str
default:"None"
Names of the parameter files to retrieve parameters from (positional arguments).
  • If no targets are provided, all parameter files tracked in dvc.yaml will be used
  • Targets don’t necessarily have to be defined in dvc.yaml
  • Can specify multiple files: params_show("params.yaml", "config.toml")
str
default:"None"
Location of the DVC repository.
  • Defaults to the current project (found by walking up from the current working directory)
  • Can be a URL or a file system path
  • Both HTTP and SSH protocols are supported for online Git repos
Union[str, Iterable[str]]
default:"None"
Name or names of the stages to retrieve parameters from.
  • If None, all parameters from all stages will be retrieved
  • Can be a single string or an iterable of strings
  • If called from a different location than dvc.yaml, use: {relpath}:{stage}
str
default:"None"
Name of the Git revision to retrieve parameters from.
  • Defaults to None (current working tree)
  • Can be a branch name, tag name, commit hash, or DVC experiment name
  • If repo is not a Git repo, this option is ignored
bool
default:"False"
Whether to retrieve only parameters that are stage dependencies.
  • When True, only returns parameters explicitly listed as dependencies
  • When False, returns all parameters
dict
default:"None"
Config dictionary to be passed through to the DVC project.

Returns

dict
A dictionary containing the parameters. The structure depends on the parameter files:
  • Single file: Returns the parameters directly
  • Multiple files with unique keys: Merges parameters from all files
  • Multiple files with conflicting keys: Prefixes keys with filename:key

Examples

Basic Usage - All Parameters

From Specific Git Revision

Filter by Stages

Specific Parameter Files

Remote Repository

Compare Parameters Across Branches

Access Nested Parameters

Handle Multiple Files with Conflicts

Load Parameters for Training

Get Only Dependency Parameters

Error Handling

Use Cases

Hyperparameter Tracking

Track and compare hyperparameters across experiments and branches.

Dynamic Configuration

Load parameters programmatically in training and inference scripts.

Experiment Comparison

Compare parameter settings across different experiments.

Reproducibility

Retrieve exact parameters used in past experiments for reproduction.

Parameter File Formats

Return Value Structure

When retrieving parameters from a single file, the structure matches the file content:
When parameter keys are unique across files, they’re merged:
When keys conflict, they’re prefixed with the filename:
When filtering by stages, only parameters used by those stages are returned:

Best Practices

Store parameters in version control and track with DVC:
Retrieve exact parameters for reproducing results:
Build parameter comparison tools:
Use .get() with defaults for robustness:

metrics_show()

Retrieve metrics values

exp_show()

Show experiments with params

read()

Read any tracked file