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
f667d5b2
Unverified
Commit
f667d5b2
authored
Sep 08, 2021
by
Kevin Canwen Xu
Committed by
GitHub
Sep 08, 2021
Browse files
Deprecate Mirror for Downloading (#13470)
* Deprecated Mirror * revert * revert * revert * fix
parent
f5d3bb1d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
8 deletions
+7
-8
src/transformers/file_utils.py
src/transformers/file_utils.py
+7
-8
No files found.
src/transformers/file_utils.py
View file @
f667d5b2
...
@@ -277,11 +277,6 @@ _default_endpoint = "https://moon-staging.huggingface.co" if _staging_mode else
...
@@ -277,11 +277,6 @@ _default_endpoint = "https://moon-staging.huggingface.co" if _staging_mode else
HUGGINGFACE_CO_RESOLVE_ENDPOINT
=
os
.
environ
.
get
(
"HUGGINGFACE_CO_RESOLVE_ENDPOINT"
,
_default_endpoint
)
HUGGINGFACE_CO_RESOLVE_ENDPOINT
=
os
.
environ
.
get
(
"HUGGINGFACE_CO_RESOLVE_ENDPOINT"
,
_default_endpoint
)
HUGGINGFACE_CO_PREFIX
=
HUGGINGFACE_CO_RESOLVE_ENDPOINT
+
"/{model_id}/resolve/{revision}/{filename}"
HUGGINGFACE_CO_PREFIX
=
HUGGINGFACE_CO_RESOLVE_ENDPOINT
+
"/{model_id}/resolve/{revision}/{filename}"
PRESET_MIRROR_DICT
=
{
"tuna"
:
"https://mirrors.tuna.tsinghua.edu.cn/hugging-face-models"
,
"bfsu"
:
"https://mirrors.bfsu.edu.cn/hugging-face-models"
,
}
# This is the version of torch required to run torch.fx features and torch.onnx with dictionary inputs.
# This is the version of torch required to run torch.fx features and torch.onnx with dictionary inputs.
TORCH_FX_REQUIRED_VERSION
=
version
.
parse
(
"1.8"
)
TORCH_FX_REQUIRED_VERSION
=
version
.
parse
(
"1.8"
)
TORCH_ONNX_DICT_INPUTS_MINIMUM_VERSION
=
version
.
parse
(
"1.8"
)
TORCH_ONNX_DICT_INPUTS_MINIMUM_VERSION
=
version
.
parse
(
"1.8"
)
...
@@ -1262,12 +1257,16 @@ def hf_bucket_url(
...
@@ -1262,12 +1257,16 @@ def hf_bucket_url(
filename
=
f
"
{
subfolder
}
/
{
filename
}
"
filename
=
f
"
{
subfolder
}
/
{
filename
}
"
if
mirror
:
if
mirror
:
endpoint
=
PRESET_MIRROR_DICT
.
get
(
mirror
,
mirror
)
logger
.
warning
(
"Deprecated: The mirroring is deprecated."
"Tuna and BFSU mirrors are no longer available."
"We will soon provide a self-hosted alternative."
)
legacy_format
=
"/"
not
in
model_id
legacy_format
=
"/"
not
in
model_id
if
legacy_format
:
if
legacy_format
:
return
f
"
{
endpoint
}
/
{
model_id
}
-
{
filename
}
"
return
f
"
{
mirror
}
/
{
model_id
}
-
{
filename
}
"
else
:
else
:
return
f
"
{
endpoint
}
/
{
model_id
}
/
{
filename
}
"
return
f
"
{
mirror
}
/
{
model_id
}
/
{
filename
}
"
if
revision
is
None
:
if
revision
is
None
:
revision
=
"main"
revision
=
"main"
...
...
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