Commit 8206430
Bug: Check whether model_desc.root is a dir or a zip before extraction (#719)
On bioimageio CI, the models are loaded from a folder and not a `zip`
file. So we need to check whether the `model_desc.root` is a *directory*
or a *zip file* before trying to extract it
[here](https://github.com/CAREamics/careamics/blob/d5062351b6c222177662e9329fbdce365509c5ef/src/careamics/model_io/bioimage/model_description.py#L326C5-L326C41):
```python
# extract the zip model and return the directory
model_dir = extract(model_desc.root)
```
## Changes Made
Checking the `model_desc.root` if it is a directory or a zip file:
```python
# get the model directory
if isinstance(model_desc.root, Path) and model_desc.root.is_dir():
model_dir: DirectoryPath = model_desc.root
else:
# extract the zip model
model_dir = extract(model_desc.root)
```
### Modified features or files
- `model_description.py`
## How has this been tested?
I tested it by running our bmz tests as well as running the bioimageio
collection script:
[scripts/check_compatibility_careamics.py](https://github.com/bioimage-io/collection/blob/main/scripts/check_compatibility_careamics.py)
## Related Issues
<!-- Link to any related issues or discussions. Use keywords like
"Fixes", "Resolves",
or "Closes" to link to issues automatically. -->
- Resolves #712
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>1 parent 73e2f3c commit 8206430
1 file changed
Lines changed: 7 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| 29 | + | |
29 | 30 | | |
30 | 31 | | |
31 | 32 | | |
| |||
322 | 323 | | |
323 | 324 | | |
324 | 325 | | |
325 | | - | |
326 | | - | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
327 | 332 | | |
328 | 333 | | |
329 | 334 | | |
| |||
0 commit comments