Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
chenpangpang
transformers
Commits
e109edf1
Unverified
Commit
e109edf1
authored
Mar 14, 2022
by
Sylvain Gugger
Committed by
GitHub
Mar 14, 2022
Browse files
Use `HF_ENDPOINT` for custom endpoints (#16139)
parent
0dcdfe86
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
1 deletion
+10
-1
src/transformers/file_utils.py
src/transformers/file_utils.py
+10
-1
No files found.
src/transformers/file_utils.py
View file @
e109edf1
...
...
@@ -29,6 +29,7 @@ import sys
import
tarfile
import
tempfile
import
types
import
warnings
from
collections
import
OrderedDict
,
UserDict
from
contextlib
import
ExitStack
,
contextmanager
from
dataclasses
import
fields
...
...
@@ -325,7 +326,15 @@ CLOUDFRONT_DISTRIB_PREFIX = "https://cdn.huggingface.co"
_staging_mode
=
os
.
environ
.
get
(
"HUGGINGFACE_CO_STAGING"
,
"NO"
).
upper
()
in
ENV_VARS_TRUE_VALUES
_default_endpoint
=
"https://moon-staging.huggingface.co"
if
_staging_mode
else
"https://huggingface.co"
HUGGINGFACE_CO_RESOLVE_ENDPOINT
=
os
.
environ
.
get
(
"HUGGINGFACE_CO_RESOLVE_ENDPOINT"
,
_default_endpoint
)
HUGGINGFACE_CO_RESOLVE_ENDPOINT
=
_default_endpoint
if
os
.
environ
.
get
(
"HUGGINGFACE_CO_RESOLVE_ENDPOINT"
,
None
)
is
not
None
:
warnings
.
warn
(
"Using the environment variable `HUGGINGFACE_CO_RESOLVE_ENDPOINT` is deprecated and will be removed in "
"Transformers v5. Use `HF_ENDPOINT` instead."
,
FutureWarning
,
)
HUGGINGFACE_CO_RESOLVE_ENDPOINT
=
os
.
environ
.
get
(
"HUGGINGFACE_CO_RESOLVE_ENDPOINT"
,
None
)
HUGGINGFACE_CO_RESOLVE_ENDPOINT
=
os
.
environ
.
get
(
"HF_ENDPOINT"
,
HUGGINGFACE_CO_RESOLVE_ENDPOINT
)
HUGGINGFACE_CO_PREFIX
=
HUGGINGFACE_CO_RESOLVE_ENDPOINT
+
"/{model_id}/resolve/{revision}/{filename}"
# This is the version of torch required to run torch.fx features and torch.onnx with dictionary inputs.
...
...
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