mirror of
https://github.com/huggingface/transformers.git
synced 2025-07-30 17:52:35 +06:00
Remove warning if DISABLE_TELEMETRY
is used (#28113)
remove warning if DISABLE_TELEMETRY is used
This commit is contained in:
parent
7c5408dade
commit
0695b2421a
@ -18,6 +18,7 @@ This module should not be update anymore and is only left for backward compatibi
|
||||
"""
|
||||
|
||||
from huggingface_hub import get_full_repo_name # for backward compatibility
|
||||
from huggingface_hub.constants import HF_HUB_DISABLE_TELEMETRY as DISABLE_TELEMETRY # for backward compatibility
|
||||
|
||||
from . import __version__
|
||||
|
||||
@ -25,7 +26,6 @@ from . import __version__
|
||||
from .utils import (
|
||||
CLOUDFRONT_DISTRIB_PREFIX,
|
||||
CONFIG_NAME,
|
||||
DISABLE_TELEMETRY,
|
||||
DUMMY_INPUTS,
|
||||
DUMMY_MASK,
|
||||
ENV_VARS_TRUE_AND_AUTO_VALUES,
|
||||
|
@ -16,6 +16,7 @@
|
||||
# limitations under the License.
|
||||
|
||||
from huggingface_hub import get_full_repo_name # for backward compatibility
|
||||
from huggingface_hub.constants import HF_HUB_DISABLE_TELEMETRY as DISABLE_TELEMETRY # for backward compatibility
|
||||
from packaging import version
|
||||
|
||||
from .. import __version__
|
||||
@ -60,7 +61,6 @@ from .generic import (
|
||||
)
|
||||
from .hub import (
|
||||
CLOUDFRONT_DISTRIB_PREFIX,
|
||||
DISABLE_TELEMETRY,
|
||||
HF_MODULES_CACHE,
|
||||
HUGGINGFACE_CO_PREFIX,
|
||||
HUGGINGFACE_CO_RESOLVE_ENDPOINT,
|
||||
|
@ -115,7 +115,6 @@ if (
|
||||
HF_MODULES_CACHE = os.getenv("HF_MODULES_CACHE", os.path.join(constants.HF_HOME, "modules"))
|
||||
TRANSFORMERS_DYNAMIC_MODULE_NAME = "transformers_modules"
|
||||
SESSION_ID = uuid4().hex
|
||||
DISABLE_TELEMETRY = os.getenv("DISABLE_TELEMETRY", constants.HF_HUB_DISABLE_TELEMETRY) in ENV_VARS_TRUE_VALUES
|
||||
|
||||
# Add deprecation warning for old environment variables.
|
||||
for key in ("PYTORCH_PRETRAINED_BERT_CACHE", "PYTORCH_TRANSFORMERS_CACHE", "TRANSFORMERS_CACHE"):
|
||||
@ -124,11 +123,6 @@ for key in ("PYTORCH_PRETRAINED_BERT_CACHE", "PYTORCH_TRANSFORMERS_CACHE", "TRAN
|
||||
f"Using `{key}` is deprecated and will be removed in v5 of Transformers. Use `HF_HOME` instead.",
|
||||
FutureWarning,
|
||||
)
|
||||
if os.getenv("DISABLE_TELEMETRY") is not None:
|
||||
warnings.warn(
|
||||
"Using `DISABLE_TELEMETRY` is deprecated and will be removed in v5 of Transformers. Use `HF_HUB_DISABLE_TELEMETRY` instead.",
|
||||
FutureWarning,
|
||||
)
|
||||
|
||||
|
||||
S3_BUCKET_PREFIX = "https://s3.amazonaws.com/models.huggingface.co/bert"
|
||||
@ -229,7 +223,7 @@ def http_user_agent(user_agent: Union[Dict, str, None] = None) -> str:
|
||||
ua += f"; torch/{_torch_version}"
|
||||
if is_tf_available():
|
||||
ua += f"; tensorflow/{_tf_version}"
|
||||
if DISABLE_TELEMETRY:
|
||||
if constants.HF_HUB_DISABLE_TELEMETRY:
|
||||
return ua + "; telemetry/off"
|
||||
if is_training_run_on_sagemaker():
|
||||
ua += "; " + "; ".join(f"{k}/{v}" for k, v in define_sagemaker_information().items())
|
||||
|
Loading…
Reference in New Issue
Block a user