Run the buildconfig file
To build a script that parses the buildconfig.yaml
arguments and passes them to the build.py
script, you can create a new Python script that reads the YAML configuration file, extracts the relevant settings, and constructs the appropriate command-line arguments for the trtllm-build
command.
Here's an example of how you can create such a script:
In this script:
We define a function called
parse_buildconfig
that takes the path to thebuildconfig.yaml
file as input. It reads the YAML file, extracts the relevant settings from the model, checkpoint, and build configurations, and constructs a list of command-line arguments based on the settings.We define the
main
function that usesargparse
to parse the command-line arguments. It expects a--config
argument that specifies the path to thebuildconfig.yaml
file.Inside the
main
function, we call theparse_buildconfig
function to parse the YAML file and obtain the command-line arguments.We construct the
trtllm-build
command by concatenating the base command with the parsed command-line arguments.Finally, we use
subprocess.run
to execute thetrtllm-build
command with the provided arguments.
To use this script, save it to a file (e.g., run_trtllm_build.py
) and run it from the command line, providing the path to the buildconfig.yaml
file:
This script will parse the buildconfig.yaml
file, extract the relevant settings, and pass them as command-line arguments to the trtllm-build
command.
Note: Make sure you have the necessary dependencies installed (yaml
and argparse
) before running the script.
Last updated