在上一篇文章中,我们将数据导出到 Google Cloud Storage。在这篇文章中将读取数据并使用数据运行模型。有很多使用 colab 的例子。在这里,我们专注于在您的 PC 或服务器上训练您的模型。
从 gcp 存储桶下载数据。
使用 gsutil 将文件复制到您电脑上选择的文件夹中
gsutil -m cp -r gs://wfpbucket/l8Records myoutput/data/folder
安装 tensorflow python 包。请注意,如果您的系统具有强大的 GPU,您可以安装 tensorflow-gpu。如果您想利用 GPU,您还需要安装 NVIDIA 驱动程序。
pip install tensorflow
复制并粘贴下面的模型并设置正确的路径。
# Tensorflow 设置和加载.
import tensorflow as tf
print(tf.__version__)
from tensorflow.python.keras import layers
from tensorflow.python.keras import losses
from tensorflow.python.keras import mod