mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 21:14:14 +08:00
Summary: * `torch.hub.list('pytorch/vision')` - show all available hub models in `pytorch/vision` * `torch.hub.show('pytorch/vision', 'resnet18')` - show docstring & example for `resnet18` in `pytorch/vision` * Moved `torch.utils.model_zoo.load_url` to `torch.hub.load_state_dict_from_url` and deprecate `torch.utils.model_zoo` * We have too many env to control where the cache dir is, it's not very necessary. I actually want to unify `TORCH_HUB_DIR`, `TORCH_HOME` and `TORCH_MODEL_ZOO`, but haven't done it. (more suggestions are welcome!) * Simplify `pytorch/vision` example in doc, it was used to show how how hub entrypoint can be written so had some confusing unnecessary args. An example of hub usage is shown below ``` In [1]: import torch In [2]: torch.hub.list('pytorch/vision', force_reload=True) Downloading: "https://github.com/pytorch/vision/archive/master.zip" to /private/home/ailzhang/.torch/hub/master.zip Out[2]: ['resnet18', 'resnet50'] In [3]: torch.hub.show('pytorch/vision', 'resnet18') Using cache found in /private/home/ailzhang/.torch/hub/vision_master Resnet18 model pretrained (bool): a recommended kwargs for all entrypoints args & kwargs are arguments for the function In [4]: model = torch.hub.load('pytorch/vision', 'resnet18', pretrained=True) Using cache found in /private/home/ailzhang/.torch/hub/vision_master ``` Pull Request resolved: https://github.com/pytorch/pytorch/pull/18758 Differential Revision: D14883651 Pulled By: ailzhang fbshipit-source-id: 6db6ab708a74121782a9154c44b0e190b23e8309
3 lines
117 B
Python
3 lines
117 B
Python
# torchvision imports tqdm from here.
|
|
from torch.hub import tqdm, load_state_dict_from_url as load_url # noqa: F401
|