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
|
||||
build
|
||||
env*
|
||||
venv*
|
||||
*.egg-info
|
||||
models_eynollah*
|
||||
reloaded
|
||||
*.h5
|
||||
config_files*
|
||||
|
|
|
|||
|
|
@ -328,6 +328,11 @@ class EynollahModelZoo:
|
|||
gpu = int(device[3:] or "0")
|
||||
else:
|
||||
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
|
||||
if 'CUDAExecutionProvider' in providers:
|
||||
providers.remove('CUDAExecutionProvider')
|
||||
|
|
|
|||
|
|
@ -208,9 +208,9 @@ class Predictor(mp.context.SpawnProcess):
|
|||
else:
|
||||
multi_output = False
|
||||
results = np.split(make_shareable(result), len(jobs))
|
||||
#self.logger.debug("sharing result array for '%d'", jobid)
|
||||
with ExitStack() as stack:
|
||||
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,
|
||||
# but don't want to wait either, so track closing
|
||||
# context per job, and wait for closable signal
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue