From cf1c475633389ad0e781cd2fa0d581d408e3ea5a Mon Sep 17 00:00:00 2001 From: mohamed ahmed Krichen <57727551+medahmedkrichen@users.noreply.github.com> Date: Sun, 15 Dec 2024 02:30:49 +0100 Subject: [PATCH] Update inference.py --- inference.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/inference.py b/inference.py index bd4c748..ecfa03c 100644 --- a/inference.py +++ b/inference.py @@ -374,21 +374,17 @@ def __init__(self, Video_path, source_language, target_language, 'None': None} - if self.source_language == 'tr': model_name = f"Helsinki-NLP/opus-mt-trk-{self.target_language}" elif self.target_language == 'tr': model_name = f"Helsinki-NLP/opus-mt-{self.source_language}-trk" - else: - model_name = f"Helsinki-NLP/opus-mt-{self.source_language}-{self.target_language}" - - if self.source_language == 'zh-cn': + elif self.source_language == 'zh-cn': model_name = f"Helsinki-NLP/opus-mt-zh-{self.target_language}" elif self.target_language == 'zh-cn': model_name = f"Helsinki-NLP/opus-mt-{self.source_language}-zh" else: model_name = f"Helsinki-NLP/opus-mt-{self.source_language}-{self.target_language}" - + tokenizer = MarianTokenizer.from_pretrained(model_name) model = MarianMTModel.from_pretrained(model_name).to(device)