Skip to content

Cannot access the pretrained models on PCam #955

@ceelestin

Description

@ceelestin

The models that were pretrained on PCam cannot be accessed as of now. This snippet of code (that are the examples lines given in lines 119 and 120 of the file tiatoolbox.models.architecture.__init__/py):

# get resnet34 pretrained on PCam dataset by TIA team
model = get_pretrained_model(pretrained_model='resnet34-pcam')

leaves the following error:

---------------------------------------------------------------------------
HTTPError                                 Traceback (most recent call last)
File /home/ceve/Documents/benchmark_pcam/pretrain_tia.py:3
      1 # %%
      2 # Get resnet34 pretrained on PCam dataset by TIA team
----> 3 model = get_pretrained_model(pretrained_model='resnet34-pcam')
      6 ###############################################################################

File ~/miniconda3/envs/tiatoolbox-env/lib/python3.10/site-packages/tiatoolbox/models/architecture/__init__.py:142, in get_pretrained_model(pretrained_model, pretrained_weights, overwrite)
    139     model.preproc_func = predefined_preproc_func(info["dataset"])
    141 if pretrained_weights is None:
--> 142     pretrained_weights = fetch_pretrained_weights(
    143         pretrained_model,
    144         overwrite=overwrite,
    145     )
    147 # ! assume to be saved in single GPU mode
    148 # always load on to the CPU
    149 saved_state_dict = torch.load(pretrained_weights, map_location="cpu")

File ~/miniconda3/envs/tiatoolbox-env/lib/python3.10/site-packages/tiatoolbox/models/architecture/__init__.py:58, in fetch_pretrained_weights(model_name, save_path, overwrite)
     55     file_name = info["url"].split("/")[-1]
     56     save_path = rcParam["TIATOOLBOX_HOME"] / "models" / file_name
---> 58 download_data(info["url"], save_path=save_path, overwrite=overwrite)
     59 return save_path

File ~/miniconda3/envs/tiatoolbox-env/lib/python3.10/site-packages/tiatoolbox/utils/misc.py:722, in download_data(url, save_path, save_dir, overwrite, unzip)
    720 response = requests.get(url, stream=True, timeout=5)
    721 # Raise an exception for status codes != 200
--> 722 response.raise_for_status()
    723 # Write the file in blocks of 1024 bytes to avoid running out of memory
    725 with tempfile.NamedTemporaryFile(mode="wb", delete=False) as templ_file:

File ~/miniconda3/envs/tiatoolbox-env/lib/python3.10/site-packages/requests/models.py:1024, in Response.raise_for_status(self)
   1019     http_error_msg = (
   1020         f"{self.status_code} Server Error: {reason} for url: {self.url}"
   1021     )
   1023 if http_error_msg:
-> 1024     raise HTTPError(http_error_msg, response=self)

HTTPError: 503 Server Error: Service Unavailable for url: https://tiatoolbox.dcs.warwick.ac.uk/models/pc/resnet34-pcam.pth

In fact, the url dispensed at the end of the error displays:

Service Unavailable. The server is temporarily unable to service your request due to maintenance downtime or capacity problems. Please try again later.

and so do the urls associated to the other pretrained models.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions