修改Faster-Whisper模型默认下载C盘目录的问题

当前的版本在Windows下测试,如果whisper模型不存在,会在C:\Users\用户名\.cache\huggingface\hub下载模型,占用C盘空间
This commit is contained in:
刘悦 2024-03-23 10:28:58 +08:00 committed by GitHub
parent 17aff21aee
commit f1f78bdcc2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -47,7 +47,7 @@ def execute_asr(input_folder, output_folder, model_size, language,precision):
print("loading faster whisper model:",model_size,model_path) print("loading faster whisper model:",model_size,model_path)
device = 'cuda' if torch.cuda.is_available() else 'cpu' device = 'cuda' if torch.cuda.is_available() else 'cpu'
try: try:
model = WhisperModel(model_path, device=device, compute_type=precision) model = WhisperModel(model_path, device=device, compute_type=precision,download_root="./tools/asr/models",local_files_only=False)
except: except:
return print(traceback.format_exc()) return print(traceback.format_exc())
output = [] output = []