kevinjohncutler / omnipose

Omnipose: a high-precision solution for morphology-independent cell segmentation
https://omnipose.readthedocs.io
Other
85 stars 29 forks source link

can not download model #79

Closed romainGuiet closed 2 months ago

romainGuiet commented 4 months ago

Dear omnipose team,

When running :

python -m omnipose --dir DIR --pretrained_model bact_fluor_omni --diameter 50.0 --omni --cluster --save_tif --no_npy --use_gpu --verbose

it tries to download the model but fails :

2024-02-19 09:51:31,926 [INFO ] [io.py      60   logger_setup      ]    WRITING LOG OUTPUT TO C:\Users\guiet\.cellpose\run.log
log file C:\Users\guiet\.cellpose\run.log
2024-02-19 09:51:32,163 [INFO ] [core.py    74   _use_gpu_torch    ]    ** TORCH GPU version installed and working. **
2024-02-19 09:51:32,163 [INFO ] [core.py    85   assign_device     ]    >>>> using GPU
2024-02-19 09:51:32,163 [INFO ] [__main__.py 142  main              ]   This pretrained model uses 2 channels, setting nchan=2
2024-02-19 09:51:32,163 [INFO ] [__main__.py 147  main              ]   This model uses boundary field, setting nclasses=3.
2024-02-19 09:51:32,168 [INFO ] [__main__.py 213  main              ]   running omnipose on 1 image(s) using 2 channel(s).
2024-02-19 09:51:32,168 [INFO ] [__main__.py 217  main              ]   channel(s) to seg: MONO and  NONE
2024-02-19 09:51:32,168 [INFO ] [__main__.py 220  main              ]   omni is ON, cluster is True
2024-02-19 09:51:32,168 [INFO ] [models.py  61   cache_model_path  ]    Downloading: "https://www.cellpose.org/models/bact_fluor_omnitorch_0" to C:\Users\guiet\.cellpose\models\bact_fluor_omnitorch_0

