mirror of
https://github.com/qurator-spk/eynollah.git
synced 2026-07-11 22:29:29 +02:00
ModelZoo for ONNX backend: allow setting execution providers via env
This commit is contained in:
parent
c9c14ed83d
commit
c680dae2d1
3 changed files with 10 additions and 1 deletions
|
|
@ -2,5 +2,9 @@ tests
|
||||||
dist
|
dist
|
||||||
build
|
build
|
||||||
env*
|
env*
|
||||||
|
venv*
|
||||||
*.egg-info
|
*.egg-info
|
||||||
models_eynollah*
|
models_eynollah*
|
||||||
|
reloaded
|
||||||
|
*.h5
|
||||||
|
config_files*
|
||||||
|
|
|
||||||
|
|
@ -328,6 +328,11 @@ class EynollahModelZoo:
|
||||||
gpu = int(device[3:] or "0")
|
gpu = int(device[3:] or "0")
|
||||||
else:
|
else:
|
||||||
gpu = 0 # try first allowable
|
gpu = 0 # try first allowable
|
||||||
|
# make runtime-configurable
|
||||||
|
if override_providers := os.environ.get('EYNOLLAH_ONNX_EP', ''):
|
||||||
|
override_providers = override_providers.split(',')
|
||||||
|
providers = [provider for provider in providers
|
||||||
|
if provider[:-17] in override_providers]
|
||||||
# configure and prioritise
|
# configure and prioritise
|
||||||
if 'CUDAExecutionProvider' in providers:
|
if 'CUDAExecutionProvider' in providers:
|
||||||
providers.remove('CUDAExecutionProvider')
|
providers.remove('CUDAExecutionProvider')
|
||||||
|
|
|
||||||
|
|
@ -208,9 +208,9 @@ class Predictor(mp.context.SpawnProcess):
|
||||||
else:
|
else:
|
||||||
multi_output = False
|
multi_output = False
|
||||||
results = np.split(make_shareable(result), len(jobs))
|
results = np.split(make_shareable(result), len(jobs))
|
||||||
#self.logger.debug("sharing result array for '%d'", jobid)
|
|
||||||
with ExitStack() as stack:
|
with ExitStack() as stack:
|
||||||
for jobid, result in zip(jobs, results):
|
for jobid, result in zip(jobs, results):
|
||||||
|
#self.logger.debug("sharing result array for '%d'", jobid)
|
||||||
# we don't know when the result will be received,
|
# we don't know when the result will be received,
|
||||||
# but don't want to wait either, so track closing
|
# but don't want to wait either, so track closing
|
||||||
# context per job, and wait for closable signal
|
# context per job, and wait for closable signal
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue