From 982fb46dd51e9a17581b57ba9eb8881ca5fa5779 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Artjoms=20Ku=C4=8Derjavijs?= <86469128+TheHappyLemon@users.noreply.github.com> Date: Thu, 2 May 2024 20:57:33 +0300 Subject: [PATCH] Fix join of base url for windows machines (#282) --- 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):