keras icon indicating copy to clipboard operation
keras copied to clipboard

Keras fails to load TextVectorization layer from .keras file

Open harsha7addanki opened this issue 5 months ago • 1 comments

When downloading a model I trained on Kaggle using the .keras format it fails to load on my machine. I believe it is a codec error because the TextVectorization layer uses the utf-8 format, but the error message appears to be using the charmap codec in python. This is all just speculation though.

ValueError: A total of 2 objects could not be loaded. Example error message for object <TextVectorization name=text_vectorization, built=True>:

'charmap' codec can't decode byte 0x8d in position 8946: character maps to <undefined>

List of objects that could not be loaded:
[<TextVectorization name=text_vectorization, built=True>, <StringLookup name=string_lookup, built=False>]

In the notebook it was trained on, it loaded perfectly so I don't understand the reason why this failed to work.

My Machine: python version 3.10.5

 Name                    Version                   Build  Channel
_tflow_select             2.3.0                       mkl
abseil-cpp                20211102.0           hd77b12b_0
absl-py                   2.1.0           py310haa95532_0
aext-assistant            4.0.15          py310haa95532_jl4_0
aext-assistant-server     4.0.15          py310haa95532_0
aext-core                 4.0.15          py310haa95532_jl4_0
aext-core-server          4.0.15          py310haa95532_1
aext-panels               4.0.15          py310haa95532_0
aext-panels-server        4.0.15          py310haa95532_0
aext-share-notebook       4.0.15          py310haa95532_0
aext-share-notebook-server 4.0.15          py310haa95532_0
aext-shared               4.0.15          py310haa95532_0
aiohappyeyeballs          2.4.0           py310haa95532_0
aiohttp                   3.10.5          py310h827c3e9_0
aiosignal                 1.2.0              pyhd3eb1b0_0
anaconda-cloud-auth       0.5.1           py310haa95532_0
anaconda-toolbox          4.0.15          py310haa95532_0
annotated-types           0.6.0           py310haa95532_0
anyio                     4.2.0           py310haa95532_0
argon2-cffi               21.3.0             pyhd3eb1b0_0
argon2-cffi-bindings      21.2.0          py310h2bbff1b_0
asttokens                 2.0.5              pyhd3eb1b0_0
astunparse                1.6.3                      py_0
async-lru                 2.0.4           py310haa95532_0
async-timeout             4.0.3           py310haa95532_0
attrs                     23.1.0          py310haa95532_0
babel                     2.11.0          py310haa95532_0
beautifulsoup4            4.12.3          py310haa95532_0
blas                      1.0                         mkl
bleach                    4.1.0              pyhd3eb1b0_0
blinker                   1.6.2           py310haa95532_0
brotli-python             1.0.9           py310hd77b12b_8
bzip2                     1.0.8                h2bbff1b_6
c-ares                    1.19.1               h2bbff1b_0
ca-certificates           2024.9.24            haa95532_0
cachetools                5.3.3           py310haa95532_0
certifi                   2024.8.30       py310haa95532_0
cffi                      1.17.1          py310h827c3e9_0
charset-normalizer        3.3.2              pyhd3eb1b0_0
click                     8.1.7           py310haa95532_0
colorama                  0.4.6           py310haa95532_0
comm                      0.2.1           py310haa95532_0
cryptography              41.0.3          py310h3438e0d_0
debugpy                   1.6.7           py310hd77b12b_0
decorator                 5.1.1              pyhd3eb1b0_0
defusedxml                0.7.1              pyhd3eb1b0_0
exceptiongroup            1.2.0           py310haa95532_0
executing                 0.8.3              pyhd3eb1b0_0
flatbuffers               2.0.0                h6c2663c_0
frozenlist                1.4.0           py310h2bbff1b_0
gast                      0.4.0              pyhd3eb1b0_0
giflib                    5.2.1                h8cc25b3_3
google-auth               2.29.0          py310haa95532_0
google-auth-oauthlib      0.4.4              pyhd3eb1b0_0
google-pasta              0.2.0              pyhd3eb1b0_0
grpc-cpp                  1.48.2               hf108199_0
grpcio                    1.48.2          py310hf108199_0
h11                       0.14.0          py310haa95532_0
h5py                      3.11.0          py310hed405ee_0
hdf5                      1.12.1               h51c971a_3
httpcore                  1.0.2           py310haa95532_0
httpx                     0.27.0          py310haa95532_0
icc_rt                    2022.1.0             h6049295_2
icu                       58.2                 ha925a31_3
idna                      3.7             py310haa95532_0
importlib-metadata        7.0.1           py310haa95532_0
importlib_metadata        7.0.1                hd3eb1b0_0
intel-openmp              2023.1.0         h59b6b97_46320
ipykernel                 6.28.0          py310haa95532_0
ipython                   8.27.0          py310haa95532_0
jaraco.classes            3.2.1              pyhd3eb1b0_0
jedi                      0.19.1          py310haa95532_0
jinja2                    3.1.4           py310haa95532_0
jpeg                      9e                   h827c3e9_3
json5                     0.9.6              pyhd3eb1b0_0
jsonschema                4.19.2          py310haa95532_0
jsonschema-specifications 2023.7.1        py310haa95532_0
jupyter-lsp               2.2.0           py310haa95532_0
jupyter_client            8.6.0           py310haa95532_0
jupyter_core              5.7.2           py310haa95532_0
jupyter_events            0.10.0          py310haa95532_0
jupyter_server            2.14.1          py310haa95532_0
jupyter_server_terminals  0.4.4           py310haa95532_1
jupyterlab                4.2.5           py310haa95532_0
jupyterlab_pygments       0.1.2                      py_0
jupyterlab_server         2.27.3          py310haa95532_0
keras                     2.10.0          py310haa95532_0
keras-preprocessing       1.1.2              pyhd3eb1b0_0
keyring                   24.3.1          py310haa95532_0
libcurl                   8.9.1                h0416ee5_0
libffi                    3.4.4                hd77b12b_1
libpng                    1.6.39               h8cc25b3_0
libprotobuf               3.20.3               h23ce68f_0
libsodium                 1.0.18               h62dcd97_0
libssh2                   1.10.0               hcd4344a_2
markdown                  3.4.1           py310haa95532_0
markupsafe                2.1.3           py310h2bbff1b_0
matplotlib-inline         0.1.6           py310haa95532_0
mistune                   2.0.4           py310haa95532_0
mkl                       2023.1.0         h6b88ed4_46358
mkl-service               2.4.0           py310h2bbff1b_1
mkl_fft                   1.3.10          py310h827c3e9_0
mkl_random                1.2.7           py310hc64d2fc_0
more-itertools            10.3.0          py310haa95532_0
multidict                 6.0.4           py310h2bbff1b_0
nbclient                  0.8.0           py310haa95532_0
nbconvert                 7.10.0          py310haa95532_0
nbformat                  5.9.2           py310haa95532_0
nest-asyncio              1.6.0           py310haa95532_0
notebook                  7.2.2           py310haa95532_0
notebook-shim             0.2.3           py310haa95532_0
numpy                     1.26.4          py310h055cbcc_0
numpy-base                1.26.4          py310h65a83cf_0
oauthlib                  3.2.2           py310haa95532_0
openssl                   1.1.1w               h2bbff1b_0
opt_einsum                3.3.0              pyhd3eb1b0_1
overrides                 7.4.0           py310haa95532_0
packaging                 24.1            py310haa95532_0
pandocfilters             1.5.0              pyhd3eb1b0_0
parso                     0.8.3              pyhd3eb1b0_0
pip                       24.2            py310haa95532_0
pkce                      1.0.3           py310haa95532_0
platformdirs              3.10.0          py310haa95532_0
prometheus_client         0.14.1          py310haa95532_0
prompt-toolkit            3.0.43          py310haa95532_0
prompt_toolkit            3.0.43               hd3eb1b0_0
protobuf                  3.20.3          py310hd77b12b_0
psutil                    5.9.0           py310h2bbff1b_0
pure_eval                 0.2.2              pyhd3eb1b0_0
pyasn1                    0.4.8              pyhd3eb1b0_0
pyasn1-modules            0.2.8                      py_0
pybind11-abi              5                    hd3eb1b0_0
pycparser                 2.21               pyhd3eb1b0_0
pydantic                  2.8.2           py310haa95532_0
pydantic-core             2.20.1          py310hefb1915_0
pygments                  2.15.1          py310haa95532_1
pyjwt                     2.8.0           py310haa95532_0
pyopenssl                 23.2.0          py310haa95532_0
pysocks                   1.7.1           py310haa95532_0
python                    3.10.13              h966fe2a_0
python-dateutil           2.9.0post0      py310haa95532_2
python-dotenv             0.21.0          py310haa95532_0
python-fastjsonschema     2.16.2          py310haa95532_0
python-flatbuffers        24.3.25         py310haa95532_0
python-json-logger        2.0.7           py310haa95532_0
pytz                      2024.1          py310haa95532_0
pywin32                   305             py310h2bbff1b_0
pywin32-ctypes            0.2.2           py310haa95532_0
pywinpty                  2.0.10          py310h5da7b33_0
pyyaml                    6.0.1           py310h2bbff1b_0
pyzmq                     25.1.2          py310hd77b12b_0
re2                       2022.04.01           hd77b12b_0
referencing               0.30.2          py310haa95532_0
requests                  2.32.3          py310haa95532_0
requests-oauthlib         2.0.0           py310haa95532_0
rfc3339-validator         0.1.4           py310haa95532_0
rfc3986-validator         0.1.1           py310haa95532_0
rpds-py                   0.10.6          py310h062c2fa_0
rsa                       4.7.2              pyhd3eb1b0_1
scipy                     1.13.1          py310h8640f81_0
semver                    3.0.2           py310haa95532_0
send2trash                1.8.2           py310haa95532_0
setuptools                75.1.0          py310haa95532_0
six                       1.16.0             pyhd3eb1b0_1
snappy                    1.2.1                hcdb6601_0
sniffio                   1.3.0           py310haa95532_0
soupsieve                 2.5             py310haa95532_0
sqlite                    3.45.3               h2bbff1b_0
stack_data                0.2.0              pyhd3eb1b0_0
tbb                       2021.8.0             h59b6b97_0
tensorboard               2.10.0          py310haa95532_0
tensorboard-data-server   0.6.1           py310haa95532_0
tensorboard-plugin-wit    1.8.1           py310haa95532_0
tensorflow                2.10.0          mkl_py310hd99672f_0
tensorflow-base           2.10.0          mkl_py310h6a7f48e_0
tensorflow-estimator      2.10.0          py310haa95532_0
termcolor                 2.1.0           py310haa95532_0
terminado                 0.17.1          py310haa95532_0
tinycss2                  1.2.1           py310haa95532_0
tk                        8.6.14               h0416ee5_0
tomli                     2.0.1           py310haa95532_0
tornado                   6.4.1           py310h827c3e9_0
traitlets                 5.14.3          py310haa95532_0
typing-extensions         4.11.0          py310haa95532_0
typing_extensions         4.11.0          py310haa95532_0
tzdata                    2024a                h04d1e81_0
urllib3                   2.2.3           py310haa95532_0
vc                        14.40                h2eaa2aa_1
vs2015_runtime            14.40.33807          h98bb1dd_1
wcwidth                   0.2.5              pyhd3eb1b0_0
webencodings              0.5.1           py310haa95532_1
websocket-client          1.8.0           py310haa95532_0
werkzeug                  3.0.3           py310haa95532_0
wheel                     0.44.0          py310haa95532_0
win_inet_pton             1.1.0           py310haa95532_0
winpty                    0.4.3                         4
wrapt                     1.14.1          py310h2bbff1b_0
xz                        5.4.6                h8cc25b3_1
yaml                      0.2.5                he774522_0
yarl                      1.11.0          py310h827c3e9_0
zeromq                    4.3.5                hd77b12b_0
zipp                      3.17.0          py310haa95532_0
zlib                      1.2.13               h8cc25b3_1

On kaggle I used the 2024-8-21 docker container

harsha7addanki avatar Oct 01 '24 22:10 harsha7addanki