Я использую Pydrive и oauth2client для загрузки моих данных с диска:
# Code to read csv file into Colaboratory:
!pip install -U -q PyDrive
from pydrive.auth import GoogleAuth
from pydrive.drive import GoogleDrive
from google.colab import auth
from oauth2client.client import GoogleCredentials
# Authenticate and create the PyDrive client.
auth.authenticate_user()
gauth = GoogleAuth()
gauth.credentials = GoogleCredentials.get_application_default()
drive = GoogleDrive(gauth)
#shareable link
link=""
fluff, id = link.split('=')
downloaded = drive.CreateFile({'id':id})
downloaded.GetContentFile('train.csv')
df = pd.read_csv('train.csv')
Но я не знаю, как сохранять лучшие веса каждый раз, когда они обновляются после эпохи. Вот моя модель:
model = Sequential()
model.add(Bidirectional(LSTM(32, return_sequences=True), input_shape=(TrainDataX.shape[1],TrainDataX.shape[2])))
model.add(Dropout(0.2))
model.add(Bidirectional(LSTM(32)))
model.add(Dropout(0.2))
model.add(Dense(TrainDataY.shape[1]))
model.compile(loss='mean_squared_error', optimizer='adam')
filepath="best_weight.hdf5"
checkpoint = ModelCheckpoint(filepath, monitor= 'loss' , verbose=1, save_best_only=True,
mode= min )
callbacks_list = [checkpoint]
# fit the model
model.fit(TrainDataX, TrainDataY, nb_epoch=50, batch_size=64, callbacks= callbacks_list)