gpt4 book ai didi

Tensorflow 在 GPT 2 Git 版本中没有属性 "sort"?

转载 作者:行者123 更新时间:2023-12-04 02:36:41 24 4
gpt4 key购买 nike

我下载了 git 存储库 ( https://github.com/openai/gpt-2 ) 并按照 python3 说明(在 DEVELOPERS.MD 中)在我的 Kubuntu 18.04LTS 机器上进行了安装,但我无法运行它,反而出现错误。

这是我到目前为止所做的:

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'

这很奇怪,我不确定如何进行。我本以为这些说明会导致安装成功,但似乎并没有。

卸载重装对最终结果没有影响?如何让tensorflow执行GPT-II?

最佳答案

我能够使用以下方法使示例正常工作:

pip3 安装tensorflow==1.13.1

此外,还有对 GitHub issue 的响应提交显示将 Dockerfile.cpu 更改为构建 FROM tensorflow/tensorflow:1.15.0-py3 修复了 docker 镜像问题。

关于Tensorflow 在 GPT 2 Git 版本中没有属性 "sort"?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61510865/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com