From 8de4ad38d6457c2f55d25bda4311833112706063 Mon Sep 17 00:00:00 2001 From: ashwini rathi Date: Thu, 20 Jun 2024 08:04:57 -0700 Subject: [PATCH] torch_multimodal_clip model get failed due to network issue (#2289) Summary: Description: while running model torch_multimodal_clip getting this issue FileNotFoundError: [Errno 2] No such file or directory: 'torchbenchmark/models/torch_multimodal_clip/.data/pizza.jpg' main reason is while downloading the pizza.jpg , getting Failed to download file with status code 403 issue so this change will resolve this issue Pull Request resolved: https://github.com/pytorch/benchmark/pull/2289 Reviewed By: aaronenyeshi Differential Revision: D58813450 Pulled By: xuzhao9 fbshipit-source-id: aa4cbee8fa4633182898fe7c1037b471505ce2ec --- torchbenchmark/models/torch_multimodal_clip/install.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/torchbenchmark/models/torch_multimodal_clip/install.py b/torchbenchmark/models/torch_multimodal_clip/install.py index 0723509634..91c9f9dbad 100644 --- a/torchbenchmark/models/torch_multimodal_clip/install.py +++ b/torchbenchmark/models/torch_multimodal_clip/install.py @@ -5,7 +5,10 @@ def download(output_filename, uri): # Download the file with streaming to handle large files - response = requests.get(uri, stream=True) + headers = { + 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3' + } + response = requests.get(uri, headers=headers, stream=True) if response.status_code == 200: with open(output_filename, 'wb') as f: for chunk in response.iter_content(chunk_size=8192): # Define the chunk size to be used