[BUG] Size model not downloaded when using cwd as model path
Describe the bug
If the CELLPOSE_LOCAL_MODELS_PATH is set to the current working directory (cwd), then the model is downloaded properly but the size model fails to download and leads to a FileNotFoundError. This can be a problem in a Nextflow environment where staging happens locally.
Note that this problem occurs whether or not the model is downloaded, but the download step for the CellposeModel does execute properly, just not the SizeModel.
This is due to the os.path.exists(model_type) line here, which only checks the cwd and thus evaluates to True, skipping the caching for the size file in the else clause.
To Reproduce
import os
from pathlib import Path
# Set path to cwd to replicate Nextflow work dir
os.environ["CELLPOSE_LOCAL_MODELS_PATH"] = str(Path.cwd())
from cellpose import models
cp_model = models.Cellpose(model_type="cyto3")
Probably need to add another check there for whether the associated size npy file exists, or you may prefer another way!