Skip to content

Commit

Permalink
Adding byte support for _check_content.
Browse files Browse the repository at this point in the history
  • Loading branch information
sbwilli3 authored Oct 21, 2024
1 parent a702d58 commit 5b9b696
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions pickle_scanning_benchmark/download.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,12 @@ def hf_download_pickle_files(

def _check_content(content):
# Typical access error from HF API
if content.startswith("Access to model"):
raise Exception("Can not access model file")
if isinstance(content, bytes):
if content.startswith(b"Access to model"):
raise Exception("Can not access model file")
else:
if content.startswith("Access to model"):
raise Exception("Can not access model file")


def _download_pickle_file(url, file, outdir):
Expand Down

0 comments on commit 5b9b696

Please sign in to comment.