We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Escape csv header lines
I haven't been able to see how to skip first csv line in case of loading from a file with header. I could of course preprocess the file, but it'd be nice if there was an option to TabularDataset to tell it to skip the first line.

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `torchtext/data/dataset.py`
Content:
```
1 import io
2 import os
3 import zipfile
4 import tarfile
5 
6 import torch.utils.data
7 from six.moves import urllib
8 
9 from .example import Example
10 
11 
12 class Dataset(torch.utils.data.Dataset):
13     """Defines a dataset composed of Examples along with its Fields.
14 
15     Attributes:
16         sort_key (callable): A key to use for sorting dataset examples for batching
17             together examples with similar lengths to minimize padding.
18         examples (list(Example)): The examples in this dataset.
19             fields: A dictionary containing the name of each column together with
20             its corresponding Field object. Two columns with the same Field
21             object will share a vocabulary.
22         fields (dict[str, Field]): Contains the name of each column or field, together
23             with the corresponding Field object. Two fields with the same Field object
24             will have a shared vocabulary.
25     """
26     sort_key = None
27 
28     def __init__(self, examples, fields, filter_pred=None):
29         """Create a dataset from a list of Examples and Fields.
30 
31         Arguments:
32             examples: List of Examples.
33             fields (List(tuple(str, Field))): The Fields to use in this tuple. The
34                 string is a field name, and the Field is the associated field.
35             filter_pred (callable or None): Use only examples for which
36                 filter_pred(example) is True, or use all examples if None.
37                 Default is None.
38         """
39         if filter_pred is not None:
40             examples = list(filter(filter_pred, examples))
41         self.examples = examples
42         self.fields = dict(fields)
43 
44     @classmethod
45     def splits(cls, path, train=None, validation=None, test=None, **kwargs):
46         """Create Dataset objects for multiple splits of a dataset.
47 
48         Arguments:
49             path (str): Common prefix of the splits' file paths.
50             train (str): Suffix to add to path for the train set, or None for no
51                 train set. Default is None.
52             validation (str): Suffix to add to path for the validation set, or None
53                 for no validation set. Default is None.
54             test (str): Suffix to add to path for the test set, or None for no test
55                 set. Default is None.
56             Remaining keyword arguments: Passed to the constructor of the
57                 Dataset (sub)class being used.
58 
59         Returns:
60             split_datasets (tuple(Dataset)): Datasets for train, validation, and
61                 test splits in that order, if provided.
62         """
63         train_data = None if train is None else cls(path + train, **kwargs)
64         val_data = None if validation is None else cls(path + validation,
65                                                        **kwargs)
66         test_data = None if test is None else cls(path + test, **kwargs)
67         return tuple(d for d in (train_data, val_data, test_data)
68                      if d is not None)
69 
70     def __getitem__(self, i):
71         return self.examples[i]
72 
73     def __len__(self):
74         try:
75             return len(self.examples)
76         except TypeError:
77             return 2**32
78 
79     def __iter__(self):
80         for x in self.examples:
81             yield x
82 
83     def __getattr__(self, attr):
84         if attr in self.fields:
85             for x in self.examples:
86                 yield getattr(x, attr)
87 
88     @classmethod
89     def download(cls, root, check=None):
90         """Download and unzip an online archive (.zip, .gz, or .tgz).
91 
92         Arguments:
93             root (str): Folder to download data to.
94             check (str or None): Folder whose existence indicates
95                 that the dataset has already been downloaded, or
96                 None to check the existence of root.
97 
98         Returns:
99             dataset_path (str): Path to extracted dataset.
100         """
101         path = os.path.join(root, cls.name)
102         check = path if check is None else check
103         if not os.path.isdir(check):
104             for url in cls.urls:
105                 filename = os.path.basename(url)
106                 zpath = os.path.join(path, filename)
107                 if not os.path.isfile(zpath):
108                     if not os.path.exists(os.path.dirname(zpath)):
109                         os.makedirs(os.path.dirname(zpath))
110                     print('downloading {}'.format(filename))
111                     urllib.request.urlretrieve(url, zpath)
112                 ext = os.path.splitext(filename)[-1]
113                 if ext == '.zip':
114                     with zipfile.ZipFile(zpath, 'r') as zfile:
115                         print('extracting')
116                         zfile.extractall(path)
117                 elif ext in ['.gz', '.tgz']:
118                     with tarfile.open(zpath, 'r:gz') as tar:
119                         dirs = [member for member in tar.getmembers()]
120                         tar.extractall(path=path, members=dirs)
121         return os.path.join(path, cls.dirname)
122 
123 
124 class TabularDataset(Dataset):
125     """Defines a Dataset of columns stored in CSV, TSV, or JSON format."""
126 
127     def __init__(self, path, format, fields, **kwargs):
128         """Create a TabularDataset given a path, file format, and field list.
129 
130         Arguments:
131             path (str): Path to the data file.
132             format (str): The format of the data file. One of "CSV", "TSV", or
133                 "JSON" (case-insensitive).
134             fields (list(tuple(str, Field)) or dict[str, (name, Field)]: For CSV and
135                 TSV formats, list of tuples of (name, field). The list should be in
136                 the same order as the columns in the CSV or TSV file, while tuples of
137                 (name, None) represent columns that will be ignored. For JSON format,
138                 dictionary whose keys are the JSON keys and whose values are tuples of
139                 (name, field). This allows the user to rename columns from their JSON key
140                 names and also enables selecting a subset of columns to load
141                 (since JSON keys not present in the input dictionary are ignored).
142         """
143         make_example = {
144             'json': Example.fromJSON, 'dict': Example.fromdict,
145             'tsv': Example.fromTSV, 'csv': Example.fromCSV}[format.lower()]
146 
147         with io.open(os.path.expanduser(path), encoding="utf8") as f:
148             examples = [make_example(line, fields) for line in f]
149 
150         if make_example in (Example.fromdict, Example.fromJSON):
151             fields, field_dict = [], fields
152             for field in field_dict.values():
153                 if isinstance(field, list):
154                     fields.extend(field)
155                 else:
156                     fields.append(field)
157 
158         super(TabularDataset, self).__init__(examples, fields, **kwargs)
159
```
--- 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()

