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
c01480bb
Commit
c01480bb
authored
Jun 23, 2020
by
Julien Chaumond
Browse files
[file_utils] Type user-agent
parent
58918c76
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
4 deletions
+4
-4
src/transformers/file_utils.py
src/transformers/file_utils.py
+4
-4
No files found.
src/transformers/file_utils.py
View file @
c01480bb
...
@@ -16,7 +16,7 @@ from contextlib import contextmanager
...
@@ -16,7 +16,7 @@ from contextlib import contextmanager
from
functools
import
partial
,
wraps
from
functools
import
partial
,
wraps
from
hashlib
import
sha256
from
hashlib
import
sha256
from
pathlib
import
Path
from
pathlib
import
Path
from
typing
import
Optional
from
typing
import
Dict
,
Optional
,
Union
from
urllib.parse
import
urlparse
from
urllib.parse
import
urlparse
from
zipfile
import
ZipFile
,
is_zipfile
from
zipfile
import
ZipFile
,
is_zipfile
...
@@ -271,7 +271,7 @@ def cached_path(
...
@@ -271,7 +271,7 @@ def cached_path(
force_download
=
False
,
force_download
=
False
,
proxies
=
None
,
proxies
=
None
,
resume_download
=
False
,
resume_download
=
False
,
user_agent
=
None
,
user_agent
:
Union
[
Dict
,
str
,
None
]
=
None
,
extract_compressed_file
=
False
,
extract_compressed_file
=
False
,
force_extract
=
False
,
force_extract
=
False
,
local_files_only
=
False
,
local_files_only
=
False
,
...
@@ -357,7 +357,7 @@ def cached_path(
...
@@ -357,7 +357,7 @@ def cached_path(
return
output_path
return
output_path
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
:
Union
[
Dict
,
str
,
None
]
=
None
):
ua
=
"transformers/{}; python/{}"
.
format
(
__version__
,
sys
.
version
.
split
()[
0
])
ua
=
"transformers/{}; python/{}"
.
format
(
__version__
,
sys
.
version
.
split
()[
0
])
if
is_torch_available
():
if
is_torch_available
():
ua
+=
"; torch/{}"
.
format
(
torch
.
__version__
)
ua
+=
"; torch/{}"
.
format
(
torch
.
__version__
)
...
@@ -397,7 +397,7 @@ def get_from_cache(
...
@@ -397,7 +397,7 @@ def get_from_cache(
proxies
=
None
,
proxies
=
None
,
etag_timeout
=
10
,
etag_timeout
=
10
,
resume_download
=
False
,
resume_download
=
False
,
user_agent
=
None
,
user_agent
:
Union
[
Dict
,
str
,
None
]
=
None
,
local_files_only
=
False
,
local_files_only
=
False
,
)
->
Optional
[
str
]:
)
->
Optional
[
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