HUB setup (#108)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
This commit is contained in:
parent
c6eb6720de
commit
2bc9a5c87e
16 changed files with 631 additions and 122 deletions
|
|
@ -249,26 +249,6 @@ def threaded(func):
|
|||
return wrapper
|
||||
|
||||
|
||||
def get_settings(file=USER_CONFIG_DIR / 'settings.yaml'):
|
||||
"""
|
||||
Function that loads a global settings YAML, or creates it and populates it with default values if it does not exist.
|
||||
|
||||
If the datasets or weights directories are set to None, the current working directory will be used.
|
||||
The 'sync' setting determines whether analytics will be synced to help with YOLO development.
|
||||
"""
|
||||
from ultralytics.yolo.utils.torch_utils import torch_distributed_zero_first
|
||||
|
||||
with torch_distributed_zero_first(RANK):
|
||||
if not file.exists():
|
||||
settings = {
|
||||
'datasets_dir': None, # default datasets directory. If None, current working directory is used.
|
||||
'weights_dir': None, # default weights directory. If None, current working directory is used.
|
||||
'sync': True} # sync analytics to help with YOLO development
|
||||
yaml_save(file, settings)
|
||||
|
||||
return yaml_load(file)
|
||||
|
||||
|
||||
def yaml_save(file='data.yaml', data=None):
|
||||
"""
|
||||
Save YAML data to a file.
|
||||
|
|
@ -305,6 +285,26 @@ def yaml_load(file='data.yaml'):
|
|||
return {**yaml.safe_load(f), 'yaml_file': file}
|
||||
|
||||
|
||||
def get_settings(file=USER_CONFIG_DIR / 'settings.yaml'):
|
||||
"""
|
||||
Function that loads a global settings YAML, or creates it and populates it with default values if it does not exist.
|
||||
|
||||
If the datasets or weights directories are set to None, the current working directory will be used.
|
||||
The 'sync' setting determines whether analytics will be synced to help with YOLO development.
|
||||
"""
|
||||
from ultralytics.yolo.utils.torch_utils import torch_distributed_zero_first
|
||||
|
||||
with torch_distributed_zero_first(RANK):
|
||||
if not file.exists():
|
||||
settings = {
|
||||
'datasets_dir': None, # default datasets directory. If None, current working directory is used.
|
||||
'weights_dir': None, # default weights directory. If None, current working directory is used.
|
||||
'sync': True} # sync analytics to help with YOLO development
|
||||
yaml_save(file, settings)
|
||||
|
||||
return yaml_load(file)
|
||||
|
||||
|
||||
# Run below code on utils init -----------------------------------------------------------------------------------------
|
||||
|
||||
# Set logger
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue