瀏覽代碼

Fixed the bug with additional bytes.

The issue seems to be with huggingface not reporting the entire size of the model.
Added an error message with instructions if the checksums don't match.
Nikita Skakun 2 年之前
父節點
當前提交
d550c12a3e
共有 1 個文件被更改,包括 4 次插入3 次删除
  1. 4 3
      download-model.py

+ 4 - 3
download-model.py

@@ -35,7 +35,7 @@ def get_file(url, output_folder):
         # Check if the file has already been downloaded completely
         r = requests.head(url)
         total_size = int(r.headers.get('content-length', 0))
-        if output_path.stat().st_size == total_size:
+        if output_path.stat().st_size >= total_size:
             return
         # Otherwise, resume the download from where it left off
         headers = {'Range': f'bytes={output_path.stat().st_size}-'}
@@ -215,7 +215,6 @@ if __name__ == '__main__':
     print(f"Downloading the model to {output_folder}")
     download_files(links, output_folder, args.threads)
     
-    print('\n')
     # Validate the checksums
     validated = True
     for i in range(len(sha256)):
@@ -227,4 +226,6 @@ if __name__ == '__main__':
                 validated = False
     
     if validated:
-        print('[+] Validated checksums of all model files!')
+        print('[+] Validated checksums of all model files!')
+    else:
+        print('[-] Rerun the download-model.py with --clean flag')