我在使用Docker build / run进行测试时遇到了一个错误,我不知道如何修复它。有人可以帮助我吗?
构建:
$ docker build -t gpt2 . -f Dockerfile.cpu
Sending build context to Docker daemon 4.706MB
Step 1/10 : FROM tensorflow/tensorflow:1.12.0-py3
1.12.0-py3: Pulling from tensorflow/tensorflow
...
...
Removing intermediate container de4b147fa32d
---> f00f44c69f05
Successfully built f00f44c69f05
Successfully tagged gpt2:latest
运行:
root@750bbcc0d467:/gpt-2# export PYTHONIOENCODING=UTF-8
root@750bbcc0d467:/gpt-2# python3 src/generate_unconditional_samples.py --top_k 40 --temperature 0.7 | tee /tmp/samples
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
Traceback (most recent call last):
File "src/generate_unconditional_samples.py", line 79, in <module>
fire.Fire(sample_model)
File "/usr/local/lib/python3.5/dist-packages/fire/core.py", line 138, in Fire
component_trace = _Fire(component, args, parsed_flag_args, context, name)
File "/usr/local/lib/python3.5/dist-packages/fire/core.py", line 471, in _Fire
target=component.__name__)
File "/usr/local/lib/python3.5/dist-packages/fire/core.py", line 675, in _CallAndUpdateTrace
component = fn(*varargs, **kwargs)
File "src/generate_unconditional_samples.py", line 62, in sample_model
temperature=temperature, top_k=top_k, top_p=top_p
File "/gpt-2/src/sample.py", line 74, in sample_sequence
past, prev, output = body(None, context, context)
File "/gpt-2/src/sample.py", line 66, in body
logits = top_p_logits(logits, p=top_p)
File "/gpt-2/src/sample.py", line 28, in top_p_logits
sorted_logits = tf.sort(logits, direction='DESCENDING', axis=-1)
AttributeError: module 'tensorflow' has no attribute 'sort'
root@750bbcc0d467:/gpt-2#
1条答案
按热度按时间bfnvny8b1#
这可以通过修复:#184(评论)
示例:https://pbs.twimg.com/media/EI2PmkrWsAcvNHV?format=jpg&name=medium