ultralytics 8.3.72 Fix NVIDIA Jetson DLA core support for DLA inference (#19078)
Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com> Co-authored-by: UltralyticsAssistant <web@ultralytics.com> Co-authored-by: Lakshantha Dissanayake <lakshanthad@yahoo.com> Co-authored-by: Lakshantha Dissanayake <lakshantha@ultralytics.com> Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
This commit is contained in:
parent
84a8b067c4
commit
c1860b8333
5 changed files with 15 additions and 12 deletions
|
|
@ -1,6 +1,6 @@
|
|||
# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
|
||||
|
||||
__version__ = "8.3.71"
|
||||
__version__ = "8.3.72"
|
||||
|
||||
import os
|
||||
|
||||
|
|
|
|||
|
|
@ -386,6 +386,8 @@ class Exporter:
|
|||
"names": model.names,
|
||||
"args": {k: v for k, v in self.args if k in fmt_keys},
|
||||
} # model metadata
|
||||
if dla is not None:
|
||||
self.metadata["dla"] = dla # make sure `AutoBackend` uses correct dla device if it has one
|
||||
if model.task == "pose":
|
||||
self.metadata["kpt_shape"] = model.model[-1].kpt_shape
|
||||
|
||||
|
|
|
|||
|
|
@ -292,13 +292,10 @@ class AutoBackend(nn.Module):
|
|||
metadata = json.loads(f.read(meta_len).decode("utf-8")) # read metadata
|
||||
except UnicodeDecodeError:
|
||||
f.seek(0) # engine file may lack embedded Ultralytics metadata
|
||||
dla = metadata.get("dla", None)
|
||||
if dla is not None:
|
||||
runtime.DLA_core = int(dla)
|
||||
model = runtime.deserialize_cuda_engine(f.read()) # read engine
|
||||
if "dla" in str(device.type):
|
||||
dla_core = int(device.type.split(":")[1])
|
||||
assert dla_core in {0, 1}, (
|
||||
"Expected device type for inference in DLA is 'dla:0' or 'dla:1', but received '{device.type}'"
|
||||
)
|
||||
runtime.DLA_core = dla_core
|
||||
|
||||
# Model context
|
||||
try:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue