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
b8dffd1f
Unverified
Commit
b8dffd1f
authored
Apr 29, 2022
by
Nicolas Patry
Committed by
GitHub
Apr 29, 2022
Browse files
Revert "Updating variable names. (#16445)" (#17011)
This reverts commit
4f3a14e3
.
parent
4f3a14e3
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
12 deletions
+7
-12
src/transformers/file_utils.py
src/transformers/file_utils.py
+2
-7
src/transformers/utils/__init__.py
src/transformers/utils/__init__.py
+2
-2
src/transformers/utils/hub.py
src/transformers/utils/hub.py
+3
-3
No files found.
src/transformers/file_utils.py
View file @
b8dffd1f
...
@@ -34,9 +34,9 @@ from .utils import (
...
@@ -34,9 +34,9 @@ from .utils import (
ENV_VARS_TRUE_VALUES
,
ENV_VARS_TRUE_VALUES
,
FEATURE_EXTRACTOR_NAME
,
FEATURE_EXTRACTOR_NAME
,
FLAX_WEIGHTS_NAME
,
FLAX_WEIGHTS_NAME
,
HF_ENDPOINT
,
HF_ENDPOINT_PREFIX
,
HF_MODULES_CACHE
,
HF_MODULES_CACHE
,
HUGGINGFACE_CO_PREFIX
,
HUGGINGFACE_CO_RESOLVE_ENDPOINT
,
MODEL_CARD_NAME
,
MODEL_CARD_NAME
,
MULTIPLE_CHOICE_DUMMY_INPUTS
,
MULTIPLE_CHOICE_DUMMY_INPUTS
,
PYTORCH_PRETRAINED_BERT_CACHE
,
PYTORCH_PRETRAINED_BERT_CACHE
,
...
@@ -142,8 +142,3 @@ from .utils import (
...
@@ -142,8 +142,3 @@ from .utils import (
torch_version
,
torch_version
,
url_to_filename
,
url_to_filename
,
)
)
# Backward compatible alias of the new variable name
HUGGINGFACE_CO_RESOLVE_ENDPOINT
=
HF_ENDPOINT
HUGGINGFACE_CO_PREFIX
=
HF_ENDPOINT_PREFIX
src/transformers/utils/__init__.py
View file @
b8dffd1f
...
@@ -45,9 +45,9 @@ from .generic import (
...
@@ -45,9 +45,9 @@ from .generic import (
from
.hub
import
(
from
.hub
import
(
CLOUDFRONT_DISTRIB_PREFIX
,
CLOUDFRONT_DISTRIB_PREFIX
,
DISABLE_TELEMETRY
,
DISABLE_TELEMETRY
,
HF_ENDPOINT
,
HF_ENDPOINT_PREFIX
,
HF_MODULES_CACHE
,
HF_MODULES_CACHE
,
HUGGINGFACE_CO_PREFIX
,
HUGGINGFACE_CO_RESOLVE_ENDPOINT
,
PYTORCH_PRETRAINED_BERT_CACHE
,
PYTORCH_PRETRAINED_BERT_CACHE
,
PYTORCH_TRANSFORMERS_CACHE
,
PYTORCH_TRANSFORMERS_CACHE
,
S3_BUCKET_PREFIX
,
S3_BUCKET_PREFIX
,
...
...
src/transformers/utils/hub.py
View file @
b8dffd1f
...
@@ -107,8 +107,8 @@ if os.environ.get("HUGGINGFACE_CO_RESOLVE_ENDPOINT", None) is not None:
...
@@ -107,8 +107,8 @@ if os.environ.get("HUGGINGFACE_CO_RESOLVE_ENDPOINT", None) is not None:
FutureWarning
,
FutureWarning
,
)
)
HUGGINGFACE_CO_RESOLVE_ENDPOINT
=
os
.
environ
.
get
(
"HUGGINGFACE_CO_RESOLVE_ENDPOINT"
,
None
)
HUGGINGFACE_CO_RESOLVE_ENDPOINT
=
os
.
environ
.
get
(
"HUGGINGFACE_CO_RESOLVE_ENDPOINT"
,
None
)
H
F
_ENDPOINT
=
os
.
environ
.
get
(
"HF_ENDPOINT"
,
HUGGINGFACE_CO_RESOLVE_ENDPOINT
)
H
UGGINGFACE_CO_RESOLVE
_ENDPOINT
=
os
.
environ
.
get
(
"HF_ENDPOINT"
,
HUGGINGFACE_CO_RESOLVE_ENDPOINT
)
H
F_ENDPOINT_PREFIX
=
HF
_ENDPOINT
+
"/{model_id}/resolve/{revision}/{filename}"
H
UGGINGFACE_CO_PREFIX
=
HUGGINGFACE_CO_RESOLVE
_ENDPOINT
+
"/{model_id}/resolve/{revision}/{filename}"
def
is_remote_url
(
url_or_filename
):
def
is_remote_url
(
url_or_filename
):
...
@@ -149,7 +149,7 @@ def hf_bucket_url(
...
@@ -149,7 +149,7 @@ def hf_bucket_url(
if
revision
is
None
:
if
revision
is
None
:
revision
=
"main"
revision
=
"main"
return
H
F_ENDPOINT
_PREFIX
.
format
(
model_id
=
model_id
,
revision
=
revision
,
filename
=
filename
)
return
H
UGGINGFACE_CO
_PREFIX
.
format
(
model_id
=
model_id
,
revision
=
revision
,
filename
=
filename
)
def
url_to_filename
(
url
:
str
,
etag
:
Optional
[
str
]
=
None
)
->
str
:
def
url_to_filename
(
url
:
str
,
etag
:
Optional
[
str
]
=
None
)
->
str
:
...
...
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