Skip to content

Commit

Permalink
code quality
Browse files Browse the repository at this point in the history
  • Loading branch information
KuuCi committed Apr 19, 2024
1 parent eb2afbb commit 05c2461
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
8 changes: 4 additions & 4 deletions llmfoundry/utils/config_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ def log_config(cfg: DictConfig) -> None:

if 'mlflow' in cfg.get('loggers', {}):
if not mlflow:
raise ImportError("MLflow is required but not installed.")
raise ImportError('MLflow is required but not installed.')
if mlflow.active_run():
mlflow.log_params(params=om.to_container(cfg, resolve=True))
log_dataset_uri(cfg)
Expand Down Expand Up @@ -212,7 +212,7 @@ def parse_source_dataset(cfg: DictConfig):
{}).get('hf_name')
backend, _, _ = parse_uri(hf_path)
if backend:
hf_path = f'{hf_path.rstrip("/")}/{split}' if split else hf_path
hf_path = f'{hf_path.rstrip('/')}/{split}' if split else hf_path
data_paths.add((backend, hf_path, data_split))
else:
data_paths.add(('hf', hf_path, data_split))
Expand All @@ -222,7 +222,7 @@ def parse_source_dataset(cfg: DictConfig):
remote_path = cfg.get(f'{data_split}_loader',
{}).get('dataset', {}).get('remote', None)
backend, _, _ = parse_uri(remote_path)
remote_path = f'{remote_path.rstrip("/")}/{split}/' if split else remote_path
remote_path = f'{remote_path.rstrip('/')}/{split}/' if split else remote_path
data_paths.add((backend, remote_path, data_split))
# check for local path
elif cfg.get(f'{data_split}_loader', {}).get('dataset',
Expand All @@ -239,7 +239,7 @@ def parse_source_dataset(cfg: DictConfig):
def log_dataset_uri(cfg: DictConfig) -> mlflow.data.meta_dataset.MetaDataset:
"""Logs dataset tracking information to MLflow."""
if mlflow is None:
log.warning("MLflow is not installed. Skipping dataset logging.")
log.warning('MLflow is not installed. Skipping dataset logging.')
return None
# Figure out which data source to use
data_paths = parse_source_dataset(cfg)
Expand Down
3 changes: 1 addition & 2 deletions tests/utils/test_mlflow_logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@


def create_config(**kwargs):
"""Helper function to create OmegaConf configurations based on input
kwargs."""
"""Helper function to create OmegaConf configurations."""
return OmegaConf.create(kwargs)


Expand Down

0 comments on commit 05c2461

Please sign in to comment.