Skip to content

Add optional resume_download argument to help download large models #130

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions rudalle/dalle/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@


def get_rudalle_model(name, pretrained=True, fp16=False, device='cpu', use_auth_token=None,
cache_dir='/tmp/rudalle', **model_kwargs):
cache_dir='/tmp/rudalle', resume_download=False, **model_kwargs):
assert name in MODELS

if fp16 and device == 'cpu':
Expand Down Expand Up @@ -188,7 +188,7 @@ def init_layer_func(x, prefix=None):
cache_dir = os.path.join(cache_dir, name)
config_file_url = hf_hub_url(repo_id=config['repo_id'], filename=config['filename'])
cached_download(config_file_url, cache_dir=cache_dir, force_filename=config['filename'],
use_auth_token=use_auth_token)
use_auth_token=use_auth_token, resume_download=resume_download)
checkpoint = torch.load(os.path.join(cache_dir, config['filename']), map_location=device)

pbar = tqdm(total=len(checkpoint.keys()))
Expand Down