```

diff --git a/torchtext/data/dataset.py b/torchtext/data/dataset.py
--- a/torchtext/data/dataset.py
+++ b/torchtext/data/dataset.py
@@ -124,14 +124,14 @@
 class TabularDataset(Dataset):
     """Defines a Dataset of columns stored in CSV, TSV, or JSON format."""
 
-    def __init__(self, path, format, fields, **kwargs):
+    def __init__(self, path, format, fields, skip_header=False, **kwargs):
         """Create a TabularDataset given a path, file format, and field list.
 
         Arguments:
             path (str): Path to the data file.
             format (str): The format of the data file. One of "CSV", "TSV", or
                 "JSON" (case-insensitive).
-            fields (list(tuple(str, Field)) or dict[str, (name, Field)]: For CSV and
+            fields (list(tuple(str, Field)) or dict[str: tuple(str, Field)]: For CSV and
                 TSV formats, list of tuples of (name, field). The list should be in
                 the same order as the columns in the CSV or TSV file, while tuples of
                 (name, None) represent columns that will be ignored. For JSON format,
@@ -139,12 +139,15 @@
                 (name, field). This allows the user to rename columns from their JSON key
                 names and also enables selecting a subset of columns to load
                 (since JSON keys not present in the input dictionary are ignored).
+            skip_header (bool): Whether to skip the first line of the input file.
         """
         make_example = {
             'json': Example.fromJSON, 'dict': Example.fromdict,
             'tsv': Example.fromTSV, 'csv': Example.fromCSV}[format.lower()]
 
         with io.open(os.path.expanduser(path), encoding="utf8") as f:
+            if skip_header:
+                next(f)
             examples = [make_example(line, fields) for line in f]
 
         if make_example in (Example.fromdict, Example.fromJSON):

{"golden_diff": "diff --git a/torchtext/data/dataset.py b/torchtext/data/dataset.py\n--- a/torchtext/data/dataset.py\n+++ b/torchtext/data/dataset.py\n@@ -124,14 +124,14 @@\n class TabularDataset(Dataset):\n     \"\"\"Defines a Dataset of columns stored in CSV, TSV, or JSON format.\"\"\"\n \n-    def __init__(self, path, format, fields, **kwargs):\n+    def __init__(self, path, format, fields, skip_header=False, **kwargs):\n         \"\"\"Create a TabularDataset given a path, file format, and field list.\n \n         Arguments:\n             path (str): Path to the data file.\n             format (str): The format of the data file. One of \"CSV\", \"TSV\", or\n                 \"JSON\" (case-insensitive).\n-            fields (list(tuple(str, Field)) or dict[str, (name, Field)]: For CSV and\n+            fields (list(tuple(str, Field)) or dict[str: tuple(str, Field)]: For CSV and\n                 TSV formats, list of tuples of (name, field). The list should be in\n                 the same order as the columns in the CSV or TSV file, while tuples of\n                 (name, None) represent columns that will be ignored. For JSON format,\n@@ -139,12 +139,15 @@\n                 (name, field). This allows the user to rename columns from their JSON key\n                 names and also enables selecting a subset of columns to load\n                 (since JSON keys not present in the input dictionary are ignored).\n+            skip_header (bool): Whether to skip the first line of the input file.\n         \"\"\"\n         make_example = {\n             'json': Example.fromJSON, 'dict': Example.fromdict,\n             'tsv': Example.fromTSV, 'csv': Example.fromCSV}[format.lower()]\n \n         with io.open(os.path.expanduser(path), encoding=\"utf8\") as f:\n+            if skip_header:\n+                next(f)\n             examples = [make_example(line, fields) for line in f]\n \n         if make_example in (Example.fromdict, Example.fromJSON):\n", "issue": "Escape csv header lines\nI haven't been able to see how to skip first csv line in case of loading from a file with header. I could of course preprocess the file, but it'd be nice if there was an option to TabularDataset to tell it to skip the first line.\n", "before_files": [{"content": "import io\nimport os\nimport zipfile\nimport tarfile\n\nimport torch.utils.data\nfrom six.moves import urllib\n\nfrom .example import Example\n\n\nclass Dataset(torch.utils.data.Dataset):\n    \"\"\"Defines a dataset composed of Examples along with its Fields.\n\n    Attributes:\n        sort_key (callable): A key to use for sorting dataset examples for batching\n            together examples with similar lengths to minimize padding.\n        examples (list(Example)): The examples in this dataset.\n            fields: A dictionary containing the name of each column together with\n            its corresponding Field object. Two columns with the same Field\n            object will share a vocabulary.\n        fields (dict[str, Field]): Contains the name of each column or field, together\n            with the corresponding Field object. Two fields with the same Field object\n            will have a shared vocabulary.\n    \"\"\"\n    sort_key = None\n\n    def __init__(self, examples, fields, filter_pred=None):\n        \"\"\"Create a dataset from a list of Examples and Fields.\n\n        Arguments:\n            examples: List of Examples.\n            fields (List(tuple(str, Field))): The Fields to use in this tuple. The\n                string is a field name, and the Field is the associated field.\n            filter_pred (callable or None): Use only examples for which\n                filter_pred(example) is True, or use all examples if None.\n                Default is None.\n        \"\"\"\n        if filter_pred is not None:\n            examples = list(filter(filter_pred, examples))\n        self.examples = examples\n        self.fields = dict(fields)\n\n    @classmethod\n    def splits(cls, path, train=None, validation=None, test=None, **kwargs):\n        \"\"\"Create Dataset objects for multiple splits of a dataset.\n\n        Arguments:\n            path (str): Common prefix of the splits' file paths.\n            train (str): Suffix to add to path for the train set, or None for no\n                train set. Default is None.\n            validation (str): Suffix to add to path for the validation set, or None\n                for no validation set. Default is None.\n            test (str): Suffix to add to path for the test set, or None for no test\n                set. Default is None.\n            Remaining keyword arguments: Passed to the constructor of the\n                Dataset (sub)class being used.\n\n        Returns:\n            split_datasets (tuple(Dataset)): Datasets for train, validation, and\n                test splits in that order, if provided.\n        \"\"\"\n        train_data = None if train is None else cls(path + train, **kwargs)\n        val_data = None if validation is None else cls(path + validation,\n                                                       **kwargs)\n        test_data = None if test is None else cls(path + test, **kwargs)\n        return tuple(d for d in (train_data, val_data, test_data)\n                     if d is not None)\n\n    def __getitem__(self, i):\n        return self.examples[i]\n\n    def __len__(self):\n        try:\n            return len(self.examples)\n        except TypeError:\n            return 2**32\n\n    def __iter__(self):\n        for x in self.examples:\n            yield x\n\n    def __getattr__(self, attr):\n        if attr in self.fields:\n            for x in self.examples:\n                yield getattr(x, attr)\n\n    @classmethod\n    def download(cls, root, check=None):\n        \"\"\"Download and unzip an online archive (.zip, .gz, or .tgz).\n\n        Arguments:\n            root (str): Folder to download data to.\n            check (str or None): Folder whose existence indicates\n                that the dataset has already been downloaded, or\n                None to check the existence of root.\n\n        Returns:\n            dataset_path (str): Path to extracted dataset.\n        \"\"\"\n        path = os.path.join(root, cls.name)\n        check = path if check is None else check\n        if not os.path.isdir(check):\n            for url in cls.urls:\n                filename = os.path.basename(url)\n                zpath = os.path.join(path, filename)\n                if not os.path.isfile(zpath):\n                    if not os.path.exists(os.path.dirname(zpath)):\n                        os.makedirs(os.path.dirname(zpath))\n                    print('downloading {}'.format(filename))\n                    urllib.request.urlretrieve(url, zpath)\n                ext = os.path.splitext(filename)[-1]\n                if ext == '.zip':\n                    with zipfile.ZipFile(zpath, 'r') as zfile:\n                        print('extracting')\n                        zfile.extractall(path)\n                elif ext in ['.gz', '.tgz']:\n                    with tarfile.open(zpath, 'r:gz') as tar:\n                        dirs = [member for member in tar.getmembers()]\n                        tar.extractall(path=path, members=dirs)\n        return os.path.join(path, cls.dirname)\n\n\nclass TabularDataset(Dataset):\n    \"\"\"Defines a Dataset of columns stored in CSV, TSV, or JSON format.\"\"\"\n\n    def __init__(self, path, format, fields, **kwargs):\n        \"\"\"Create a TabularDataset given a path, file format, and field list.\n\n        Arguments:\n            path (str): Path to the data file.\n            format (str): The format of the data file. One of \"CSV\", \"TSV\", or\n                \"JSON\" (case-insensitive).\n            fields (list(tuple(str, Field)) or dict[str, (name, Field)]: For CSV and\n                TSV formats, list of tuples of (name, field). The list should be in\n                the same order as the columns in the CSV or TSV file, while tuples of\n                (name, None) represent columns that will be ignored. For JSON format,\n                dictionary whose keys are the JSON keys and whose values are tuples of\n                (name, field). This allows the user to rename columns from their JSON key\n                names and also enables selecting a subset of columns to load\n                (since JSON keys not present in the input dictionary are ignored).\n        \"\"\"\n        make_example = {\n            'json': Example.fromJSON, 'dict': Example.fromdict,\n            'tsv': Example.fromTSV, 'csv': Example.fromCSV}[format.lower()]\n\n        with io.open(os.path.expanduser(path), encoding=\"utf8\") as f:\n            examples = [make_example(line, fields) for line in f]\n\n        if make_example in (Example.fromdict, Example.fromJSON):\n            fields, field_dict = [], fields\n            for field in field_dict.values():\n                if isinstance(field, list):\n                    fields.extend(field)\n                else:\n                    fields.append(field)\n\n        super(TabularDataset, self).__init__(examples, fields, **kwargs)\n", "path": "torchtext/data/dataset.py"}], "after_files": [{"content": "import io\nimport os\nimport zipfile\nimport tarfile\n\nimport torch.utils.data\nfrom six.moves import urllib\n\nfrom .example import Example\n\n\nclass Dataset(torch.utils.data.Dataset):\n    \"\"\"Defines a dataset composed of Examples along with its Fields.\n\n    Attributes:\n        sort_key (callable): A key to use for sorting dataset examples for batching\n            together examples with similar lengths to minimize padding.\n        examples (list(Example)): The examples in this dataset.\n            fields: A dictionary containing the name of each column together with\n            its corresponding Field object. Two columns with the same Field\n            object will share a vocabulary.\n        fields (dict[str, Field]): Contains the name of each column or field, together\n            with the corresponding Field object. Two fields with the same Field object\n            will have a shared vocabulary.\n    \"\"\"\n    sort_key = None\n\n    def __init__(self, examples, fields, filter_pred=None):\n        \"\"\"Create a dataset from a list of Examples and Fields.\n\n        Arguments:\n            examples: List of Examples.\n            fields (List(tuple(str, Field))): The Fields to use in this tuple. The\n                string is a field name, and the Field is the associated field.\n            filter_pred (callable or None): Use only examples for which\n                filter_pred(example) is True, or use all examples if None.\n                Default is None.\n        \"\"\"\n        if filter_pred is not None:\n            examples = list(filter(filter_pred, examples))\n        self.examples = examples\n        self.fields = dict(fields)\n\n    @classmethod\n    def splits(cls, path, train=None, validation=None, test=None, **kwargs):\n        \"\"\"Create Dataset objects for multiple splits of a dataset.\n\n        Arguments:\n            path (str): Common prefix of the splits' file paths.\n            train (str): Suffix to add to path for the train set, or None for no\n                train set. Default is None.\n            validation (str): Suffix to add to path for the validation set, or None\n                for no validation set. Default is None.\n            test (str): Suffix to add to path for the test set, or None for no test\n                set. Default is None.\n            Remaining keyword arguments: Passed to the constructor of the\n                Dataset (sub)class being used.\n\n        Returns:\n            split_datasets (tuple(Dataset)): Datasets for train, validation, and\n                test splits in that order, if provided.\n        \"\"\"\n        train_data = None if train is None else cls(path + train, **kwargs)\n        val_data = None if validation is None else cls(path + validation,\n                                                       **kwargs)\n        test_data = None if test is None else cls(path + test, **kwargs)\n        return tuple(d for d in (train_data, val_data, test_data)\n                     if d is not None)\n\n    def __getitem__(self, i):\n        return self.examples[i]\n\n    def __len__(self):\n        try:\n            return len(self.examples)\n        except TypeError:\n            return 2**32\n\n    def __iter__(self):\n        for x in self.examples:\n            yield x\n\n    def __getattr__(self, attr):\n        if attr in self.fields:\n            for x in self.examples:\n                yield getattr(x, attr)\n\n    @classmethod\n    def download(cls, root, check=None):\n        \"\"\"Download and unzip an online archive (.zip, .gz, or .tgz).\n\n        Arguments:\n            root (str): Folder to download data to.\n            check (str or None): Folder whose existence indicates\n                that the dataset has already been downloaded, or\n                None to check the existence of root.\n\n        Returns:\n            dataset_path (str): Path to extracted dataset.\n        \"\"\"\n        path = os.path.join(root, cls.name)\n        check = path if check is None else check\n        if not os.path.isdir(check):\n            for url in cls.urls:\n                filename = os.path.basename(url)\n                zpath = os.path.join(path, filename)\n                if not os.path.isfile(zpath):\n                    if not os.path.exists(os.path.dirname(zpath)):\n                        os.makedirs(os.path.dirname(zpath))\n                    print('downloading {}'.format(filename))\n                    urllib.request.urlretrieve(url, zpath)\n                ext = os.path.splitext(filename)[-1]\n                if ext == '.zip':\n                    with zipfile.ZipFile(zpath, 'r') as zfile:\n                        print('extracting')\n                        zfile.extractall(path)\n                elif ext in ['.gz', '.tgz']:\n                    with tarfile.open(zpath, 'r:gz') as tar:\n                        dirs = [member for member in tar.getmembers()]\n                        tar.extractall(path=path, members=dirs)\n        return os.path.join(path, cls.dirname)\n\n\nclass TabularDataset(Dataset):\n    \"\"\"Defines a Dataset of columns stored in CSV, TSV, or JSON format.\"\"\"\n\n    def __init__(self, path, format, fields, skip_header=False, **kwargs):\n        \"\"\"Create a TabularDataset given a path, file format, and field list.\n\n        Arguments:\n            path (str): Path to the data file.\n            format (str): The format of the data file. One of \"CSV\", \"TSV\", or\n                \"JSON\" (case-insensitive).\n            fields (list(tuple(str, Field)) or dict[str: tuple(str, Field)]: For CSV and\n                TSV formats, list of tuples of (name, field). The list should be in\n                the same order as the columns in the CSV or TSV file, while tuples of\n                (name, None) represent columns that will be ignored. For JSON format,\n                dictionary whose keys are the JSON keys and whose values are tuples of\n                (name, field). This allows the user to rename columns from their JSON key\n                names and also enables selecting a subset of columns to load\n                (since JSON keys not present in the input dictionary are ignored).\n            skip_header (bool): Whether to skip the first line of the input file.\n        \"\"\"\n        make_example = {\n            'json': Example.fromJSON, 'dict': Example.fromdict,\n            'tsv': Example.fromTSV, 'csv': Example.fromCSV}[format.lower()]\n\n        with io.open(os.path.expanduser(path), encoding=\"utf8\") as f:\n            if skip_header:\n                next(f)\n            examples = [make_example(line, fields) for line in f]\n\n        if make_example in (Example.fromdict, Example.fromJSON):\n            fields, field_dict = [], fields\n            for field in field_dict.values():\n                if isinstance(field, list):\n                    fields.extend(field)\n                else:\n                    fields.append(field)\n\n        super(TabularDataset, self).__init__(examples, fields, **kwargs)\n", "path": "torchtext/data/dataset.py"}]}