Skip to content

Commit

Permalink
Merge branch 'main' into fix-registry-mixin-docstring
Browse files Browse the repository at this point in the history
  • Loading branch information
rahul-tuli authored Feb 2, 2024
2 parents fa271b8 + 6e0d12b commit 7d2aec4
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/sparsezoo/model/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import logging
import os
import re
from pathlib import Path
from typing import Any, Dict, Generator, List, Optional, Tuple, Union

import numpy
Expand Down Expand Up @@ -88,6 +89,7 @@ def __init__(self, source: str, download_path: Optional[str] = None):
_setup_args = self.initialize_model_from_stub(stub=self.source)
files, path, url, validation_results, compressed_size = _setup_args
if download_path is not None:
download_path = str(Path(download_path).expanduser().resolve())
path = download_path # overwrite cache path with user input
else:
# initializing the model from the path
Expand Down Expand Up @@ -703,23 +705,23 @@ def _download(
)
):
file.download(destination_path=directory_path)
return True
validations = True
else:
_LOGGER.warning(
f"Failed to download file {file.name}. The url of the file is None."
)
return False
validations = False

elif isinstance(file, Recipes):
validations = (
validations = all(
self._download(_file, directory_path) for _file in file.recipes
)

else:
validations = (
validations = all(
self._download(_file, directory_path) for _file in file.values()
)
return all(validations)
return validations

def _sample_outputs_list_to_dict(
self,
Expand Down

0 comments on commit 7d2aec4

Please sign in to comment.