gpt-2 使用Docker build / run测试时出错

wwwo4jvm  于 10个月前  发布在  Docker
关注(0)|答案(1)|浏览(181)

我在使用Docker build / run进行测试时遇到了一个错误,我不知道如何修复它。有人可以帮助我吗?
构建:

  1. $ docker build -t gpt2 . -f Dockerfile.cpu
  2. Sending build context to Docker daemon 4.706MB
  3. Step 1/10 : FROM tensorflow/tensorflow:1.12.0-py3
  4. 1.12.0-py3: Pulling from tensorflow/tensorflow
  5. ...
  6. ...
  7. Removing intermediate container de4b147fa32d
  8. ---> f00f44c69f05
  9. Successfully built f00f44c69f05
  10. Successfully tagged gpt2:latest

运行:

  1. root@750bbcc0d467:/gpt-2# export PYTHONIOENCODING=UTF-8
  2. root@750bbcc0d467:/gpt-2# python3 src/generate_unconditional_samples.py --top_k 40 --temperature 0.7 | tee /tmp/samples
  3. 2019-11-08 11:21:11.150936: I tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA
  4. Traceback (most recent call last):
  5. File "src/generate_unconditional_samples.py", line 79, in <module>
  6. fire.Fire(sample_model)
  7. File "/usr/local/lib/python3.5/dist-packages/fire/core.py", line 138, in Fire
  8. component_trace = _Fire(component, args, parsed_flag_args, context, name)
  9. File "/usr/local/lib/python3.5/dist-packages/fire/core.py", line 471, in _Fire
  10. target=component.__name__)
  11. File "/usr/local/lib/python3.5/dist-packages/fire/core.py", line 675, in _CallAndUpdateTrace
  12. component = fn(*varargs, **kwargs)
  13. File "src/generate_unconditional_samples.py", line 62, in sample_model
  14. temperature=temperature, top_k=top_k, top_p=top_p
  15. File "/gpt-2/src/sample.py", line 74, in sample_sequence
  16. past, prev, output = body(None, context, context)
  17. File "/gpt-2/src/sample.py", line 66, in body
  18. logits = top_p_logits(logits, p=top_p)
  19. File "/gpt-2/src/sample.py", line 28, in top_p_logits
  20. sorted_logits = tf.sort(logits, direction='DESCENDING', axis=-1)
  21. AttributeError: module 'tensorflow' has no attribute 'sort'
  22. root@750bbcc0d467:/gpt-2#

相关问题