Skip to content

Commit

Permalink
Update inference.py
Browse files Browse the repository at this point in the history
  • Loading branch information
medahmedkrichen authored Dec 15, 2024
1 parent b544b90 commit cf1c475
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions inference.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit cf1c475

Please sign in to comment.