https://www.cellpose.org/models/bact_fluor_omnitorch_0 C:\Users\guiet\.cellpose\models\bact_fluor_omnitorch_0
Traceback (most recent call last):
  File "D:\conda\conda-envs\omnipose-106_2\lib\runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "D:\conda\conda-envs\omnipose-106_2\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "C:\Users\guiet\omnipose\omnipose\__main__.py", line 12, in <module>
    main()
  File "C:\Users\guiet\omnipose\omnipose\__main__.py", line 9, in main
    cellpose_omni_main(args)
  File "C:\Users\guiet\omnipose\cellpose_omni\__main__.py", line 236, in main
    cpmodel_path = models.model_path(args.pretrained_model, 0, True)
  File "C:\Users\guiet\omnipose\cellpose_omni\models.py", line 49, in model_path
    return cache_model_path(basename)
  File "C:\Users\guiet\omnipose\cellpose_omni\models.py", line 63, in cache_model_path
    utils.download_url_to_file(url, cached_file, progress=True)
  File "C:\Users\guiet\omnipose\cellpose_omni\utils.py", line 70, in download_url_to_file
    u = urlopen(url)
  File "D:\conda\conda-envs\omnipose-106_2\lib\urllib\request.py", line 214, in urlopen
    return opener.open(url, data, timeout)
  File "D:\conda\conda-envs\omnipose-106_2\lib\urllib\request.py", line 523, in open
    response = meth(req, response)
  File "D:\conda\conda-envs\omnipose-106_2\lib\urllib\request.py", line 632, in http_response
    response = self.parent.error(
  File "D:\conda\conda-envs\omnipose-106_2\lib\urllib\request.py", line 561, in error
    return self._call_chain(*args)
  File "D:\conda\conda-envs\omnipose-106_2\lib\urllib\request.py", line 494, in _call_chain
    result = func(*args)
  File "D:\conda\conda-envs\omnipose-106_2\lib\urllib\request.py", line 641, in http_error_default
    raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 500: INTERNAL SERVER ERROR

I just tried and I could download https://www.cellpose.org/models/cyto_0 without an issue ...

Best

Romain

CellKai commented 4 months ago

I have the same issue when using the GUI version of omnipose. For several of the models, the download is failing, e.g.

2024-02-21 16:40:20,333 [INFO] Downloading: "https://www.cellpose.org/models/bact_phase_omnitorch_0" to C:\Users\schlda00\.cellpose\models\bact_phase_omnitorch_0

https://www.cellpose.org/models/bact_phase_omnitorch_0 C:\Users\schlda00\.cellpose\models\bact_phase_omnitorch_0
ERROR: HTTP Error 500: INTERNAL SERVER ERROR

Thank you for your help! Best, Kai

ElpadoCan commented 4 months ago

Same issue here

2024-02-22 13:52:48,350 [INFO ] [models.py  61   cache_model_path  ]    Downloading: "https://www.cellpose.org/models/bact_phase_omnitorch_0" to C:\Users\elpad\.cellpose\models\bact_phase_omnitorch_0

https://www.cellpose.org/models/bact_phase_omnitorch_0 C:\Users\elpad\.cellpose\models\bact_phase_omnitorch_0
ERROR: HTTP Error 500: INTERNAL SERVER ERROR
romainGuiet commented 4 months ago

WORKAROUND : Models can be found in this repository and manually added to C:\Users\**USERNAME**\.cellpose\models or linux/mac equivalent folder. Cheers R

ElpadoCan commented 4 months ago

Thanks @romainGuiet! I also wanted to upload them somewhere but I recently formatted all of my computers and I had no trace of the models anywhere 🤦

phisanti commented 4 months ago

Hi, I have just tried to download the bacterial model and got the following error:

models.CellposeModel(pretrained_model='/content/models/bact_phase_omnitorch_0')
model = models.CellposeModel(gpu=use_GPU)

---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
[<ipython-input-10-6dec1cfe5f2f>](https://localhost:8080/#) in <cell line: 2>()
      1 #model_name = 'bact_phase_omni'
----> 2 models.CellposeModel(pretrained_model='/content/models/bact_phase_omnitorch_0')
      3 
      4 model = models.CellposeModel(gpu=use_GPU)

3 frames
[/usr/local/lib/python3.10/dist-packages/torch/serialization.py](https://localhost:8080/#) in __init__(self, name_or_buffer)
    445 class _open_zipfile_reader(_opener):
    446     def __init__(self, name_or_buffer) -> None:
--> 447         super().__init__(torch._C.PyTorchFileReader(name_or_buffer))
    448 
    449 

RuntimeError: PytorchStreamReader failed reading zip archive: failed finding central directory

Does anyone know how to solve it?

romainGuiet commented 4 months ago

Hi @phisanti ,

Does anyone know how to solve it?

You can use the workaround : https://github.com/kevinjohncutler/omnipose/issues/79#issuecomment-1966104372

kevinjohncutler commented 3 months ago

Sorry I did not see this everyone! Carsen took the omnipose models off the Cellpose server to save space. She will put them back on for a time while I convert to using the models hosted on OSF. Thank you very much @romainGuiet for helping out.

ElpadoCan commented 3 months ago

Hi all, does anybody have the size_cyto2_omnitorch_0.npy model? It's also missing on the cellpose website and on the repository made by @romainGuiet. Thank you very much!

romainGuiet commented 3 months ago

Hi @ElpadoCan ,

does anybody have the size_cyto2_omnitorch_0.npy model?

You're lucky 🥳, I found it in my model folder, please unzip this size_cyto2_omnitorch_0.zip

It's also missing on the cellpose website and on the repository made by @romainGuiet.

I didn't create the repository 😬 I just managed to find it in the documentation, it was all @kevinjohncutler job! Indeed it would be worthy to add it there too...

Cheers,

R

ElpadoCan commented 3 months ago

Nice @romainGuiet thank you very much! It's my lucky day 😎

kevinjohncutler commented 2 months ago

Carsen and I figured out a way to redirect the old download requests, so this issue should be solved for all prior versions including the one used for the cellprofiler plugin.