This is a step-by-step guide on how to set up Google Drive API which can be used to automatically upload model checkpoints to Google Drive. Further information can be found here.
- Go to the Google Cloud Dashboard.
- Click on the project drop-down and select
New Project. - Give your project a name and click
Create. - Once the project is created, select it from the project drop-down.
- Go to Navigation Menu > APIs & Services > OAuth consent screen.
- Select
Externalas the user type and clickCreate. - Fill in the required fields and click
Save and Continue. Scopescan be skipped, since we define them in the script.Test userscan be skipped as well.- Review the OAuth consent screen and click
Back to Dashboard.
- Within APIs & Services, go to
Library. - Search for
Google Drive APIand click on it. - Click
Enable.
- Within APIs & Services, go to
Credentials. - Click
Create Credentialsand selectOAuth client ID. - Select
Desktop appas the application type, give it a name and clickCreate. - A pop-up will appear with your client ID and client secret. Download the JSON file.
- Rename the JSON file to
client_secret.jsonand place it in thecredentials/folder.
Run the following command to create the token_drive_v3.pickle file which will be stored in the credentials/ folder.
python tools/create_drive_token.py
Please note, this token file will expire after 7 days. If you want to create a new token, simply run the command again.
In the default_cfg.py file, specify the Google Drive folder ID where you want to upload the model
checkpoints. The folder ID can be found in the URL of the folder. For example, the folder ID in the URL
https://drive.google.com/drive/folders/1X2Y3Z4A5B6C7D8E9F0G is 1X2Y3Z4A5B6C7D8E9F0G.
Once everything is set up, you can enable the upload of model checkpoints to Google Drive by setting the MODEL.cloud_upload
parameter to True in the configuration file in configs/.



