Skip to content

Commit 5b9b696

Browse files
authored
Adding byte support for _check_content.
1 parent a702d58 commit 5b9b696

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

pickle_scanning_benchmark/download.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,12 @@ def hf_download_pickle_files(
9797

9898
def _check_content(content):
9999
# Typical access error from HF API
100-
if content.startswith("Access to model"):
101-
raise Exception("Can not access model file")
100+
if isinstance(content, bytes):
101+
if content.startswith(b"Access to model"):
102+
raise Exception("Can not access model file")
103+
else:
104+
if content.startswith("Access to model"):
105+
raise Exception("Can not access model file")
102106

103107

104108
def _download_pickle_file(url, file, outdir):

0 commit comments

Comments
 (0)