Added a 'clean' flag to not resume download.
This commit is contained in:
parent
e17af59261
commit
8c590c2362
1 changed files with 2 additions and 1 deletions
|
@ -24,12 +24,13 @@ parser.add_argument('--branch', type=str, default='main', help='Name of the Git
|
|||
parser.add_argument('--threads', type=int, default=1, help='Number of files to download simultaneously.')
|
||||
parser.add_argument('--text-only', action='store_true', help='Only download text files (txt/json).')
|
||||
parser.add_argument('--output', type=str, default=None, help='The folder where the model should be saved.')
|
||||
parser.add_argument('--clean', action='store_true', help='Does not resume the previous download.')
|
||||
args = parser.parse_args()
|
||||
|
||||
def get_file(url, output_folder):
|
||||
filename = Path(url.rsplit('/', 1)[1])
|
||||
output_path = output_folder / filename
|
||||
if output_path.exists():
|
||||
if output_path.exists() and not args.clean:
|
||||
# Check if the file has already been downloaded completely
|
||||
r = requests.head(url)
|
||||
total_size = int(r.headers.get('content-length', 0))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue