lastly I'm working on google colab I get this dataset colled celeba and it is into a google drive accout and this account is not mine but I have the access to go through it now because the internet problems and drive capacity I can not dounload the dataset then upload it to my drive ... so the question is: is there any way to let google colab get access to this dataset or such a way to import the path...
I have this function definition below
create_celebahq_cond_continuous('/content/drive/My Drive/kiki96/results/tfrecords','https://drive.google.com/open?id=0B7EVK8r0v71pWEZsZE9oNnFzTm8','https://drive.google.com/open?id=0B4qLcYyJmiz0TXY1NG02bzZVRGs',4,100,False)
where I have tried to put the sharablelink of the dataset but, it does not work
please help
It is the easiest way to upload a CSV file in Colab. For this go to the dataset in your GitHub repository, and then click on “View Raw”. Copy the link to the raw dataset and pass it as a parameter to the read_csv() in pandas to get the dataframe.
If you want to download the file directly into your Google Colab instance, then you can use gdown
.
Note that the file must be shared to the public.
If the link to your dataset is https://drive.google.com/file/d/10vAwF6hFUjvw3pf6MmB_S0jZm9CLWbSx/view?usp=sharing
, you can use:
!gdown --id "10vAwF6hFUjvw3pf6MmB_S0jZm9CLWbSx"
Instead, if you want to download it to your drive then
Mount your Google Drive
from google.colab import drive
drive.mount('/content/drive')
Change the directory to a folder in your Google Drive
cd '/content/drive/My Drive/datasets/'
Download the file into your Google Drive folder
!gdown --id "10vAwF6hFUjvw3pf6MmB_S0jZm9CLWbSx"
If you are trying to download a folder, follow these steps:
Mount your Google Drive to Google Colab
Go to the folder where you added the shortcut
You can see the newly-added folder, being referenced by its Google Drive folder ID.
You can use the script here to download the whole folder.
https://github.com/segnolin/google-drive-folder-downloader
I've made it into an easy function.
def folder_download(folder_id):
# authenticate
from google.colab import auth
auth.authenticate_user()
# get folder_name
from googleapiclient.discovery import build
service = build('drive', 'v3')
folder_name = service.files().get(fileId=folder_id).execute()['name']
# import library and download
!wget -qnc https://github.com/segnolin/google-drive-folder-downloader/raw/master/download.py
from download import download_folder
download_folder(service, folder_id, './', folder_name)
return folder_name
You can simply call it with the folder_id.
folder_download('0B7EVK8r0v71pWEZsZE9oNnFzTm8')
And it will create that folder in Colab.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With