From af14fabc0051ff7d5c611c81c80a132a0006f602 Mon Sep 17 00:00:00 2001 From: "Kang, Harim" Date: Mon, 24 Jun 2024 14:34:35 +0900 Subject: [PATCH] Fix os.path to Path --- src/otx/algo/classification/backbones/efficientnet.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/otx/algo/classification/backbones/efficientnet.py b/src/otx/algo/classification/backbones/efficientnet.py index 8c87d399255..639a4e15a29 100644 --- a/src/otx/algo/classification/backbones/efficientnet.py +++ b/src/otx/algo/classification/backbones/efficientnet.py @@ -5,6 +5,7 @@ import math import os +from pathlib import Path import torch import torch.nn.functional as F @@ -661,6 +662,6 @@ def init_weights(self, pretrained: bool | str | None = None): load_checkpoint_to_model(self, checkpoint) print(f"init weight - {pretrained}") elif pretrained is not None: - cache_dir = os.path.join("~", ".cache", "torch", "hub", "checkpoints") - download_model(net=self, model_name=self.model_name, local_model_store_dir_path=cache_dir) + cache_dir = Path.home() / ".cache" / "torch" / "hub" / "checkpoints" + download_model(net=self, model_name=self.model_name, local_model_store_dir_path=str(cache_dir)) print(f"init weight - {pretrained_urls[self.model_name]}")