open_clip icon indicating copy to clipboard operation
open_clip copied to clipboard

Add checksum verification for pretrained model weights downloaded from mlfoundations github org

Open fabito opened this issue 3 years ago • 0 comments

Fixes #143

Tests output

$ PYTHONPATH=src python -m pytest tests

==================================================================================== test session starts =====================================================================================
platform linux -- Python 3.8.10, pytest-7.0.1, pluggy-1.0.0
rootdir: /home/fabio/workspaces/oss/open_clip
plugins: forked-1.4.0, xdist-2.5.0
collected 7 items                                                                                                                                                                            

tests/test_download_pretrained.py ......                                                                                                                                               [ 85%]
tests/test_simple.py .                                                                                                                                                                 [100%]

====================================================================================== warnings summary ======================================================================================
tests/test_download_pretrained.py::DownloadPretrainedTests::test_download_pretrained_from_openaipublic_corrupted_cache
  /home/fabio/workspaces/oss/open_clip/src/open_clip/pretrained.py:148: UserWarning: /tmp/tmpa9sx2lap/RN50.pt exists, but the SHA256 checksum does not match; re-downloading the file
    warnings.warn(f"{download_target} exists, but the SHA256 checksum does not match; re-downloading the file")

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
=============================================================================== 7 passed, 1 warning in 10.21s ================================================================================

fabito avatar Aug 09 '22 10:08 fabito