Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenpangpang
transformers
Commits
0695b242
Unverified
Commit
0695b242
authored
Dec 18, 2023
by
Lucain
Committed by
GitHub
Dec 18, 2023
Browse files
Remove warning if `DISABLE_TELEMETRY` is used (#28113)
remove warning if DISABLE_TELEMETRY is used
parent
7c5408da
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
3 additions
and
9 deletions
+3
-9
src/transformers/file_utils.py
src/transformers/file_utils.py
+1
-1
src/transformers/utils/__init__.py
src/transformers/utils/__init__.py
+1
-1
src/transformers/utils/hub.py
src/transformers/utils/hub.py
+1
-7
No files found.
src/transformers/file_utils.py
View file @
0695b242
...
@@ -18,6 +18,7 @@ This module should not be update anymore and is only left for backward compatibi
...
@@ -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
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__
from
.
import
__version__
...
@@ -25,7 +26,6 @@ from . import __version__
...
@@ -25,7 +26,6 @@ from . import __version__
from
.utils
import
(
from
.utils
import
(
CLOUDFRONT_DISTRIB_PREFIX
,
CLOUDFRONT_DISTRIB_PREFIX
,
CONFIG_NAME
,
CONFIG_NAME
,
DISABLE_TELEMETRY
,
DUMMY_INPUTS
,
DUMMY_INPUTS
,
DUMMY_MASK
,
DUMMY_MASK
,
ENV_VARS_TRUE_AND_AUTO_VALUES
,
ENV_VARS_TRUE_AND_AUTO_VALUES
,
...
...
src/transformers/utils/__init__.py
View file @
0695b242
...
@@ -16,6 +16,7 @@
...
@@ -16,6 +16,7 @@
# limitations under the License.
# limitations under the License.
from
huggingface_hub
import
get_full_repo_name
# for backward compatibility
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
packaging
import
version
from
..
import
__version__
from
..
import
__version__
...
@@ -60,7 +61,6 @@ from .generic import (
...
@@ -60,7 +61,6 @@ from .generic import (
)
)
from
.hub
import
(
from
.hub
import
(
CLOUDFRONT_DISTRIB_PREFIX
,
CLOUDFRONT_DISTRIB_PREFIX
,
DISABLE_TELEMETRY
,
HF_MODULES_CACHE
,
HF_MODULES_CACHE
,
HUGGINGFACE_CO_PREFIX
,
HUGGINGFACE_CO_PREFIX
,
HUGGINGFACE_CO_RESOLVE_ENDPOINT
,
HUGGINGFACE_CO_RESOLVE_ENDPOINT
,
...
...
src/transformers/utils/hub.py
View file @
0695b242
...
@@ -115,7 +115,6 @@ if (
...
@@ -115,7 +115,6 @@ if (
HF_MODULES_CACHE
=
os
.
getenv
(
"HF_MODULES_CACHE"
,
os
.
path
.
join
(
constants
.
HF_HOME
,
"modules"
))
HF_MODULES_CACHE
=
os
.
getenv
(
"HF_MODULES_CACHE"
,
os
.
path
.
join
(
constants
.
HF_HOME
,
"modules"
))
TRANSFORMERS_DYNAMIC_MODULE_NAME
=
"transformers_modules"
TRANSFORMERS_DYNAMIC_MODULE_NAME
=
"transformers_modules"
SESSION_ID
=
uuid4
().
hex
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.
# Add deprecation warning for old environment variables.
for
key
in
(
"PYTORCH_PRETRAINED_BERT_CACHE"
,
"PYTORCH_TRANSFORMERS_CACHE"
,
"TRANSFORMERS_CACHE"
):
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
...
@@ -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."
,
f
"Using `
{
key
}
` is deprecated and will be removed in v5 of Transformers. Use `HF_HOME` instead."
,
FutureWarning
,
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"
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:
...
@@ -229,7 +223,7 @@ def http_user_agent(user_agent: Union[Dict, str, None] = None) -> str:
ua
+=
f
"; torch/
{
_torch_version
}
"
ua
+=
f
"; torch/
{
_torch_version
}
"
if
is_tf_available
():
if
is_tf_available
():
ua
+=
f
"; tensorflow/
{
_tf_version
}
"
ua
+=
f
"; tensorflow/
{
_tf_version
}
"
if
DISABLE_TELEMETRY
:
if
constants
.
HF_HUB_
DISABLE_TELEMETRY
:
return
ua
+
"; telemetry/off"
return
ua
+
"; telemetry/off"
if
is_training_run_on_sagemaker
():
if
is_training_run_on_sagemaker
():
ua
+=
"; "
+
"; "
.
join
(
f
"
{
k
}
/
{
v
}
"
for
k
,
v
in
define_sagemaker_information
().
items
())
ua
+=
"; "
+
"; "
.
join
(
f
"
{
k
}
/
{
v
}
"
for
k
,
v
in
define_sagemaker_information
().
items
())
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment