From 08b525ed1ef2a7511e06ae92eb3df6b38fedb652 Mon Sep 17 00:00:00 2001 From: Stas Bekman Date: Tue, 13 Apr 2021 13:19:07 -0700 Subject: [PATCH 1/7] add 2 points of reference to the offline mode --- docs/source/troubleshoot.md | 23 +++++++++++++++++++++++ src/transformers/modeling_utils.py | 5 +++++ 2 files changed, 28 insertions(+) create mode 100644 docs/source/troubleshoot.md diff --git a/docs/source/troubleshoot.md b/docs/source/troubleshoot.md new file mode 100644 index 000000000000..a8a30b3e0e31 --- /dev/null +++ b/docs/source/troubleshoot.md @@ -0,0 +1,23 @@ + + +# Troubleshooting + +This document is to help find solutions for common problems. + +## Firewalled environments + +Some cloud and intranet setups have their GPU instances firewalled to the outside world, so if your script is trying to download model weights or datasets it will first hang and then timeout. One possible solution in this situation is to use the ["offline-mode"](https://huggingface.co/transformers/installation.html#offline-mode). diff --git a/src/transformers/modeling_utils.py b/src/transformers/modeling_utils.py index b34b2d4f0716..1be4d0632d2c 100755 --- a/src/transformers/modeling_utils.py +++ b/src/transformers/modeling_utils.py @@ -949,6 +949,11 @@ def from_pretrained(cls, pretrained_model_name_or_path: Optional[Union[str, os.P Passing :obj:`use_auth_token=True` is required when you want to use a private model. + .. note:: + + Use the special `"offline-mode" `__ to + use this method in a firewalled environment. + Examples:: >>> from transformers import BertConfig, BertModel From da43615282e877f9aeefdf996070dcfa67d9c54e Mon Sep 17 00:00:00 2001 From: Stas Bekman Date: Tue, 13 Apr 2021 13:22:04 -0700 Subject: [PATCH 2/7] link the new doc --- docs/source/index.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/source/index.rst b/docs/source/index.rst index 6a100ed05c66..ff18e7bfa155 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -22,7 +22,7 @@ State-of-the-art NLP for everyone: - Hands-on practitioners - AI/ML/NLP teachers and educators -.. +.. Copyright 2020 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with @@ -394,6 +394,7 @@ TensorFlow and/or Flax. pretrained_models examples + troubleshoot custom_datasets notebooks sagemaker From 6a2434f034f4c81c168959e49acaa8eeb0dc1241 Mon Sep 17 00:00:00 2001 From: Stas Bekman Date: Tue, 13 Apr 2021 13:35:31 -0700 Subject: [PATCH 3/7] add error message --- docs/source/troubleshoot.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/docs/source/troubleshoot.md b/docs/source/troubleshoot.md index a8a30b3e0e31..c8015486201c 100644 --- a/docs/source/troubleshoot.md +++ b/docs/source/troubleshoot.md @@ -20,4 +20,11 @@ This document is to help find solutions for common problems. ## Firewalled environments -Some cloud and intranet setups have their GPU instances firewalled to the outside world, so if your script is trying to download model weights or datasets it will first hang and then timeout. One possible solution in this situation is to use the ["offline-mode"](https://huggingface.co/transformers/installation.html#offline-mode). +Some cloud and intranet setups have their GPU instances firewalled to the outside world, so if your script is trying to download model weights or datasets it will first hang and then timeout with an error message like: + +``` +ValueError: Connection error, and we cannot find the requested files in the cached path. +Please try again or make sure your Internet connection is on. +``` + +One possible solution in this situation is to use the ["offline-mode"](https://huggingface.co/transformers/installation.html#offline-mode). From ecf4d155d71be85b43db3ceee20b043bca1b15a8 Mon Sep 17 00:00:00 2001 From: Stas Bekman Date: Tue, 13 Apr 2021 13:36:58 -0700 Subject: [PATCH 4/7] Update src/transformers/modeling_utils.py Co-authored-by: Sylvain Gugger <35901082+sgugger@users.noreply.github.com> --- src/transformers/modeling_utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/transformers/modeling_utils.py b/src/transformers/modeling_utils.py index 1be4d0632d2c..c6018d22ab53 100755 --- a/src/transformers/modeling_utils.py +++ b/src/transformers/modeling_utils.py @@ -951,7 +951,7 @@ def from_pretrained(cls, pretrained_model_name_or_path: Optional[Union[str, os.P .. note:: - Use the special `"offline-mode" `__ to + Activate the special `"offline-mode" `__ to use this method in a firewalled environment. Examples:: From 1a70bfe3ca019fdc3ebff447172c1c5eab397c07 Mon Sep 17 00:00:00 2001 From: Stas Bekman Date: Tue, 13 Apr 2021 13:37:24 -0700 Subject: [PATCH 5/7] style --- src/transformers/modeling_utils.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/transformers/modeling_utils.py b/src/transformers/modeling_utils.py index c6018d22ab53..82a0a99179bc 100755 --- a/src/transformers/modeling_utils.py +++ b/src/transformers/modeling_utils.py @@ -951,8 +951,9 @@ def from_pretrained(cls, pretrained_model_name_or_path: Optional[Union[str, os.P .. note:: - Activate the special `"offline-mode" `__ to - use this method in a firewalled environment. + Activate the special `"offline-mode" + `__ to use this method in a firewalled + environment. Examples:: From c18bd2e1f1dde838cb36058191a808033f915210 Mon Sep 17 00:00:00 2001 From: Stas Bekman Date: Tue, 13 Apr 2021 18:17:17 -0700 Subject: [PATCH 6/7] rename --- docs/source/index.rst | 2 +- docs/source/{troubleshoot.md => troubleshooting.md} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename docs/source/{troubleshoot.md => troubleshooting.md} (100%) diff --git a/docs/source/index.rst b/docs/source/index.rst index ff18e7bfa155..25a2a380431e 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -394,7 +394,7 @@ TensorFlow and/or Flax. pretrained_models examples - troubleshoot + troubleshooting custom_datasets notebooks sagemaker diff --git a/docs/source/troubleshoot.md b/docs/source/troubleshooting.md similarity index 100% rename from docs/source/troubleshoot.md rename to docs/source/troubleshooting.md From 2737a9f15215eb6570fb19357b5d13ef319d96eb Mon Sep 17 00:00:00 2001 From: Stas Bekman Date: Tue, 13 Apr 2021 19:24:16 -0700 Subject: [PATCH 7/7] Trigger CI