code I use to download files to my Gdrive using colab. It has progressbar and size check. Paste on a new notebook on Google Colab, set the url and destPath to whatever you need and run. In this example, it downloads Protogen 3.4 model from Civitai and saves it on models folder.

PHOTO EMBED

Sat Feb 11 2023 03:45:28 GMT+0000 (Coordinated Universal Time)

Saved by @jak123

from google.colab import drive
drive.mount('/content/gdrive')
from tqdm import tqdm
import requests
import os

# you can put the rest on a second cell 

url = "https://civitai.com/api/download/models/4048"  #@param {type:"string"}
destPath = "/content/gdrive/My Drive/models/Protogen3.ckpt"  #@param {type:"string"}
with requests.get(url, stream=True) as r:
    length = int(r.headers['Content-Length'])
    print("Total:",length)
    r.raise_for_status()
    with open(destPath, 'wb') as f:
        pbar = tqdm(total=length)
        for chunk in r.iter_content(chunk_size=8192):
            if chunk: 
                f.write(chunk)
                pbar.update(len(chunk))

file_size = os.path.getsize(destPath)
if file_size == length:
    print("\nDone")
else:
    raise RuntimeError("File size mismatch: got {} of {}".format(file_size, length))
content_copyCOPY

https://www.reddit.com/r/StableDiffusion/comments/107dgr9/code_to_download_files_to_gdrive_using_colab/?newUser