Skip to content

Commit

Permalink
Fix join of base url for windows machines (#282)
Browse files Browse the repository at this point in the history
  • Loading branch information
TheHappyLemon authored May 2, 2024
1 parent 74bc6ae commit 982fb46
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion laser_encoders/download_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit 982fb46

Please sign in to comment.