Skip to content

Commit

Permalink
[!56][TRIANGLE] Correct config lm path parameters error arising when …
Browse files Browse the repository at this point in the history
…a newer environment is used

# Why is the change needed?
With the new environment (needed for A40 GPUs) and successive python libraries versions, the primary and auxiliary LM paths are inserted in the task configuration, raising an error when the generate script search for this information in the generic config

# What changes does the patch introduce?
If the paths are searched in the generic config and are not found, then they are searched in the task config.

# How was this patch tested?
Manual running in the new environment.
  • Loading branch information
sarapapi authored and mgaido91 committed Oct 25, 2023
1 parent e63e562 commit a6c568d
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions examples/speech_to_text/generate_dualdecoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,13 @@ def load_lm(lm_path):
lm = lms[0]
return lm

primary_lm = load_lm(cfg.primary_lm_path)
auxiliary_lm = load_lm(cfg.auxiliary_lm_path)
primary_lm_path = getattr(cfg, "primary_lm_path", None)
auxiliary_lm_path = getattr(cfg, "primary_lm_path", None)
primary_lm_path = getattr(cfg.task, "primary_lm_path", None) if primary_lm_path is None else primary_lm_path
auxiliary_lm_path = getattr(cfg.task, "primary_lm_path", None) if auxiliary_lm_path is None else auxiliary_lm_path

primary_lm = load_lm(primary_lm_path)
auxiliary_lm = load_lm(auxiliary_lm_path)

# Optimize ensemble for generation
for model in chain(models, [primary_lm, auxiliary_lm]):
Expand Down

0 comments on commit a6c568d

Please sign in to comment.