diff --git a/datvuthanh_hybridnets.md b/datvuthanh_hybridnets.md index ef989d8d..4e216fe5 100644 --- a/datvuthanh_hybridnets.md +++ b/datvuthanh_hybridnets.md @@ -77,7 +77,7 @@ This example loads the pretrained **HybridNets** model and passes an image for i import torch # load model -model = torch.hub.load('datvuthanh/hybridnets', 'hybridnets', pretrained=True) +model = torch.hub.load('datvuthanh/hybridnets', 'hybridnets', pretrained=True, trust_repo=True) #inference img = torch.randn(1,3,640,384) diff --git a/huggingface_pytorch-transformers.md b/huggingface_pytorch-transformers.md index b9556d3c..5880e4a7 100644 --- a/huggingface_pytorch-transformers.md +++ b/huggingface_pytorch-transformers.md @@ -71,7 +71,7 @@ The tokenizer object allows the conversion from character strings to tokens unde ```py import torch -tokenizer = torch.hub.load('huggingface/pytorch-transformers', 'tokenizer', 'bert-base-uncased') # Download vocabulary from S3 and cache. +tokenizer = torch.hub.load('huggingface/pytorch-transformers', trust_repo=True, 'tokenizer', 'bert-base-uncased') # Download vocabulary from S3 and cache. tokenizer = torch.hub.load('huggingface/pytorch-transformers', 'tokenizer', './test/bert_saved_model/') # E.g. tokenizer was saved using `save_pretrained('./test/saved_model/')` ``` diff --git a/hustvl_yolop.md b/hustvl_yolop.md index da5ade6f..9bce9dae 100644 --- a/hustvl_yolop.md +++ b/hustvl_yolop.md @@ -117,7 +117,7 @@ This example loads the pretrained **YOLOP** model and passes an image for infere import torch # load model -model = torch.hub.load('hustvl/yolop', 'yolop', pretrained=True) +model = torch.hub.load('hustvl/yolop', 'yolop', trust_repo=True, pretrained=True) #inference img = torch.randn(1,3,640,640) diff --git a/intelisl_midas_v2.md b/intelisl_midas_v2.md index c5234b13..ed6b964e 100644 --- a/intelisl_midas_v2.md +++ b/intelisl_midas_v2.md @@ -48,7 +48,7 @@ model_type = "DPT_Large" # MiDaS v3 - Large (highest accuracy, slowest i #model_type = "DPT_Hybrid" # MiDaS v3 - Hybrid (medium accuracy, medium inference speed) #model_type = "MiDaS_small" # MiDaS v2.1 - Small (lowest accuracy, highest inference speed) -midas = torch.hub.load("intel-isl/MiDaS", model_type) +midas = torch.hub.load("intel-isl/MiDaS", model_type, trust_repo=True) ``` Move model to GPU if available ```python diff --git a/mateuszbuda_brain-segmentation-pytorch_unet.md b/mateuszbuda_brain-segmentation-pytorch_unet.md index 2351203e..83563d3c 100644 --- a/mateuszbuda_brain-segmentation-pytorch_unet.md +++ b/mateuszbuda_brain-segmentation-pytorch_unet.md @@ -18,7 +18,7 @@ demo-model-link: https://huggingface.co/spaces/pytorch/U-NET-for-brain-MRI ```python import torch -model = torch.hub.load('mateuszbuda/brain-segmentation-pytorch', 'unet', +model = torch.hub.load('mateuszbuda/brain-segmentation-pytorch', 'unet', trust_repo=True, in_channels=3, out_channels=1, init_features=32, pretrained=True) ``` diff --git a/nicolalandro_ntsnet-cub200_ntsnet.md b/nicolalandro_ntsnet-cub200_ntsnet.md index 3f4af215..4b1b9d49 100644 --- a/nicolalandro_ntsnet-cub200_ntsnet.md +++ b/nicolalandro_ntsnet-cub200_ntsnet.md @@ -18,7 +18,7 @@ demo-model-link: https://huggingface.co/spaces/pytorch/NTSNET ```python import torch -model = torch.hub.load('nicolalandro/ntsnet-cub200', 'ntsnet', pretrained=True, +model = torch.hub.load('nicolalandro/ntsnet-cub200', 'ntsnet', trust_repo=True, pretrained=True, **{'topN': 6, 'device':'cpu', 'num_classes': 200}) ``` diff --git a/nvidia_deeplearningexamples_efficientnet.md b/nvidia_deeplearningexamples_efficientnet.md index c306b343..8affb91c 100644 --- a/nvidia_deeplearningexamples_efficientnet.md +++ b/nvidia_deeplearningexamples_efficientnet.md @@ -68,7 +68,7 @@ You can choose among the following models: There are also quantized version of the models, but they require nvidia container. See [quantized models](https://github.com/NVIDIA/DeepLearningExamples/tree/master/PyTorch/Classification/ConvNets/efficientnet#quantization) ```python -efficientnet = torch.hub.load('NVIDIA/DeepLearningExamples:torchhub', 'nvidia_efficientnet_b0', pretrained=True) +efficientnet = torch.hub.load('NVIDIA/DeepLearningExamples:torchhub', 'nvidia_efficientnet_b0', trust_repo=True, pretrained=True) utils = torch.hub.load('NVIDIA/DeepLearningExamples:torchhub', 'nvidia_convnets_processing_utils') efficientnet.eval().to(device) diff --git a/nvidia_deeplearningexamples_resnet50.md b/nvidia_deeplearningexamples_resnet50.md index d613b59c..f1c4e623 100644 --- a/nvidia_deeplearningexamples_resnet50.md +++ b/nvidia_deeplearningexamples_resnet50.md @@ -61,7 +61,7 @@ print(f'Using {device} for inference') Load the model pretrained on IMAGENET dataset. ```python -resnet50 = torch.hub.load('NVIDIA/DeepLearningExamples:torchhub', 'nvidia_resnet50', pretrained=True) +resnet50 = torch.hub.load('NVIDIA/DeepLearningExamples:torchhub', 'nvidia_resnet50', pretrained=True, trust_repo=True) utils = torch.hub.load('NVIDIA/DeepLearningExamples:torchhub', 'nvidia_convnets_processing_utils') resnet50.eval().to(device) diff --git a/nvidia_deeplearningexamples_resnext.md b/nvidia_deeplearningexamples_resnext.md index e514e5e2..9447d68f 100644 --- a/nvidia_deeplearningexamples_resnext.md +++ b/nvidia_deeplearningexamples_resnext.md @@ -66,7 +66,7 @@ print(f'Using {device} for inference') Load the model pretrained on IMAGENET dataset. ```python -resneXt = torch.hub.load('NVIDIA/DeepLearningExamples:torchhub', 'nvidia_resneXt') +resneXt = torch.hub.load('NVIDIA/DeepLearningExamples:torchhub', 'nvidia_resneXt', trust_repo=True) utils = torch.hub.load('NVIDIA/DeepLearningExamples:torchhub', 'nvidia_convnets_processing_utils') resneXt.eval().to(device) diff --git a/nvidia_deeplearningexamples_se-resnext.md b/nvidia_deeplearningexamples_se-resnext.md index b0088a21..45b60303 100644 --- a/nvidia_deeplearningexamples_se-resnext.md +++ b/nvidia_deeplearningexamples_se-resnext.md @@ -66,7 +66,7 @@ print(f'Using {device} for inference') Load the model pretrained on IMAGENET dataset. ```python -resneXt = torch.hub.load('NVIDIA/DeepLearningExamples:torchhub', 'nvidia_se_resnext101_32x4d') +resneXt = torch.hub.load('NVIDIA/DeepLearningExamples:torchhub', 'nvidia_se_resnext101_32x4d', trust_repo=True) utils = torch.hub.load('NVIDIA/DeepLearningExamples:torchhub', 'nvidia_convnets_processing_utils') resneXt.eval().to(device) diff --git a/nvidia_deeplearningexamples_ssd.md b/nvidia_deeplearningexamples_ssd.md index 21aa5661..d8915801 100644 --- a/nvidia_deeplearningexamples_ssd.md +++ b/nvidia_deeplearningexamples_ssd.md @@ -54,7 +54,7 @@ pip install numpy scipy scikit-image matplotlib Load an SSD model pretrained on COCO dataset, as well as a set of utility methods for convenient and comprehensive formatting of input and output of the model. ```python import torch -ssd_model = torch.hub.load('NVIDIA/DeepLearningExamples:torchhub', 'nvidia_ssd') +ssd_model = torch.hub.load('NVIDIA/DeepLearningExamples:torchhub', 'nvidia_ssd', trust_repo=True) utils = torch.hub.load('NVIDIA/DeepLearningExamples:torchhub', 'nvidia_ssd_processing_utils') ``` diff --git a/nvidia_deeplearningexamples_tacotron2.md b/nvidia_deeplearningexamples_tacotron2.md index 5dc15166..e2e34b40 100644 --- a/nvidia_deeplearningexamples_tacotron2.md +++ b/nvidia_deeplearningexamples_tacotron2.md @@ -43,7 +43,7 @@ apt-get install -y libsndfile1 Load the Tacotron2 model pre-trained on [LJ Speech dataset](https://keithito.com/LJ-Speech-Dataset/) and prepare it for inference: ```python import torch -tacotron2 = torch.hub.load('NVIDIA/DeepLearningExamples:torchhub', 'nvidia_tacotron2', model_math='fp16') +tacotron2 = torch.hub.load('NVIDIA/DeepLearningExamples:torchhub', 'nvidia_tacotron2', trust_repo=True, model_math='fp16') tacotron2 = tacotron2.to('cuda') tacotron2.eval() ``` diff --git a/nvidia_deeplearningexamples_waveglow.md b/nvidia_deeplearningexamples_waveglow.md index e899533c..11e8aa1f 100644 --- a/nvidia_deeplearningexamples_waveglow.md +++ b/nvidia_deeplearningexamples_waveglow.md @@ -41,7 +41,7 @@ apt-get install -y libsndfile1 Load the WaveGlow model pre-trained on [LJ Speech dataset](https://keithito.com/LJ-Speech-Dataset/) ```python import torch -waveglow = torch.hub.load('NVIDIA/DeepLearningExamples:torchhub', 'nvidia_waveglow', model_math='fp32') +waveglow = torch.hub.load('NVIDIA/DeepLearningExamples:torchhub', 'nvidia_waveglow', trust_repo=True, model_math='fp32') ``` Prepare the WaveGlow model for inference diff --git a/pytorch_vision_ghostnet.md b/pytorch_vision_ghostnet.md index 693bd5b7..7ea54c99 100644 --- a/pytorch_vision_ghostnet.md +++ b/pytorch_vision_ghostnet.md @@ -19,7 +19,7 @@ demo-model-link: https://huggingface.co/spaces/pytorch/GhostNet ```python import torch -model = torch.hub.load('huawei-noah/ghostnet', 'ghostnet_1x', pretrained=True) +model = torch.hub.load('huawei-noah/ghostnet', 'ghostnet_1x', pretrained=True, trust_repo=True) model.eval() ``` diff --git a/pytorch_vision_hardnet.md b/pytorch_vision_hardnet.md index 9ee21888..519a2a09 100644 --- a/pytorch_vision_hardnet.md +++ b/pytorch_vision_hardnet.md @@ -19,7 +19,7 @@ demo-model-link: https://huggingface.co/spaces/pytorch/HardNet ```python import torch -model = torch.hub.load('PingoLH/Pytorch-HarDNet', 'hardnet68', pretrained=True) +model = torch.hub.load('PingoLH/Pytorch-HarDNet', 'hardnet68', pretrained=True, trust_repo=True) # or any of these variants # model = torch.hub.load('PingoLH/Pytorch-HarDNet', 'hardnet85', pretrained=True) # model = torch.hub.load('PingoLH/Pytorch-HarDNet', 'hardnet68ds', pretrained=True) diff --git a/pytorch_vision_ibnnet.md b/pytorch_vision_ibnnet.md index 55c076f7..16bb2fbe 100644 --- a/pytorch_vision_ibnnet.md +++ b/pytorch_vision_ibnnet.md @@ -19,7 +19,7 @@ demo-model-link: https://huggingface.co/spaces/pytorch/IBN-Net ```python import torch -model = torch.hub.load('XingangPan/IBN-Net', 'resnet50_ibn_a', pretrained=True) +model = torch.hub.load('XingangPan/IBN-Net', 'resnet50_ibn_a', pretrained=True, trust_repo=True) model.eval() ``` diff --git a/pytorch_vision_meal_v2.md b/pytorch_vision_meal_v2.md index a5b36ff7..47eda85e 100644 --- a/pytorch_vision_meal_v2.md +++ b/pytorch_vision_meal_v2.md @@ -27,7 +27,7 @@ We require one additional Python dependency import torch # list of models: 'mealv1_resnest50', 'mealv2_resnest50', 'mealv2_resnest50_cutmix', 'mealv2_resnest50_380x380', 'mealv2_mobilenetv3_small_075', 'mealv2_mobilenetv3_small_100', 'mealv2_mobilenet_v3_large_100', 'mealv2_efficientnet_b0' # load pretrained models, using "mealv2_resnest50_cutmix" as an example -model = torch.hub.load('szq0214/MEAL-V2','meal_v2', 'mealv2_resnest50_cutmix', pretrained=True) +model = torch.hub.load('szq0214/MEAL-V2','meal_v2', 'mealv2_resnest50_cutmix', pretrained=True, trust_repo=True) model.eval() ``` diff --git a/pytorch_vision_proxylessnas.md b/pytorch_vision_proxylessnas.md index e72407e0..27a4bddd 100644 --- a/pytorch_vision_proxylessnas.md +++ b/pytorch_vision_proxylessnas.md @@ -21,7 +21,7 @@ demo-model-link: https://huggingface.co/spaces/pytorch/ProxylessNAS import torch target_platform = "proxyless_cpu" # proxyless_gpu, proxyless_mobile, proxyless_mobile14 are also avaliable. -model = torch.hub.load('mit-han-lab/ProxylessNAS', target_platform, pretrained=True) +model = torch.hub.load('mit-han-lab/ProxylessNAS', target_platform, pretrained=True, trust_repo=True) model.eval() ``` diff --git a/pytorch_vision_resnest.md b/pytorch_vision_resnest.md index 94995d56..e9f0d25f 100644 --- a/pytorch_vision_resnest.md +++ b/pytorch_vision_resnest.md @@ -20,9 +20,9 @@ demo-model-link: https://huggingface.co/spaces/pytorch/ResNeSt ```python import torch # get list of models -torch.hub.list('zhanghang1989/ResNeSt', force_reload=True) +torch.hub.list('zhanghang1989/ResNeSt', force_reload=True, trust_repo=True) # load pretrained models, using ResNeSt-50 as an example -model = torch.hub.load('zhanghang1989/ResNeSt', 'resnest50', pretrained=True) +model = torch.hub.load('zhanghang1989/ResNeSt', 'resnest50', pretrained=True, trust_repo=True) model.eval() ``` diff --git a/sigsep_open-unmix-pytorch_umx.md b/sigsep_open-unmix-pytorch_umx.md index 54963210..bec40958 100644 --- a/sigsep_open-unmix-pytorch_umx.md +++ b/sigsep_open-unmix-pytorch_umx.md @@ -26,7 +26,7 @@ pip install -q torchaudio import torch # loading umxhq four target separator -separator = torch.hub.load('sigsep/open-unmix-pytorch', 'umxhq') +separator = torch.hub.load('sigsep/open-unmix-pytorch', 'umxhq', trust_repo=True) # generate random audio # ... with shape (nb_samples, nb_channels, nb_timesteps) diff --git a/snakers4_silero-models_stt.md b/snakers4_silero-models_stt.md index a18f8b9f..c77e6059 100644 --- a/snakers4_silero-models_stt.md +++ b/snakers4_silero-models_stt.md @@ -30,6 +30,7 @@ device = torch.device('cpu') # gpu also works, but our models are fast enough f model, decoder, utils = torch.hub.load(repo_or_dir='snakers4/silero-models', model='silero_stt', + trust_repo=True, language='en', # also available 'de', 'es' device=device) (read_batch, split_into_batches, diff --git a/snakers4_silero-models_tts.md b/snakers4_silero-models_tts.md index 0b16b77e..e1af3817 100644 --- a/snakers4_silero-models_tts.md +++ b/snakers4_silero-models_tts.md @@ -28,6 +28,7 @@ speaker = 'lj_16khz' device = torch.device('cpu') model, symbols, sample_rate, example_text, apply_tts = torch.hub.load(repo_or_dir='snakers4/silero-models', model='silero_tts', + trust_repo=True, language=language, speaker=speaker) model = model.to(device) # gpu or cpu diff --git a/snakers4_silero-vad_vad.md b/snakers4_silero-vad_vad.md index 96beba3d..91f96eb9 100644 --- a/snakers4_silero-vad_vad.md +++ b/snakers4_silero-vad_vad.md @@ -32,7 +32,8 @@ torch.hub.download_url_to_file('https://models.silero.ai/vad_models/en.wav', 'en model, utils = torch.hub.load(repo_or_dir='snakers4/silero-vad', model='silero_vad', - force_reload=True) + force_reload=True, + trust_repo=True) (get_speech_timestamps, _, read_audio, diff --git a/ultralytics_yolov5.md b/ultralytics_yolov5.md index 88dfa8de..9892214b 100644 --- a/ultralytics_yolov5.md +++ b/ultralytics_yolov5.md @@ -71,7 +71,7 @@ This example loads a pretrained **YOLOv5s** model and passes an image for infere import torch # Model -model = torch.hub.load('ultralytics/yolov5', 'yolov5s', pretrained=True) +model = torch.hub.load('ultralytics/yolov5', 'yolov5s', pretrained=True, trust_repo=True) # Images imgs = ['https://ultralytics.com/images/zidane.jpg'] # batch of images