prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  SBU download is failing
  This is happening since roughly a month (first detection in #6274), but was masked by #6268. 
  
  http://www.cs.virginia.edu/~vicente/sbucaptions/
  
  The server is still up, but the path is no longer valid. I'll reach out to the author to see if this can be fixed. In the meantime we should probably disable the test.
  
  cc @pmeier @YosuaMichael
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `torchvision/datasets/sbu.py`
  Content:
  ```
  1 import os
  2 from typing import Any, Callable, Optional, Tuple
  3 
  4 from PIL import Image
  5 
  6 from .utils import check_integrity, download_url
  7 from .vision import VisionDataset
  8 
  9 
  10 class SBU(VisionDataset):
  11     """`SBU Captioned Photo <http://www.cs.virginia.edu/~vicente/sbucaptions/>`_ Dataset.
  12 
  13     Args:
  14         root (string): Root directory of dataset where tarball
  15             ``SBUCaptionedPhotoDataset.tar.gz`` exists.
  16         transform (callable, optional): A function/transform that takes in a PIL image
  17             and returns a transformed version. E.g, ``transforms.RandomCrop``
  18         target_transform (callable, optional): A function/transform that takes in the
  19             target and transforms it.
  20         download (bool, optional): If True, downloads the dataset from the internet and
  21             puts it in root directory. If dataset is already downloaded, it is not
  22             downloaded again.
  23     """
  24 
  25     url = "http://www.cs.virginia.edu/~vicente/sbucaptions/SBUCaptionedPhotoDataset.tar.gz"
  26     filename = "SBUCaptionedPhotoDataset.tar.gz"
  27     md5_checksum = "9aec147b3488753cf758b4d493422285"
  28 
  29     def __init__(
  30         self,
  31         root: str,
  32         transform: Optional[Callable] = None,
  33         target_transform: Optional[Callable] = None,
  34         download: bool = True,
  35     ) -> None:
  36         super().__init__(root, transform=transform, target_transform=target_transform)
  37 
  38         if download:
  39             self.download()
  40 
  41         if not self._check_integrity():
  42             raise RuntimeError("Dataset not found or corrupted. You can use download=True to download it")
  43 
  44         # Read the caption for each photo
  45         self.photos = []
  46         self.captions = []
  47 
  48         file1 = os.path.join(self.root, "dataset", "SBU_captioned_photo_dataset_urls.txt")
  49         file2 = os.path.join(self.root, "dataset", "SBU_captioned_photo_dataset_captions.txt")
  50 
  51         for line1, line2 in zip(open(file1), open(file2)):
  52             url = line1.rstrip()
  53             photo = os.path.basename(url)
  54             filename = os.path.join(self.root, "dataset", photo)
  55             if os.path.exists(filename):
  56                 caption = line2.rstrip()
  57                 self.photos.append(photo)
  58                 self.captions.append(caption)
  59 
  60     def __getitem__(self, index: int) -> Tuple[Any, Any]:
  61         """
  62         Args:
  63             index (int): Index
  64 
  65         Returns:
  66             tuple: (image, target) where target is a caption for the photo.
  67         """
  68         filename = os.path.join(self.root, "dataset", self.photos[index])
  69         img = Image.open(filename).convert("RGB")
  70         if self.transform is not None:
  71             img = self.transform(img)
  72 
  73         target = self.captions[index]
  74         if self.target_transform is not None:
  75             target = self.target_transform(target)
  76 
  77         return img, target
  78 
  79     def __len__(self) -> int:
  80         """The number of photos in the dataset."""
  81         return len(self.photos)
  82 
  83     def _check_integrity(self) -> bool:
  84         """Check the md5 checksum of the downloaded tarball."""
  85         root = self.root
  86         fpath = os.path.join(root, self.filename)
  87         if not check_integrity(fpath, self.md5_checksum):
  88             return False
  89         return True
  90 
  91     def download(self) -> None:
  92         """Download and extract the tarball, and download each individual photo."""
  93         import tarfile
  94 
  95         if self._check_integrity():
  96             print("Files already downloaded and verified")
  97             return
  98 
  99         download_url(self.url, self.root, self.filename, self.md5_checksum)
  100 
  101         # Extract file
  102         with tarfile.open(os.path.join(self.root, self.filename), "r:gz") as tar:
  103             tar.extractall(path=self.root)
  104 
  105         # Download individual photos
  106         with open(os.path.join(self.root, "dataset", "SBU_captioned_photo_dataset_urls.txt")) as fh:
  107             for line in fh:
  108                 url = line.rstrip()
  109                 try:
  110                     download_url(url, os.path.join(self.root, "dataset"))
  111                 except OSError:
  112                     # The images point to public images on Flickr.
  113                     # Note: Images might be removed by users at anytime.
  114                     pass
  115
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/torchvision/datasets/sbu.py b/torchvision/datasets/sbu.py
  --- a/torchvision/datasets/sbu.py
  +++ b/torchvision/datasets/sbu.py
  @@ -22,7 +22,7 @@
               downloaded again.
       """
   
  -    url = "http://www.cs.virginia.edu/~vicente/sbucaptions/SBUCaptionedPhotoDataset.tar.gz"
  +    url = "https://www.cs.rice.edu/~vo9/sbucaptions/SBUCaptionedPhotoDataset.tar.gz"
       filename = "SBUCaptionedPhotoDataset.tar.gz"
       md5_checksum = "9aec147b3488753cf758b4d493422285"
  
verification_info: {"golden_diff": "diff --git a/torchvision/datasets/sbu.py b/torchvision/datasets/sbu.py\n--- a/torchvision/datasets/sbu.py\n+++ b/torchvision/datasets/sbu.py\n@@ -22,7 +22,7 @@\n             downloaded again.\n     \"\"\"\n \n-    url = \"http://www.cs.virginia.edu/~vicente/sbucaptions/SBUCaptionedPhotoDataset.tar.gz\"\n+    url = \"https://www.cs.rice.edu/~vo9/sbucaptions/SBUCaptionedPhotoDataset.tar.gz\"\n     filename = \"SBUCaptionedPhotoDataset.tar.gz\"\n     md5_checksum = \"9aec147b3488753cf758b4d493422285\"\n", "issue": "SBU download is failing\nThis is happening since roughly a month (first detection in #6274), but was masked by #6268. \r\n\r\nhttp://www.cs.virginia.edu/~vicente/sbucaptions/\r\n\r\nThe server is still up, but the path is no longer valid. I'll reach out to the author to see if this can be fixed. In the meantime we should probably disable the test.\r\n\r\ncc @pmeier @YosuaMichael\n", "before_files": [{"content": "import os\nfrom typing import Any, Callable, Optional, Tuple\n\nfrom PIL import Image\n\nfrom .utils import check_integrity, download_url\nfrom .vision import VisionDataset\n\n\nclass SBU(VisionDataset):\n    \"\"\"`SBU Captioned Photo <http://www.cs.virginia.edu/~vicente/sbucaptions/>`_ Dataset.\n\n    Args:\n        root (string): Root directory of dataset where tarball\n            ``SBUCaptionedPhotoDataset.tar.gz`` exists.\n        transform (callable, optional): A function/transform that takes in a PIL image\n            and returns a transformed version. E.g, ``transforms.RandomCrop``\n        target_transform (callable, optional): A function/transform that takes in the\n            target and transforms it.\n        download (bool, optional): If True, downloads the dataset from the internet and\n            puts it in root directory. If dataset is already downloaded, it is not\n            downloaded again.\n    \"\"\"\n\n    url = \"http://www.cs.virginia.edu/~vicente/sbucaptions/SBUCaptionedPhotoDataset.tar.gz\"\n    filename = \"SBUCaptionedPhotoDataset.tar.gz\"\n    md5_checksum = \"9aec147b3488753cf758b4d493422285\"\n\n    def __init__(\n        self,\n        root: str,\n        transform: Optional[Callable] = None,\n        target_transform: Optional[Callable] = None,\n        download: bool = True,\n    ) -> None:\n        super().__init__(root, transform=transform, target_transform=target_transform)\n\n        if download:\n            self.download()\n\n        if not self._check_integrity():\n            raise RuntimeError(\"Dataset not found or corrupted. You can use download=True to download it\")\n\n        # Read the caption for each photo\n        self.photos = []\n        self.captions = []\n\n        file1 = os.path.join(self.root, \"dataset\", \"SBU_captioned_photo_dataset_urls.txt\")\n        file2 = os.path.join(self.root, \"dataset\", \"SBU_captioned_photo_dataset_captions.txt\")\n\n        for line1, line2 in zip(open(file1), open(file2)):\n            url = line1.rstrip()\n            photo = os.path.basename(url)\n            filename = os.path.join(self.root, \"dataset\", photo)\n            if os.path.exists(filename):\n                caption = line2.rstrip()\n                self.photos.append(photo)\n                self.captions.append(caption)\n\n    def __getitem__(self, index: int) -> Tuple[Any, Any]:\n        \"\"\"\n        Args:\n            index (int): Index\n\n        Returns:\n            tuple: (image, target) where target is a caption for the photo.\n        \"\"\"\n        filename = os.path.join(self.root, \"dataset\", self.photos[index])\n        img = Image.open(filename).convert(\"RGB\")\n        if self.transform is not None:\n            img = self.transform(img)\n\n        target = self.captions[index]\n        if self.target_transform is not None:\n            target = self.target_transform(target)\n\n        return img, target\n\n    def __len__(self) -> int:\n        \"\"\"The number of photos in the dataset.\"\"\"\n        return len(self.photos)\n\n    def _check_integrity(self) -> bool:\n        \"\"\"Check the md5 checksum of the downloaded tarball.\"\"\"\n        root = self.root\n        fpath = os.path.join(root, self.filename)\n        if not check_integrity(fpath, self.md5_checksum):\n            return False\n        return True\n\n    def download(self) -> None:\n        \"\"\"Download and extract the tarball, and download each individual photo.\"\"\"\n        import tarfile\n\n        if self._check_integrity():\n            print(\"Files already downloaded and verified\")\n            return\n\n        download_url(self.url, self.root, self.filename, self.md5_checksum)\n\n        # Extract file\n        with tarfile.open(os.path.join(self.root, self.filename), \"r:gz\") as tar:\n            tar.extractall(path=self.root)\n\n        # Download individual photos\n        with open(os.path.join(self.root, \"dataset\", \"SBU_captioned_photo_dataset_urls.txt\")) as fh:\n            for line in fh:\n                url = line.rstrip()\n                try:\n                    download_url(url, os.path.join(self.root, \"dataset\"))\n                except OSError:\n                    # The images point to public images on Flickr.\n                    # Note: Images might be removed by users at anytime.\n                    pass\n", "path": "torchvision/datasets/sbu.py"}], "after_files": [{"content": "import os\nfrom typing import Any, Callable, Optional, Tuple\n\nfrom PIL import Image\n\nfrom .utils import check_integrity, download_url\nfrom .vision import VisionDataset\n\n\nclass SBU(VisionDataset):\n    \"\"\"`SBU Captioned Photo <http://www.cs.virginia.edu/~vicente/sbucaptions/>`_ Dataset.\n\n    Args:\n        root (string): Root directory of dataset where tarball\n            ``SBUCaptionedPhotoDataset.tar.gz`` exists.\n        transform (callable, optional): A function/transform that takes in a PIL image\n            and returns a transformed version. E.g, ``transforms.RandomCrop``\n        target_transform (callable, optional): A function/transform that takes in the\n            target and transforms it.\n        download (bool, optional): If True, downloads the dataset from the internet and\n            puts it in root directory. If dataset is already downloaded, it is not\n            downloaded again.\n    \"\"\"\n\n    url = \"https://www.cs.rice.edu/~vo9/sbucaptions/SBUCaptionedPhotoDataset.tar.gz\"\n    filename = \"SBUCaptionedPhotoDataset.tar.gz\"\n    md5_checksum = \"9aec147b3488753cf758b4d493422285\"\n\n    def __init__(\n        self,\n        root: str,\n        transform: Optional[Callable] = None,\n        target_transform: Optional[Callable] = None,\n        download: bool = True,\n    ) -> None:\n        super().__init__(root, transform=transform, target_transform=target_transform)\n\n        if download:\n            self.download()\n\n        if not self._check_integrity():\n            raise RuntimeError(\"Dataset not found or corrupted. You can use download=True to download it\")\n\n        # Read the caption for each photo\n        self.photos = []\n        self.captions = []\n\n        file1 = os.path.join(self.root, \"dataset\", \"SBU_captioned_photo_dataset_urls.txt\")\n        file2 = os.path.join(self.root, \"dataset\", \"SBU_captioned_photo_dataset_captions.txt\")\n\n        for line1, line2 in zip(open(file1), open(file2)):\n            url = line1.rstrip()\n            photo = os.path.basename(url)\n            filename = os.path.join(self.root, \"dataset\", photo)\n            if os.path.exists(filename):\n                caption = line2.rstrip()\n                self.photos.append(photo)\n                self.captions.append(caption)\n\n    def __getitem__(self, index: int) -> Tuple[Any, Any]:\n        \"\"\"\n        Args:\n            index (int): Index\n\n        Returns:\n            tuple: (image, target) where target is a caption for the photo.\n        \"\"\"\n        filename = os.path.join(self.root, \"dataset\", self.photos[index])\n        img = Image.open(filename).convert(\"RGB\")\n        if self.transform is not None:\n            img = self.transform(img)\n\n        target = self.captions[index]\n        if self.target_transform is not None:\n            target = self.target_transform(target)\n\n        return img, target\n\n    def __len__(self) -> int:\n        \"\"\"The number of photos in the dataset.\"\"\"\n        return len(self.photos)\n\n    def _check_integrity(self) -> bool:\n        \"\"\"Check the md5 checksum of the downloaded tarball.\"\"\"\n        root = self.root\n        fpath = os.path.join(root, self.filename)\n        if not check_integrity(fpath, self.md5_checksum):\n            return False\n        return True\n\n    def download(self) -> None:\n        \"\"\"Download and extract the tarball, and download each individual photo.\"\"\"\n        import tarfile\n\n        if self._check_integrity():\n            print(\"Files already downloaded and verified\")\n            return\n\n        download_url(self.url, self.root, self.filename, self.md5_checksum)\n\n        # Extract file\n        with tarfile.open(os.path.join(self.root, self.filename), \"r:gz\") as tar:\n            tar.extractall(path=self.root)\n\n        # Download individual photos\n        with open(os.path.join(self.root, \"dataset\", \"SBU_captioned_photo_dataset_urls.txt\")) as fh:\n            for line in fh:\n                url = line.rstrip()\n                try:\n                    download_url(url, os.path.join(self.root, \"dataset\"))\n                except OSError:\n                    # The images point to public images on Flickr.\n                    # Note: Images might be removed by users at anytime.\n                    pass\n", "path": "torchvision/datasets/sbu.py"}]}