Files
hao-ai-lab-FastVideo/opensora/utils/downloader.py
T
qqingzheng 1bed11aee3 [refactor] reformat videogpt, support training videogpt on accelerate
Former-commit-id: 75385ed47fe60008b61b1bcf89f61ea696d095bc
2024-03-06 13:45:16 +00:00

19 lines
492 B
Python

import gdown
import os
opensora_cache_home = os.path.expanduser(
os.getenv("OPENSORA_HOME", os.path.join("~/.cache", "opensora"))
)
def gdown_download(id, fname, cache_dir=None):
cache_dir = opensora_cache_home if not cache_dir else cache_dir
os.makedirs(cache_dir, exist_ok=True)
destination = os.path.join(cache_dir, fname)
if os.path.exists(destination):
return destination
gdown.download(id=id, output=destination, quiet=False)
return destination