use Path / operator

This commit is contained in:
Michael Yang 2023-06-30 11:55:31 -07:00
parent 3ce3caaf65
commit 76fb9eea1e
2 changed files with 3 additions and 3 deletions

View file

@ -30,7 +30,7 @@ def load(model_name, models={}):
if not models.get(model_name, None): if not models.get(model_name, None):
model_path = path.expanduser(model_name) model_path = path.expanduser(model_name)
if not path.exists(model_path): if not path.exists(model_path):
model_path = path.join(MODELS_CACHE_PATH, model_name + ".bin") model_path = MODELS_CACHE_PATH / model_name + ".bin"
runners = { runners = {
model_type: cls model_type: cls

View file

@ -7,7 +7,7 @@ from tqdm import tqdm
MODELS_MANIFEST = 'https://ollama.ai/api/models' MODELS_MANIFEST = 'https://ollama.ai/api/models'
MODELS_CACHE_PATH = path.join(Path.home(), '.ollama', 'models') MODELS_CACHE_PATH = Path.home() / '.ollama' / 'models'
def models(*args, **kwargs): def models(*args, **kwargs):
@ -78,7 +78,7 @@ def find_bin_file(json_response, location, branch):
def download_file(download_url, file_name, file_size): def download_file(download_url, file_name, file_size):
local_filename = path.join(MODELS_CACHE_PATH, file_name) + '.bin' local_filename = MODELS_CACHE_PATH / file_name + '.bin'
first_byte = path.getsize(local_filename) if path.exists(local_filename) else 0 first_byte = path.getsize(local_filename) if path.exists(local_filename) else 0