试着在谷歌科拉布培训GPT-2。我运行的细胞看起来是这样的:
!git clone https://github.com/shawwn/gpt-2 -b tpu /content/gpt-2..。
%tensorflow_version 1.x
!pip freeze | grep tensorflowmesh-tensorflow=0.1.12 tensorflow==1.15.2 tensorflow-数据集=4.0.1 tensorflow-估值器=1.15.1 tensorflow-gan=2.0.0 tensorflow-gcs=2.4.0TensorFlow-hub=0.11.0 tensorflow-元数据=0.28.0 tensorflow-概率=0.7.0
%tensorflow_version 1.x
!PYTHONPATH=src ./train.py --help我收到以下错误消息:
TensorFlow 1.x selected.
2021-03-14 14:22:11.118915: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcudart.so.11.0
Traceback (most recent call last):
File "./train.py", line 17, in <module>
import model, sample, encoder
File "/content/gpt-2/src/model.py", line 3, in <module>
from tensorflow.contrib.training import HParams
ModuleNotFoundError: No module named 'tensorflow.contrib'据我所知,TensorFlow v1.15.2应该包含contrib模块。我在这里做错什么了?
请注意,我没有编写这段代码,而是使用了其他人的git。
发布于 2021-03-15 04:49:35
Tensorflow 1.15.2有折叠式。在colab中,确保一旦Tensorflow 1.x安装重新启动运行时,因为colab有默认的2.x版本。我在colab上尝试了相同的代码--它成功了。
https://stackoverflow.com/questions/66625669
复制相似问题