add suggestions from code review

pull/188/head
Vaibhav Srivastav 2023-04-28 16:26:09 +02:00
parent c61ee92ee9
commit b24dd26d4b
1 changed files with 2 additions and 3 deletions

View File

@ -165,9 +165,8 @@ def _grab_best_device(use_gpu=True):
def _download(from_hf_path, file_name, to_local_path):
os.makedirs(CACHE_DIR, exist_ok=True)
destination_file_name = to_local_path.split("/")[-1]
file_dir = CACHE_DIR
hf_hub_download(repo_id=from_hf_path, filename=file_name, local_dir=file_dir)
os.replace(f"{CACHE_DIR}/{file_name}", to_local_path)
hf_hub_download(repo_id=from_hf_path, filename=file_name, local_dir=CACHE_DIR)
os.replace(os.path.join(CACHE_DIR, file_name), to_local_path)
class InferenceContext:
def __init__(self, benchmark=False):