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
File details
Details for the file googledriver-0.1.6.tar.gz
.
File metadata
- Download URL: googledriver-0.1.6.tar.gz
- Upload date:
- Size: 18.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b2f022a29945ed679ce95b7ed8ec4007f7d43752a8903ff0970d8f0f867b5767 |
|
MD5 | ee61a58ca36b665050b0fa8bc439d2be |
|
BLAKE2b-256 | a56c37ebfd3f5020e16c0176aefa8e7bce597a2ef59461aab89339fca2e9af43 |
File details
Details for the file googledriver-0.1.6-py3-none-any.whl
.
File metadata
- Download URL: googledriver-0.1.6-py3-none-any.whl
- Upload date:
- Size: 19.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1d39d2c0c2048ab37cff6ebdcb46b2ae32a116ddabbcbfe69404dbf6e646839d |
|
MD5 | b1e3d74e8174f405e7b569ce0bc0a591 |
|
BLAKE2b-256 | 6761284abb76aeddb5c45cd3408e98bf2b99eb1d91652f87e16cbbf45c6cabed |