minimaxir / gpt-2-cloud-run

Text-generation API via GPT-2 for Cloud Run

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Tensorflow.contrib module error when running docker file

addadda023 opened this issue · comments

Hi Max,
I am following the instructions in the readme file. Once I built the image, I tried to run the image locally, but got the following error. It seems tensorflow.contrib module is discontinued in version 2.0. I noticed in the docker file you do not specify the version of tensorflow so it might have auto installed 2.0. The TF version in my colab notebook was 1.15 when I trained the model, so I will try to force 1.15 in the dockerfile.

docker run -p 8080:8080 --memory="2g" --cpus="1" gpt2

Traceback (most recent call last):
  File "app.py", line 3, in <module>
    import gpt_2_simple as gpt2
  File "/usr/local/lib/python3.7/site-packages/gpt_2_simple/__init__.py", line 1, in <module>
    from .gpt_2 import *
  File "/usr/local/lib/python3.7/site-packages/gpt_2_simple/gpt_2.py", line 23, in <module>
    from gpt_2_simple.src import model, sample, encoder, memory_saving_gradients
  File "/usr/local/lib/python3.7/site-packages/gpt_2_simple/src/memory_saving_gradients.py", line 5, in <module>
    import tensorflow.contrib.graph_editor as ge
ModuleNotFoundError: No module named 'tensorflow.contrib'

Solved by updating the dockerfile to pip install tensorflow==1.15