Skip to content

Commit

Permalink
openvino: better gpu failure fallback
Browse files Browse the repository at this point in the history
  • Loading branch information
koush committed Sep 11, 2024
1 parent 8819f0a commit 521bb62
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 19 deletions.
4 changes: 2 additions & 2 deletions plugins/openvino/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion plugins/openvino/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,5 @@
"devDependencies": {
"@scrypted/sdk": "file:../../sdk"
},
"version": "0.1.115"
"version": "0.1.116"
}
36 changes: 20 additions & 16 deletions plugins/openvino/src/ov/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,6 @@ def __init__(self, nativeId: str | None = None):
self.sigmoid = model == "yolo-v4-tiny-tf"
self.modelName = model

print(f"model/mode/precision: {model}/{mode}/{precision}")

ovmodel = "best" if self.scrypted_model else model

model_version = "v5"
Expand Down Expand Up @@ -203,22 +201,28 @@ def __init__(self, nativeId: str | None = None):

try:
self.compiled_model = self.core.compile_model(xmlFile, mode)
print(
"EXECUTION_DEVICES",
self.compiled_model.get_property("EXECUTION_DEVICES"),
)
except:
import traceback

traceback.print_exc()
print("Reverting all settings.")
self.storage.removeItem("mode")
self.storage.removeItem("model")
self.storage.removeItem("precision")
if mode == "GPU":
print("GPU mode failed, reverting to AUTO.")
self.storage.setItem("mode", "AUTO")
self.requestRestart()
try:
print("GPU mode failed, reverting to AUTO.")
mode = "AUTO"
self.mode = mode
self.compiled_model = self.core.compile_model(xmlFile, mode)
except:
import traceback

traceback.print_exc()
print("Reverting all settings.")
self.storage.removeItem("mode")
self.storage.removeItem("model")
self.storage.removeItem("precision")
self.requestRestart()

print(
"EXECUTION_DEVICES",
self.compiled_model.get_property("EXECUTION_DEVICES"),
)
print(f"model/mode/precision: {model}/{mode}/{precision}")

# mobilenet 1,300,300,3
# yolov3/4 1,416,416,3
Expand Down

0 comments on commit 521bb62

Please sign in to comment.