ultralytics 8.0.82 docs updates and fixes (#2098)
Co-authored-by: Ayush Chaurasia <ayush.chaurarsia@gmail.com> Co-authored-by: Aurelio Losquiño Muñoz <38859113+aurelm95@users.noreply.github.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Paula Derrenger <107626595+pderrenger@users.noreply.github.com> Co-authored-by: Laughing <61612323+Laughing-q@users.noreply.github.com>
This commit is contained in:
parent
a38f227672
commit
55a03ad85f
15 changed files with 174 additions and 50 deletions
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
import os
|
||||
import platform
|
||||
import shutil
|
||||
import sys
|
||||
import threading
|
||||
import time
|
||||
|
|
@ -21,28 +20,6 @@ HELP_MSG = 'If this issue persists please visit https://github.com/ultralytics/h
|
|||
HUB_API_ROOT = os.environ.get('ULTRALYTICS_HUB_API', 'https://api.ultralytics.com')
|
||||
|
||||
|
||||
def check_dataset_disk_space(url='https://ultralytics.com/assets/coco128.zip', sf=2.0):
|
||||
"""
|
||||
Check if there is sufficient disk space to download and store a dataset.
|
||||
|
||||
Args:
|
||||
url (str, optional): The URL to the dataset file. Defaults to 'https://ultralytics.com/assets/coco128.zip'.
|
||||
sf (float, optional): Safety factor, the multiplier for the required free space. Defaults to 2.0.
|
||||
|
||||
Returns:
|
||||
(bool): True if there is sufficient disk space, False otherwise.
|
||||
"""
|
||||
gib = 1 << 30 # bytes per GiB
|
||||
data = int(requests.head(url).headers['Content-Length']) / gib # dataset size (GB)
|
||||
total, used, free = (x / gib for x in shutil.disk_usage('/')) # bytes
|
||||
LOGGER.info(f'{PREFIX}{data:.3f} GB dataset, {free:.1f}/{total:.1f} GB free disk space')
|
||||
if data * sf < free:
|
||||
return True # sufficient space
|
||||
LOGGER.warning(f'{PREFIX}WARNING: Insufficient free disk space {free:.1f} GB < {data * sf:.3f} GB required, '
|
||||
f'training cancelled ❌. Please free {data * sf - free:.1f} GB additional disk space and try again.')
|
||||
return False # insufficient space
|
||||
|
||||
|
||||
def request_with_credentials(url: str) -> any:
|
||||
"""
|
||||
Make an AJAX request with cookies attached in a Google Colab environment.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue