Skip to content
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

Add err msg if download failed #12142

Open
wants to merge 2 commits into
base: main
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
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,8 @@ def _download(path: str, url: str):
os.makedirs(MEGATRON_CACHE, exist_ok=True)
logging.info(f"Downloading from {url} to {path}")
downloaded_path = wget.download(url)
if not os.path.exists(downloaded_path):
raise FileNotFoundError(f"Download failed: {downloaded_path}")
shutil.move(downloaded_path, path)
# wait until the master process downloads the file and writes it to the cache dir
if torch.distributed.is_initialized():
Expand All @@ -230,12 +232,12 @@ def is_lower_cased_megatron(pretrained_model_name):

def get_megatron_tokenizer(pretrained_model_name: str):
"""
Takes a pretrained_model_name for megatron such as "megatron-bert-cased" and returns the according
Takes a pretrained_model_name for megatron such as "megatron-bert-cased" and returns the according
tokenizer name for tokenizer instantiating.

Args:
pretrained_model_name: pretrained_model_name for megatron such as "megatron-bert-cased"
Returns:
Returns:
tokenizer name for tokenizer instantiating
"""
_check_megatron_name(pretrained_model_name)
Expand Down
Loading