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
74a24f0f
Commit
74a24f0f
authored
Jul 15, 2019
by
thomwolf
Browse files
clean up file_utils
parent
ab49fafc
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
18 deletions
+0
-18
pytorch_transformers/file_utils.py
pytorch_transformers/file_utils.py
+0
-18
No files found.
pytorch_transformers/file_utils.py
View file @
74a24f0f
...
...
@@ -258,21 +258,3 @@ def get_from_cache(url, cache_dir=None):
logger
.
info
(
"removing temp file %s"
,
temp_file
.
name
)
return
cache_path
def
read_set_from_file
(
filename
):
'''
Extract a de-duped collection (set) of text from a file.
Expected file format is one item per line.
'''
collection
=
set
()
with
open
(
filename
,
'r'
,
encoding
=
'utf-8'
)
as
file_
:
for
line
in
file_
:
collection
.
add
(
line
.
rstrip
())
return
collection
def
get_file_extension
(
path
,
dot
=
True
,
lower
=
True
):
ext
=
os
.
path
.
splitext
(
path
)[
1
]
ext
=
ext
if
dot
else
ext
[
1
:]
return
ext
.
lower
()
if
lower
else
ext
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