-
Notifications
You must be signed in to change notification settings - Fork 211
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ValueError: A KerasTensor cannot be used as input to a TensorFlow function. #356
Comments
Hi, I've never seen that one before, it might be caused by some version mismatch. Could you please give me some more information (version of tensorflow, calamari, python, maybe the whole stack trace that is printed after the exception is raised)? |
Sure, so I installed calamari with Pip as suggested in the documentation.
Whole Stack trace:
|
Thanks! I've not tested it extensively but it seems that in order to work with tensorflow>2.14 we need some changes in our code. Unfortunately, I don't have the time at the moment to fix this. You could either try to install tensorflow 2.14 or use the current calamari 2.2.2 release (which is fixed to tensorflow < 2.7). There might be some problems with these older versions of tensorflow not being available for more recent versions of python. In this case, I would start from a conda environment with python 3.7 or 3.8, install tensorflow < 2.7 and then calamari 2.2.2. |
Thank you for testing it and answering so quickly! Two questions here:
Haven't tried out the conda approach yet, will do so tomorrow. |
|
On 24/05/15 02:04PM, Andreas Büttner wrote:
1. The problem is that the python version and environment determines which version of tensorflow is available. If there is no tensorflow < 2.7 available, pip checks older versions of calamari and finds that calamari 1.0.6 is the last version that has no version requirement set for tensorflow.
You can yank those older releases from pypi. They can then still be
installed explicitly but they won't be considered by pip per default.
|
@andbue Could you share a working setup code for a docker image or conda environment with the latest calamari version?
Error message when running any calamari-train command:
|
Looks like you're almost there! The error is about the protobuf version not being able to load the TensorBoard files that have been created with an older version of protobuf. I'd try to downgrade as indicated by the error message: If this does not work: Here is a Docker file that did it for me some time ago (installs the current master of this repo): FROM nvidia/cuda:11.5.1-cudnn8-runtime-ubuntu18.04
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && \
apt-get install -y --no-install-recommends software-properties-common && \
add-apt-repository -y ppa:ubuntu-toolchain-r/ppa && \
apt-get purge -y --auto-remove software-properties-common && \
apt-get install -y --no-install-recommends build-essential && \
apt-get install -y --no-install-recommends python3.7 python3.7-dev python3-pip python3-setuptools python3-wheel python3-distutils && \
apt clean && \
python3.7 -m pip --no-cache-dir install --upgrade pip && \
python3.7 -m pip --no-cache-dir install https://github.com/Calamari-OCR/calamari/tarball/master && \
apt-get purge -y --auto-remove build-essential && \
rm -rf /var/lib/apt/lists/*
|
It is working now 🥳 🎉 Additionally to the protobuf I also had to reinstall
Thanks for the help! |
Thank you! I copied that in my own notebook https://github.com/andbue/calamari_demo – it seems to work, but GPU support of tensorflow 2.6 depends on CUDA 11 which is again a pain to install on colab. Training from scratch is working with python 3.8, but loading the old models from the calamari_models repo produces the good old "bad marshal data" error. With python 3.7, they are loading just fine. Great to have a working demo for colab again! |
Awesome! Thanks for sharing your notebook, will be really helpful for training my model! |
Hi!
I am trying to train my own model with calamari. However when I run the training command
calamari-train --dataset PAGEXML --files images/*.png
I get the following Error:
I would really appreciate some help here as I have no clue what is causing this error or what I need to do differently. Thanks!
The text was updated successfully, but these errors were encountered: