Skip to content
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

Pip install from requirements.txt #7

Merged
merged 1 commit into from
Aug 13, 2018
Merged

Pip install from requirements.txt #7

merged 1 commit into from
Aug 13, 2018

Conversation

MLnick
Copy link
Contributor

@MLnick MLnick commented Jul 30, 2018

Update Dockerfile to install dependencies from requirements.txt. Specify relevant dependency versions.

@xwu0226
Copy link
Member

xwu0226 commented Jul 30, 2018

@MLnick I checked out the branch pip-dep and try it out. I still get the error below:

  File "/opt/conda/lib/python3.6/site-packages/flask/app.py", line 1813, in full_dispatch_request
    rv = self.dispatch_request()
  File "/opt/conda/lib/python3.6/site-packages/flask/app.py", line 1799, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/opt/conda/lib/python3.6/site-packages/flask_restplus/api.py", line 319, in wrapper
    resp = resource(*args, **kwargs)
  File "/opt/conda/lib/python3.6/site-packages/flask/views.py", line 88, in view
    return self.dispatch_request(*args, **kwargs)
  File "/opt/conda/lib/python3.6/site-packages/flask_restplus/resource.py", line 44, in dispatch_request
    resp = meth(*args, **kwargs)
  File "/opt/conda/lib/python3.6/site-packages/flask_restplus/marshalling.py", line 136, in wrapper
    resp = f(*args, **kwargs)
  File "/workspace/api/model.py", line 56, in post
    generated_text = self.model_wrapper.predict(seed_text, gen_chars)
  File "/workspace/core/backend.py", line 84, in predict
    preds = self.model.predict(x, verbose=0)[0]
  File "/opt/conda/lib/python3.6/site-packages/keras/models.py", line 1025, in predict
    steps=steps)
  File "/opt/conda/lib/python3.6/site-packages/keras/engine/training.py", line 1832, in predict
    self._make_predict_function()
  File "/opt/conda/lib/python3.6/site-packages/keras/engine/training.py", line 1029, in _make_predict_function
    **kwargs)
  File "/opt/conda/lib/python3.6/site-packages/keras/backend/tensorflow_backend.py", line 2502, in function
    return Function(inputs, outputs, updates=updates, **kwargs)
  File "/opt/conda/lib/python3.6/site-packages/keras/backend/tensorflow_backend.py", line 2445, in __init__
    with tf.control_dependencies(self.outputs):
  File "/opt/conda/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 5027, in control_dependencies
    return get_default_graph().control_dependencies(control_inputs)
  File "/opt/conda/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 4631, in control_dependencies
    c = self.as_graph_element(c)
  File "/opt/conda/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 3590, in as_graph_element
    return self._as_graph_element_locked(obj, allow_tensor, allow_operation)
  File "/opt/conda/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 3669, in _as_graph_element_locked
    raise ValueError("Tensor %s is not an element of this graph." % obj)
ValueError: Tensor Tensor("activation_1/Softmax:0", shape=(?, 61), dtype=float32) is not an element of this graph.```

What did I miss ?

@MLnick
Copy link
Contributor Author

MLnick commented Jul 30, 2018 via email

@xwu0226
Copy link
Member

xwu0226 commented Jul 30, 2018

I mistake it with issue #4 . Should I combine these 2 PRs to get it work?

@MLnick
Copy link
Contributor Author

MLnick commented Jul 30, 2018

Right, the fix in #6 will also need to be applied in order for model/predict to work. We can merge that first and come back to this one.

pip install flask-restplus
COPY requirements.txt /workspace
RUN pip install --upgrade pip
RUN pip install -r requirements.txt
Copy link

@bdwyer2 bdwyer2 Jul 30, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we merge this into 1 command to reduce the number of layers?

@MLnick
Copy link
Contributor Author

MLnick commented Jul 30, 2018 via email

@bdwyer2
Copy link

bdwyer2 commented Jul 30, 2018

@MLnick I see

@MLnick
Copy link
Contributor Author

MLnick commented Jul 30, 2018

@bdwyer2 changing the requirements file and rebuilding does actually trigger a new build of the layer due to the COPY

@MLnick
Copy link
Contributor Author

MLnick commented Aug 7, 2018

Any other comments on this?

@MLnick MLnick requested a review from djalova August 8, 2018 07:24
@djalova
Copy link

djalova commented Aug 10, 2018

I tested this with the fix in #6 and it works for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants