diff --git a/docs_src/sidebar.json b/docs_src/sidebar.json index fbdd7dfa2d..a5ad3d5c73 100644 --- a/docs_src/sidebar.json +++ b/docs_src/sidebar.json @@ -1,118 +1,128 @@ { - "Getting started": { - "Overview": "/", - "Quick start": "/quick_start.html" - }, - "Tutorials": { - "Overview": "/tutorial", - "": { - "Beginners": { - "Vision tutorial": "/tutorial.vision", - "Text tutorial": "/tutorial.text", - "Tabular tutorial": "/tutorial.tabular", - "Collab tutorial": "/tutorial.collab" - } + "Getting started": { + "Overview": "/", + "Quick Start": "/quick_start.html" }, - "empty1": { - "Intermediate": { - "Data block tutorial": "/tutorial.datablock", - "Imagenette tutorial": "/tutorial.imagenette", - "Pets tutorial": "/tutorial.pets", - "Transformers tutorial": "/tutorial.transformers", - "Wikitext tutorial": "/tutorial.wikitext" - } + "Tutorials": { + "Overview": "/tutorial", + "": { + "Beginner": { + "Vision Tutorial": "/tutorial.vision", + "Text Tutorial": "/tutorial.text", + "Tabular Tutorial": "/tutorial.tabular", + "Collab Tutorial": "/tutorial.collab" + } + }, + "empty1": { + "Intermediate": { + "DataBlock Tutorial": "/tutorial.datablock", + "Imagenette Tutorial": "/tutorial.imagenette", + "Medical Imaging Tutorial": "/tutorial.medical_imaging", + "Pets Tutorial": "/tutorial.pets", + "Transformers Tutorial": "/tutorial.transformers", + "Wikitext Tutorial": "/tutorial.wikitext" + } + }, + "empty2": { + "Advanced": { + "Albumentions Tutorial": "/tutorial.albumentions", + "Siamese Tutorial": "/tutorial.siamese" + } + }, + "empty3": { + "Migrating from Other Libraries": { + "Plain PyTorch": "/migrating_pytorch", + "Ignite": "/migrating_ignite", + "Lightning": "/migrating_lightning", + "Catalyst": "/migrating_catalyst" + } + } }, - "empty2": { - "Advanced": { - "Siamese tutorial": "/tutorial.siamese" - } + "Training": { + "Training Loop": "/learner", + "Optimizer": "/optimizer", + "Metrics": "/metrics", + "Interpretation": "/interpret", + "Distributed": "/distributed", + "": { + "Callbacks": { + "Core": "/callback.core", + "Hooks": "/callback.hook", + "Progress": "/callback.hook", + "Schedulers": "/callback.schedule", + "CutMix": "/callback.cutmix", + "Data": "/callback.data", + "Mixed Precision": "/callback.fp16", + "MixUp": "/callback.mixup", + "Predictions": "/callback.preds", + "RNN": "/callback.rnn", + "Tracker": "/callback.tracker", + "Training": "/callback.training" + } + } }, - "empty3": { - "Migrating from other libraries": { - "Plain PyTorch": "/migrating_pytorch", - "Ignite": "/migrating_ignite", - "Lightning": "/migrating_lightning", - "Catalyst": "/migrating_catalyst" - } - } - }, - "Training": { - "Training loop": "/learner", - "Optimizer": "/optimizer", - "Metrics": "/metrics", - "Interpretation": "/interpret", - "Distributed": "/distributed", - "": { - "Callbacks": { - "Core": "/callback.core", - "Schedulers": "/callback.schedule", - "Hooks and callbacks": "/callback.hook", - "Mixed precision": "/callback.fp16", - "Mixup": "/callback.mixup", - "Cutmix": "/callback.cutmix", - "Tracker": "/callback.tracker", - "Training": "/callback.training", - "RNN": "/callback.rnn", - "Data": "/callback.data", - "Progress": "/callback.progress" - } - } - }, - "Data": { - "Data Blocks": "/data.block", - "Data Transforms": "/data.transforms", - "Data External": "/data.external", - "Data Core": "/data.core", - "DataLoader": "/data.load" - }, - "Core": { - "PyTorch Core": "/torch_core", - "Layers": "/layers" - }, - "Vision": { - "Vision Learner": "/vision.learner", - "Vision Data Augmentation": "/vision.augment", - "Vision Data": "/vision.data", - "Vision Core": "/vision.core", - "Vision Utils": "/vision.utils", - "Vision Widgets": "/vision.widgets", - "GAN": "/vision.gan", - "": { - "Models": { - "XResnet": "/vision.models.xresnet", - "Unet": "/vision.models.unet" - } - } - }, - "Text": { - "Text Core": "/text.core", - "Text Data": "/text.data", - "Text Learner": "/text.learner", - "": { - "Models": { - "Core": "/text.models.core", - "AWD LSTM": "/text.models.awdlstm", - "QRNN": "/text.models.qrnn" - } + "Data": { + "Blocks": "/data.block", + "Core": "/data.core", + "DataLoader": "/data.load", + "External": "/data.external", + "Transforms": "/data.transforms" + }, + "Core": { + "PyTorch Core": "/torch_core", + "Layers": "/layers" + }, + + "Vision": { + "Core": "/vision.core", + "Data": "/vision.data", + "Data Augmentation": "/vision.augment", + "Learner": "/vision.learner", + "": { + "Models": { + "XResnet": "/vision.models.xresnet", + "Unet": "/vision.models.unet" + } + }, + "GAN": "/vision.gan", + "Utilities": "/vision.utils", + "Widgets": "/vision.widgets" + }, + "Text": { + "Core": "/text.core", + "Data": "/text.data", + "Learner": "/text.learner", + "": { + "Models": { + "Core": "/text.models.core", + "AWD LSTM": "/text.models.awdlstm", + "QRNN": "/text.models.qrnn" + } + } + }, + "Tabular": { + "Core": "/tabular.core", + "Data": "/tabular.data", + "Learner": "/tabular.learner", + "Model": "/tabular.model", + "Collab": "/collab" + }, + "Medical": { + "Imagery": "/medical.imaging", + "Text": "/medical.text" + }, + + "Integrations": { + "Neptune": "/callback.neptune", + "TensorBoard": "/callback.tensorboard", + "Weights & Biases": "/callback.wandb" + }, + "fastai Development": { + "Developers Guide": "/dev-setup", + "Abbreviation Guide": "/dev/abbr", + "Style Guide": "/dev/style", + "GPU Notes": "/dev/gpu", + "Git Notes": "/dev/git", + "Notes": "/dev/develop" } - }, - "Tabular": { - "Tabular Core": "/tabular.core", - "Tabular Data": "/tabular.data", - "Tabular Learner": "/tabular.learner", - "Tabular Model": "/tabular.model", - "Collab": "/collab" - }, - "Medical": { - "Medical imagery": "/medical.imaging", - "Medical text": "/medical.text" - }, - "fastai development": { - "Developers guide": "/dev-setup", - "Abbreviation guide": "/dev/abbr", - "Style guide": "/dev/style", - "GPU Notes": "/dev/gpu", - "git notes": "/dev/git", - "Notes": "/dev/develop" - } -} +} \ No newline at end of file diff --git a/fastai/text/learner.py b/fastai/text/learner.py index 32417e699c..b7835971fa 100644 --- a/fastai/text/learner.py +++ b/fastai/text/learner.py @@ -207,7 +207,8 @@ def language_model_learner(dls, arch, config=None, drop_mult=1., backwards=False warn("There are no pretrained weights for that architecture yet!") return learn model_path = untar_data(meta[url] , c_key='model') - fnames = [list(model_path.glob(f'*.{ext}'))[0] for ext in ['pth', 'pkl']] + try: fnames = [list(model_path.glob(f'*.{ext}'))[0] for ext in ['pth', 'pkl']] + except IndexError: print(f'The model in {model_path} is incomplete, download again'); raise learn = learn.load_pretrained(*fnames) return learn @@ -230,7 +231,8 @@ def text_classifier_learner(dls, arch, seq_len=72, config=None, backwards=False, warn("There are no pretrained weights for that architecture yet!") return learn model_path = untar_data(meta[url], c_key='model') - fnames = [list(model_path.glob(f'*.{ext}'))[0] for ext in ['pth', 'pkl']] + try: fnames = [list(model_path.glob(f'*.{ext}'))[0] for ext in ['pth', 'pkl']] + except IndexError: print(f'The model in {model_path} is incomplete, download again'); raise learn = learn.load_pretrained(*fnames, model=learn.model[0]) learn.freeze() return learn diff --git a/nbs/37_text.learner.ipynb b/nbs/37_text.learner.ipynb index ac2e9cc936..cf6e65494f 100644 --- a/nbs/37_text.learner.ipynb +++ b/nbs/37_text.learner.ipynb @@ -580,7 +580,8 @@ " warn(\"There are no pretrained weights for that architecture yet!\")\n", " return learn\n", " model_path = untar_data(meta[url] , c_key='model')\n", - " fnames = [list(model_path.glob(f'*.{ext}'))[0] for ext in ['pth', 'pkl']]\n", + " try: fnames = [list(model_path.glob(f'*.{ext}'))[0] for ext in ['pth', 'pkl']]\n", + " except IndexError: print(f'The model in {model_path} is incomplete, download again'); raise\n", " learn = learn.load_pretrained(*fnames)\n", " return learn" ] @@ -714,7 +715,8 @@ " warn(\"There are no pretrained weights for that architecture yet!\")\n", " return learn\n", " model_path = untar_data(meta[url], c_key='model')\n", - " fnames = [list(model_path.glob(f'*.{ext}'))[0] for ext in ['pth', 'pkl']]\n", + " try: fnames = [list(model_path.glob(f'*.{ext}'))[0] for ext in ['pth', 'pkl']]\n", + " except IndexError: print(f'The model in {model_path} is incomplete, download again'); raise\n", " learn = learn.load_pretrained(*fnames, model=learn.model[0])\n", " learn.freeze()\n", " return learn"