From ad4287116d2d08d886a3a1f3fac211710e640e28 Mon Sep 17 00:00:00 2001 From: Artem Date: Thu, 25 Apr 2024 13:33:50 +0300 Subject: [PATCH] Fix join of base url for windows machines --- laser_encoders/download_models.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/laser_encoders/download_models.py b/laser_encoders/download_models.py index fbd731db..08b91761 100644 --- a/laser_encoders/download_models.py +++ b/laser_encoders/download_models.py @@ -45,7 +45,10 @@ def __init__(self, model_dir: str = None): self.base_url = "https://dl.fbaipublicfiles.com/nllb/laser" def download(self, filename: str): - url = os.path.join(self.base_url, filename) + # Because on windows os.path.join will use "\" insted of "/", so link would be: + # https://dl.fbaipublicfiles.com/nllb/laser\laser2.pt instead of https://dl.fbaipublicfiles.com/nllb/laser/laser2.pt + # which results in a failed download. + url = f"{self.base_url}/{filename}" local_file_path = os.path.join(self.model_dir, filename) if os.path.exists(local_file_path):