Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

19 feature request host model weights on zenodo #38

Merged
merged 7 commits into from
Mar 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -130,3 +130,4 @@ dmypy.json
.vscode
poetry.lock
.DS_Store
brainles_aurora/model_weights/*
1 change: 1 addition & 0 deletions brainles_aurora/inferer/inferer.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,4 +221,5 @@ def infer(
self.data_handler.save_as_nifti(
postproc_data=out, output_file_mapping=output_file_mapping
)
logger.info(f"{' Finished inference run ':=^80}")
return out
5 changes: 2 additions & 3 deletions brainles_aurora/inferer/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def __init__(
self.lib_path: str = Path(os.path.dirname(os.path.abspath(__file__)))
self.model_weights_folder = self.lib_path.parent / "model_weights"
if not self.model_weights_folder.exists():
download_model_weights(target_folder=str(self.lib_path.parent))
download_model_weights(target_folder=str(self.model_weights_folder))

def load_model(
self, inference_mode: InferenceMode, num_input_modalities: int
Expand Down Expand Up @@ -85,8 +85,7 @@ def _load_model(self, num_input_modalities: int) -> torch.nn.Module:
# load weights
weights_path = os.path.join(
self.model_weights_folder,
self.inference_mode,
f"{self.config.model_selection}.tar",
f"{self.inference_mode}_{self.config.model_selection}.tar",
)
if not os.path.exists(weights_path):
raise NotImplementedError(
Expand Down
Loading
Loading