The Python package google drive facilitates access to files uploaded to Google Drive.
Project description
Google-Driver
The Python package Google-Driver
assists in downloading files and folders stored in Google Drive to make them easier to use. There are some constraints for model management through Hugging-Face and Git-Lfs, and it incurs costs. Therefore, I wrapped some codes to make it easy to store and load artificial intelligence model weights.
Installation
pip install googledriver
Features
1. File Download
Download to specific path
To save a file from a shared Google Drive URL to local storage, use the following code.
from googledriver import download
URL = 'https://drive.google.com/file/d/xxxxxxxxx/view?usp=share_link'
download(URL, './model/tf_gpt2_model')
Download to cached folder
To download a cached file (or directory) from a URL and return its path, you can use the following method.
from googledriver import download
URL = 'https://drive.google.com/file/d/xxxxxxxxx/view?usp=share_link'
cached_path = download(URL, None, 'tf_model')
Basically, torch cached is used, and the huggingface hub module is used as a reference and wrapped.
2. Folder Download
The return value returns the path of the saved files. However, it is different when using it as a cache folder.
Download to current working directory
from googledriver import download_folder
URL = 'https://drive.google.com/file/d/xxxxxxxxx/view?usp=share_link'
download_folder(URL)
Download to specific directory
from googledriver import download_folder
URL = 'https://drive.google.com/file/d/xxxxxxxxx/view?usp=share_link'
save_folder = "./any/path/to/save/'
download_folder(URL, save_folder)
Download to cached directory
from googledriver import download_folder
URL = 'https://drive.google.com/file/d/xxxxxxxxx/view?usp=share_link'
download_folder(URL, cached=True)
In the case of the cache folder, the return value is the cache folder path of Google Drive. Therefore, it may be difficult to cache and use multiple folders.
References
[1] https://github.com/huggingface/transformers
[2] https://github.com/wkentaro/gdown
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for googledriver-0.1.6-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1d39d2c0c2048ab37cff6ebdcb46b2ae32a116ddabbcbfe69404dbf6e646839d |
|
MD5 | b1e3d74e8174f405e7b569ce0bc0a591 |
|
BLAKE2b-256 | 6761284abb76aeddb5c45cd3408e98bf2b99eb1d91652f87e16cbbf45c6cabed |