Skip to content

"Bad ZIP File" when downloading models #9

@brav0charlie

Description

@brav0charlie

Ever since the PHP 8.2 update, when I attempt to bring up the containers, they begin to download the models, but shortly after they're downloaded, an error is recorded in the "ocsr_socket_server_6543*.log" files (65433 and 65434):

Downloading trained model to /root/.data/DECIMER-V2
/root/.data/DECIMER-V2/DECIMER_HandDrawn_model.zip
... done downloading trained model!
Traceback (most recent call last):
  File "/var/www/app/app/Python/decimer_predictor_server.py", line 7, in <module>
    from DECIMER import predict_SMILES
  File "/usr/local/lib/python3.11/dist-packages/DECIMER/__init__.py", line 29, in <module>
    from .decimer import predict_SMILES
  File "/usr/local/lib/python3.11/dist-packages/DECIMER/decimer.py", line 71, in <module>
    tokenizer, DECIMER_V2, DECIMER_Hand_drawn = get_models(model_urls)
                                                ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/DECIMER/decimer.py", line 56, in get_models
    model_paths = utils.ensure_models(default_path=default_path, model_urls=model_urls)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/DECIMER/utils.py", line 93, in ensure_models
    config.download_trained_weights(model_url, default_path)
  File "/usr/local/lib/python3.11/dist-packages/DECIMER/config.py", line 419, in download_trained_weights
    with zipfile.ZipFile(model_path.as_posix(), "r") as zip_ref:
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/zipfile.py", line 1302, in __init__
    self._RealGetContents()
  File "/usr/lib/python3.11/zipfile.py", line 1369, in _RealGetContents
    raise BadZipFile("File is not a zip file")
zipfile.BadZipFile: File is not a zip file

If I open Bash in the container (docker exec -it --privileged decimer_app bash), I cannot find the /root/.data directory (ls /root/.data returns directory not found). Tried the same on the decimer_supervisor container, and the directory also doesn't appear to exist there either.

I've tried adding a volume to the docker-compose.yml file for (/home/decimer/models:/root/.data) on the containers so I could verify the files are actually downloading, and I see them on my file system when they download to that added volume, but the same error pops regardless of whether I'm using that added volume or not.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingquestionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions