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
0fcfc5cc
Unverified
Commit
0fcfc5cc
authored
Jul 22, 2024
by
Sai-Suraj-27
Committed by
GitHub
Jul 22, 2024
Browse files
fix: Replaced deprecated `mktemp()` function (#32123)
Replaced deprecated mktemp function.
parent
c38c55f4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
4 deletions
+4
-4
tests/utils/test_image_utils.py
tests/utils/test_image_utils.py
+3
-3
tests/utils/test_tokenization_utils.py
tests/utils/test_tokenization_utils.py
+1
-1
No files found.
tests/utils/test_image_utils.py
View file @
0fcfc5cc
...
...
@@ -513,7 +513,7 @@ class LoadImageTester(unittest.TestCase):
def
test_load_img_base64_prefix
(
self
):
try
:
tmp_file
=
tempfile
.
mktemp
()
tmp_file
=
tempfile
.
NamedTemporaryFile
(
delete
=
False
).
name
with
open
(
tmp_file
,
"wb"
)
as
f
:
http_get
(
"https://huggingface.co/datasets/hf-internal-testing/dummy-base64-images/raw/main/image_0.txt"
,
f
...
...
@@ -530,7 +530,7 @@ class LoadImageTester(unittest.TestCase):
def
test_load_img_base64
(
self
):
try
:
tmp_file
=
tempfile
.
mktemp
()
tmp_file
=
tempfile
.
NamedTemporaryFile
(
delete
=
False
).
name
with
open
(
tmp_file
,
"wb"
)
as
f
:
http_get
(
"https://huggingface.co/datasets/hf-internal-testing/dummy-base64-images/raw/main/image_1.txt"
,
f
...
...
@@ -547,7 +547,7 @@ class LoadImageTester(unittest.TestCase):
def
test_load_img_base64_encoded_bytes
(
self
):
try
:
tmp_file
=
tempfile
.
mktemp
()
tmp_file
=
tempfile
.
NamedTemporaryFile
(
delete
=
False
).
name
with
open
(
tmp_file
,
"wb"
)
as
f
:
http_get
(
"https://huggingface.co/datasets/hf-internal-testing/dummy-base64-images/raw/main/image_2.txt"
,
f
...
...
tests/utils/test_tokenization_utils.py
View file @
0fcfc5cc
...
...
@@ -84,7 +84,7 @@ class TokenizerUtilTester(unittest.TestCase):
def
test_legacy_load_from_one_file
(
self
):
# This test is for deprecated behavior and can be removed in v5
try
:
tmp_file
=
tempfile
.
mktemp
()
tmp_file
=
tempfile
.
NamedTemporaryFile
(
delete
=
False
).
name
with
open
(
tmp_file
,
"wb"
)
as
f
:
http_get
(
"https://huggingface.co/albert/albert-base-v1/resolve/main/spiece.model"
,
f
)
...
...
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