Tensorflow 没有“排序"属性.在 GPT 2 Git 版本中? [英] Tensorflow has no Attribute "sort" in GPT 2 Git Release?
问题描述
我下载了 git repo (https://github.com/openai/gpt-2) 并按照 python3 说明(在 DEVELOPERS.MD 中)在我的 Kubuntu 18.04LTS 机器上安装,但我无法运行它,而是出现错误.
I downloaded the git repo (https://github.com/openai/gpt-2) and followed the python3 instructions (in DEVELOPERS.MD) for installation on my Kubuntu 18.04LTS box, but I cannot run it and instead get an error.
这是我到目前为止所做的:
Here is what I've done so far:
pip3 install tensorflow==1.12.0
pip3 install -r requirements.txt
python3 download_model.py 124M
python3 download_model.py 355M
python3 download_model.py 774M
python3 download_model.py 1558M
export PYTHONIOENCODING=UTF-8
然后我跑了:
sarah@LesserArk:~/Custom Programs/gpt-2$ python3 src/interactive_conditional_samples.py
/home/sarah/.local/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:523: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint8 = np.dtype([("qint8", np.int8, 1)])
/home/sarah/.local/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:524: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_quint8 = np.dtype([("quint8", np.uint8, 1)])
/home/sarah/.local/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:525: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint16 = np.dtype([("qint16", np.int16, 1)])
/home/sarah/.local/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:526: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_quint16 = np.dtype([("quint16", np.uint16, 1)])
/home/sarah/.local/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:527: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint32 = np.dtype([("qint32", np.int32, 1)])
/home/sarah/.local/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:532: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
np_resource = np.dtype([("resource", np.ubyte, 1)])
2020-04-29 16:08:30.016586: 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/interactive_conditional_samples.py", line 91, in <module>
fire.Fire(interact_model)
File "/home/sarah/.local/lib/python3.6/site-packages/fire/core.py", line 138, in Fire
component_trace = _Fire(component, args, parsed_flag_args, context, name)
File "/home/sarah/.local/lib/python3.6/site-packages/fire/core.py", line 468, in _Fire
target=component.__name__)
File "/home/sarah/.local/lib/python3.6/site-packages/fire/core.py", line 672, in _CallAndUpdateTrace
component = fn(*varargs, **kwargs)
File "src/interactive_conditional_samples.py", line 65, in interact_model
temperature=temperature, top_k=top_k, top_p=top_p
File "/home/sarah/Custom Programs/gpt-2/src/sample.py", line 74, in sample_sequence
past, prev, output = body(None, context, context)
File "/home/sarah/Custom Programs/gpt-2/src/sample.py", line 66, in body
logits = top_p_logits(logits, p=top_p)
File "/home/sarah/Custom Programs/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'
最终导致错误:AttributeError: module 'tensorflow' has no attribute 'sort'
.
这很奇怪,我不知道如何继续.我本以为这些说明会导致安装成功,但似乎没有.
This is strange, and I'm not sure how to proceed. I would have thought that the instructions would lead to successful installation, but it appears that they don't.
卸载重装对最终结果没有影响?如何让 tensorflow 执行 GPT-II?
Uninstalling and reinstalling has no effect on the final result? How can I get tensorflow to execute GPT-II?
推荐答案
我能够使用以下方法使示例工作:
I was able to get the sample to work using:
pip3 安装tensorflow==1.13.1
此外,还有对 GitHub 问题 的响应,并提交了显示将 Dockerfile.cpu 更改为构建 FROM tensorflow/tensorflow:1.15.0-py3
修复了 docker 映像问题.
Additionally, there is a response to the GitHub issue with a commit showing changing Dockerfile.cpu to building FROM tensorflow/tensorflow:1.15.0-py3
fixes the docker image issue.
这篇关于Tensorflow 没有“排序"属性.在 GPT 2 Git 版本中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!