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
0df4e62d
Unverified
Commit
0df4e62d
authored
Dec 29, 2019
by
Julien Chaumond
Committed by
GitHub
Dec 29, 2019
Browse files
[http] Tweak http user-agent (#2353)
parent
f75bf05c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
1 deletion
+4
-1
src/transformers/file_utils.py
src/transformers/file_utils.py
+4
-1
No files found.
src/transformers/file_utils.py
View file @
0df4e62d
...
@@ -98,7 +98,6 @@ def is_torch_available():
...
@@ -98,7 +98,6 @@ def is_torch_available():
def
is_tf_available
():
def
is_tf_available
():
return
_tf_available
return
_tf_available
...
@@ -274,6 +273,10 @@ def s3_get(url, temp_file, proxies=None):
...
@@ -274,6 +273,10 @@ def s3_get(url, temp_file, proxies=None):
def
http_get
(
url
,
temp_file
,
proxies
=
None
,
resume_size
=
0
,
user_agent
=
None
):
def
http_get
(
url
,
temp_file
,
proxies
=
None
,
resume_size
=
0
,
user_agent
=
None
):
ua
=
"transformers/{}; python/{}"
.
format
(
__version__
,
sys
.
version
.
split
()[
0
])
ua
=
"transformers/{}; python/{}"
.
format
(
__version__
,
sys
.
version
.
split
()[
0
])
if
is_torch_available
():
ua
+=
"; torch/{}"
.
format
(
torch
.
__version__
)
if
is_tf_available
():
ua
+=
"; tensorflow/{}"
.
format
(
tf
.
__version__
)
if
isinstance
(
user_agent
,
dict
):
if
isinstance
(
user_agent
,
dict
):
ua
+=
"; "
+
"; "
.
join
(
"{}/{}"
.
format
(
k
,
v
)
for
k
,
v
in
user_agent
.
items
())
ua
+=
"; "
+
"; "
.
join
(
"{}/{}"
.
format
(
k
,
v
)
for
k
,
v
in
user_agent
.
items
())
elif
isinstance
(
user_agent
,
str
):
elif
isinstance
(
user_agent
,
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