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
4f3a14e3
"git@developer.sourcefind.cn:chenpangpang/transformers.git" did not exist on "3224c0c13fc9ef351c7a1a6e9f1401b3ce13859a"
Unverified
Commit
4f3a14e3
authored
Apr 29, 2022
by
Nicolas Patry
Committed by
GitHub
Apr 29, 2022
Browse files
Updating variable names. (#16445)
parent
20fb5d51
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
7 deletions
+12
-7
src/transformers/file_utils.py
src/transformers/file_utils.py
+7
-2
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 @
4f3a14e3
...
@@ -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,3 +142,8 @@ from .utils import (
...
@@ -142,3 +142,8 @@ 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 @
4f3a14e3
...
@@ -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 @
4f3a14e3
...
@@ -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
UGGINGFACE_CO_RESOLVE
_ENDPOINT
=
os
.
environ
.
get
(
"HF_ENDPOINT"
,
HUGGINGFACE_CO_RESOLVE_ENDPOINT
)
H
F
_ENDPOINT
=
os
.
environ
.
get
(
"HF_ENDPOINT"
,
HUGGINGFACE_CO_RESOLVE_ENDPOINT
)
H
UGGINGFACE_CO_PREFIX
=
HUGGINGFACE_CO_RESOLVE
_ENDPOINT
+
"/{model_id}/resolve/{revision}/{filename}"
H
F_ENDPOINT_PREFIX
=
HF
_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
UGGINGFACE_CO
_PREFIX
.
format
(
model_id
=
model_id
,
revision
=
revision
,
filename
=
filename
)
return
H
F_ENDPOINT
_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