forked from dusty-nv/jetson-containers
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.py
62 lines (41 loc) · 1.68 KB
/
config.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
import os
from jetson_containers import L4T_VERSION, CUDA_ARCHITECTURES, CUDA_VERSION
def tensorrt_package(version, url, deb, packages=None, requires=None, default=False):
"""
Generate containers for a particular version of TensorRT installed from debian packages
"""
if not packages:
packages = os.environ.get('TENSORRT_PACKAGES', 'tensorrt tensorrt-libs python3-libnvinfer-dev')
tensorrt = package.copy()
tensorrt['name'] = f'tensorrt:{version}'
tensorrt['build_args'] = {
'TENSORRT_URL': url,
'TENSORRT_DEB': deb,
'TENSORRT_PACKAGES': packages,
}
if default:
tensorrt['alias'] = 'tensorrt'
if requires:
tensorrt['requires'] = requires
return tensorrt
def tensorrt_builtin(version=None, requires=None, default=False):
"""
Backwards-compatability for when TensorRT already installed in base container (like l4t-jetpack)
"""
passthrough = package.copy()
if version is not None:
if not isinstance(version, str):
version = f'{version.major}.{version.minor}'
if default:
passthrough['alias'] = 'tensorrt'
passthrough['name'] += f':{version}'
if requires:
passthrough['requires'] = requires
del passthrough['dockerfile']
return passthrough
package = [
# JetPack 6
tensorrt_package('8.6', 'https://nvidia.box.com/shared/static/hmwr57hm88bxqrycvlyma34c3k4c53t9.deb', 'nv-tensorrt-local-repo-l4t-8.6.2-cuda-12.2', requires='==36.*', default=True),
# JetPack 4-5 (TensorRT installed in base container)
tensorrt_builtin(requires='<36', default=True),
]