Install the tool dependencies via python3 -m pip install -r requirements.txt.
Invoke downloader.py to download the data with
a command like the one below if download.yml is present in the
sample directory (example).
downloader.py -d /path/to/data/dir -f /path/to/download.ymlThe data directory i.e. /path/to/data/dir is a centralized directory
to store data of all samples. So you can use same one for all samples.
It can be provided by either -d /path/to/data/dir or the environment variable
$TRT_DATADIR, where the -d has higher priority.
Remember to use -d or $TRT_DATADIR when running sample scripts
that rely on downloaded data. Scripts will abort if no downloaded data
is found in data directory. ($TRT_DATADIR will be much simplier.)
An error will be thrown if the data is not properly setup.
The download.yml file is owned by the sample which describes the sample
name, the path, URL and checksum of the data files that are required by the sample.
Notes for sample developers
To use the downloaded data files, integrate the code segment like below into
the sample code, and obtain the path to the data file by passing the path
as specified in the associated download.yml file of the sample.
TRT_DATADIR = None
def getFilePath(path):
global TRT_DATADIR
if not TRT_DATADIR:
parser = argparse.ArgumentParser(description="Convert PackNet to ONNX")
parser.add_argument('-d', '--data', help="Specify the data directory where it is saved in. $TRT_DATADIR will be overwritten by this argument.")
args, _ = parser.parse_known_args()
TRT_DATADIR = os.environ.get('TRT_DATADIR', None) if args.data is None else args.data
if TRT_DATADIR is None:
raise ValueError("Data directory must be specified by either `-d $DATA` or environment variable $TRT_DATADIR.")
fullpath = os.path.join(TRT_DATADIR, path)
if not os.path.exists(fullpath):
raise ValueError("Data file %s doesn't exist!" % fullpath)
return fullpathPython Version Support
All Python samples are expected to be run with Python>=3.10. It is not recommended to use any lower version as there may be compatibility issues.
August 2025 Removed support for Python versions < 3.10.