prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Why using repeated dataset in val_dataloader ?
  ### Prerequisite
  
  - [X] I have searched [Issues](https://github.com/open-mmlab/mmdetection/issues) and [Discussions](https://github.com/open-mmlab/mmdetection/discussions) but cannot get the expected help.
  - [X] I have read the [FAQ documentation](https://mmdetection.readthedocs.io/en/latest/faq.html) but cannot get the expected help.
  - [X] The bug has not been fixed in the [latest version (master)](https://github.com/open-mmlab/mmdetection) or [latest version (3.x)](https://github.com/open-mmlab/mmdetection/tree/dev-3.x).
  
  ### Task
  
  I'm using the official example scripts/configs for the officially supported tasks/models/datasets.
  
  ### Branch
  
  3.x branch https://github.com/open-mmlab/mmdetection/tree/3.x
  
  ### Environment
  
  https://github.com/open-mmlab/mmdetection/blob/3.x/configs/common/ms_3x_coco-instance.py#L53
  
  ### Reproduces the problem - code sample
  
  https://github.com/open-mmlab/mmdetection/blob/3.x/configs/common/ms_3x_coco-instance.py#L53
  
  ### Reproduces the problem - command or script
  
  https://github.com/open-mmlab/mmdetection/blob/3.x/configs/common/ms_3x_coco-instance.py#L53
  
  ### Reproduces the problem - error message
  
  https://github.com/open-mmlab/mmdetection/blob/3.x/configs/common/ms_3x_coco-instance.py#L53
  
  ### Additional information
  
  https://github.com/open-mmlab/mmdetection/blob/3.x/configs/common/ms_3x_coco-instance.py#L53
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `configs/common/ms_3x_coco-instance.py`
  Content:
  ```
  1 _base_ = '../_base_/default_runtime.py'
  2 
  3 # dataset settings
  4 dataset_type = 'CocoDataset'
  5 data_root = 'data/coco/'
  6 
  7 # Example to use different file client
  8 # Method 1: simply set the data root and let the file I/O module
  9 # automatically infer from prefix (not support LMDB and Memcache yet)
  10 
  11 # data_root = 's3://openmmlab/datasets/detection/coco/'
  12 
  13 # Method 2: Use `backend_args`, `file_client_args` in versions before 3.0.0rc6
  14 # backend_args = dict(
  15 #     backend='petrel',
  16 #     path_mapping=dict({
  17 #         './data/': 's3://openmmlab/datasets/detection/',
  18 #         'data/': 's3://openmmlab/datasets/detection/'
  19 #     }))
  20 backend_args = None
  21 
  22 train_pipeline = [
  23     dict(type='LoadImageFromFile', backend_args=backend_args),
  24     dict(type='LoadAnnotations', with_bbox=True, with_mask=True),
  25     dict(
  26         type='RandomResize', scale=[(1333, 640), (1333, 800)],
  27         keep_ratio=True),
  28     dict(type='RandomFlip', prob=0.5),
  29     dict(type='PackDetInputs')
  30 ]
  31 test_pipeline = [
  32     dict(type='LoadImageFromFile', backend_args=backend_args),
  33     dict(type='Resize', scale=(1333, 800), keep_ratio=True),
  34     dict(type='LoadAnnotations', with_bbox=True, with_mask=True),
  35     dict(
  36         type='PackDetInputs',
  37         meta_keys=('img_id', 'img_path', 'ori_shape', 'img_shape',
  38                    'scale_factor'))
  39 ]
  40 train_dataloader = dict(
  41     batch_size=2,
  42     num_workers=2,
  43     persistent_workers=True,
  44     sampler=dict(type='DefaultSampler', shuffle=True),
  45     batch_sampler=dict(type='AspectRatioBatchSampler'),
  46     dataset=dict(
  47         type=dataset_type,
  48         data_root=data_root,
  49         ann_file='annotations/instances_train2017.json',
  50         data_prefix=dict(img='train2017/'),
  51         filter_cfg=dict(filter_empty_gt=True, min_size=32),
  52         pipeline=train_pipeline,
  53         backend_args=backend_args))
  54 val_dataloader = dict(
  55     batch_size=2,
  56     num_workers=2,
  57     persistent_workers=True,
  58     drop_last=False,
  59     sampler=dict(type='DefaultSampler', shuffle=False),
  60     dataset=dict(
  61         type='RepeatDataset',
  62         times=3,
  63         dataset=dict(
  64             type=dataset_type,
  65             data_root=data_root,
  66             ann_file='annotations/instances_val2017.json',
  67             data_prefix=dict(img='val2017/'),
  68             test_mode=True,
  69             pipeline=test_pipeline,
  70             backend_args=backend_args)))
  71 test_dataloader = val_dataloader
  72 
  73 val_evaluator = dict(
  74     type='CocoMetric',
  75     ann_file=data_root + 'annotations/instances_val2017.json',
  76     metric='bbox',
  77     backend_args=backend_args)
  78 test_evaluator = val_evaluator
  79 
  80 # training schedule for 3x with `RepeatDataset`
  81 train_cfg = dict(type='EpochBasedTrainLoop', max_epochs=12, val_interval=1)
  82 val_cfg = dict(type='ValLoop')
  83 test_cfg = dict(type='TestLoop')
  84 
  85 # learning rate
  86 # Experiments show that using milestones=[9, 11] has higher performance
  87 param_scheduler = [
  88     dict(
  89         type='LinearLR', start_factor=0.001, by_epoch=False, begin=0, end=500),
  90     dict(
  91         type='MultiStepLR',
  92         begin=0,
  93         end=12,
  94         by_epoch=True,
  95         milestones=[9, 11],
  96         gamma=0.1)
  97 ]
  98 
  99 # optimizer
  100 optim_wrapper = dict(
  101     type='OptimWrapper',
  102     optimizer=dict(type='SGD', lr=0.02, momentum=0.9, weight_decay=0.0001))
  103 
  104 # Default setting for scaling LR automatically
  105 #   - `enable` means enable scaling LR automatically
  106 #       or not by default.
  107 #   - `base_batch_size` = (8 GPUs) x (2 samples per GPU).
  108 auto_scale_lr = dict(enable=False, base_batch_size=16)
  109
  ```
  --- 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/configs/common/ms_3x_coco-instance.py b/configs/common/ms_3x_coco-instance.py
  --- a/configs/common/ms_3x_coco-instance.py
  +++ b/configs/common/ms_3x_coco-instance.py
  @@ -43,31 +43,31 @@
       persistent_workers=True,
       sampler=dict(type='DefaultSampler', shuffle=True),
       batch_sampler=dict(type='AspectRatioBatchSampler'),
  -    dataset=dict(
  -        type=dataset_type,
  -        data_root=data_root,
  -        ann_file='annotations/instances_train2017.json',
  -        data_prefix=dict(img='train2017/'),
  -        filter_cfg=dict(filter_empty_gt=True, min_size=32),
  -        pipeline=train_pipeline,
  -        backend_args=backend_args))
  -val_dataloader = dict(
  -    batch_size=2,
  -    num_workers=2,
  -    persistent_workers=True,
  -    drop_last=False,
  -    sampler=dict(type='DefaultSampler', shuffle=False),
       dataset=dict(
           type='RepeatDataset',
           times=3,
           dataset=dict(
               type=dataset_type,
               data_root=data_root,
  -            ann_file='annotations/instances_val2017.json',
  -            data_prefix=dict(img='val2017/'),
  -            test_mode=True,
  -            pipeline=test_pipeline,
  +            ann_file='annotations/instances_train2017.json',
  +            data_prefix=dict(img='train2017/'),
  +            filter_cfg=dict(filter_empty_gt=True, min_size=32),
  +            pipeline=train_pipeline,
               backend_args=backend_args)))
  +val_dataloader = dict(
  +    batch_size=1,
  +    num_workers=2,
  +    persistent_workers=True,
  +    drop_last=False,
  +    sampler=dict(type='DefaultSampler', shuffle=False),
  +    dataset=dict(
  +        type=dataset_type,
  +        data_root=data_root,
  +        ann_file='annotations/instances_val2017.json',
  +        data_prefix=dict(img='val2017/'),
  +        test_mode=True,
  +        pipeline=test_pipeline,
  +        backend_args=backend_args))
   test_dataloader = val_dataloader
   
   val_evaluator = dict(
  
verification_info: {"golden_diff": "diff --git a/configs/common/ms_3x_coco-instance.py b/configs/common/ms_3x_coco-instance.py\n--- a/configs/common/ms_3x_coco-instance.py\n+++ b/configs/common/ms_3x_coco-instance.py\n@@ -43,31 +43,31 @@\n     persistent_workers=True,\n     sampler=dict(type='DefaultSampler', shuffle=True),\n     batch_sampler=dict(type='AspectRatioBatchSampler'),\n-    dataset=dict(\n-        type=dataset_type,\n-        data_root=data_root,\n-        ann_file='annotations/instances_train2017.json',\n-        data_prefix=dict(img='train2017/'),\n-        filter_cfg=dict(filter_empty_gt=True, min_size=32),\n-        pipeline=train_pipeline,\n-        backend_args=backend_args))\n-val_dataloader = dict(\n-    batch_size=2,\n-    num_workers=2,\n-    persistent_workers=True,\n-    drop_last=False,\n-    sampler=dict(type='DefaultSampler', shuffle=False),\n     dataset=dict(\n         type='RepeatDataset',\n         times=3,\n         dataset=dict(\n             type=dataset_type,\n             data_root=data_root,\n-            ann_file='annotations/instances_val2017.json',\n-            data_prefix=dict(img='val2017/'),\n-            test_mode=True,\n-            pipeline=test_pipeline,\n+            ann_file='annotations/instances_train2017.json',\n+            data_prefix=dict(img='train2017/'),\n+            filter_cfg=dict(filter_empty_gt=True, min_size=32),\n+            pipeline=train_pipeline,\n             backend_args=backend_args)))\n+val_dataloader = dict(\n+    batch_size=1,\n+    num_workers=2,\n+    persistent_workers=True,\n+    drop_last=False,\n+    sampler=dict(type='DefaultSampler', shuffle=False),\n+    dataset=dict(\n+        type=dataset_type,\n+        data_root=data_root,\n+        ann_file='annotations/instances_val2017.json',\n+        data_prefix=dict(img='val2017/'),\n+        test_mode=True,\n+        pipeline=test_pipeline,\n+        backend_args=backend_args))\n test_dataloader = val_dataloader\n \n val_evaluator = dict(\n", "issue": "Why using repeated dataset in val_dataloader ?\n### Prerequisite\n\n- [X] I have searched [Issues](https://github.com/open-mmlab/mmdetection/issues) and [Discussions](https://github.com/open-mmlab/mmdetection/discussions) but cannot get the expected help.\n- [X] I have read the [FAQ documentation](https://mmdetection.readthedocs.io/en/latest/faq.html) but cannot get the expected help.\n- [X] The bug has not been fixed in the [latest version (master)](https://github.com/open-mmlab/mmdetection) or [latest version (3.x)](https://github.com/open-mmlab/mmdetection/tree/dev-3.x).\n\n### Task\n\nI'm using the official example scripts/configs for the officially supported tasks/models/datasets.\n\n### Branch\n\n3.x branch https://github.com/open-mmlab/mmdetection/tree/3.x\n\n### Environment\n\nhttps://github.com/open-mmlab/mmdetection/blob/3.x/configs/common/ms_3x_coco-instance.py#L53\n\n### Reproduces the problem - code sample\n\nhttps://github.com/open-mmlab/mmdetection/blob/3.x/configs/common/ms_3x_coco-instance.py#L53\n\n### Reproduces the problem - command or script\n\nhttps://github.com/open-mmlab/mmdetection/blob/3.x/configs/common/ms_3x_coco-instance.py#L53\n\n### Reproduces the problem - error message\n\nhttps://github.com/open-mmlab/mmdetection/blob/3.x/configs/common/ms_3x_coco-instance.py#L53\n\n### Additional information\n\nhttps://github.com/open-mmlab/mmdetection/blob/3.x/configs/common/ms_3x_coco-instance.py#L53\n", "before_files": [{"content": "_base_ = '../_base_/default_runtime.py'\n\n# dataset settings\ndataset_type = 'CocoDataset'\ndata_root = 'data/coco/'\n\n# Example to use different file client\n# Method 1: simply set the data root and let the file I/O module\n# automatically infer from prefix (not support LMDB and Memcache yet)\n\n# data_root = 's3://openmmlab/datasets/detection/coco/'\n\n# Method 2: Use `backend_args`, `file_client_args` in versions before 3.0.0rc6\n# backend_args = dict(\n#     backend='petrel',\n#     path_mapping=dict({\n#         './data/': 's3://openmmlab/datasets/detection/',\n#         'data/': 's3://openmmlab/datasets/detection/'\n#     }))\nbackend_args = None\n\ntrain_pipeline = [\n    dict(type='LoadImageFromFile', backend_args=backend_args),\n    dict(type='LoadAnnotations', with_bbox=True, with_mask=True),\n    dict(\n        type='RandomResize', scale=[(1333, 640), (1333, 800)],\n        keep_ratio=True),\n    dict(type='RandomFlip', prob=0.5),\n    dict(type='PackDetInputs')\n]\ntest_pipeline = [\n    dict(type='LoadImageFromFile', backend_args=backend_args),\n    dict(type='Resize', scale=(1333, 800), keep_ratio=True),\n    dict(type='LoadAnnotations', with_bbox=True, with_mask=True),\n    dict(\n        type='PackDetInputs',\n        meta_keys=('img_id', 'img_path', 'ori_shape', 'img_shape',\n                   'scale_factor'))\n]\ntrain_dataloader = dict(\n    batch_size=2,\n    num_workers=2,\n    persistent_workers=True,\n    sampler=dict(type='DefaultSampler', shuffle=True),\n    batch_sampler=dict(type='AspectRatioBatchSampler'),\n    dataset=dict(\n        type=dataset_type,\n        data_root=data_root,\n        ann_file='annotations/instances_train2017.json',\n        data_prefix=dict(img='train2017/'),\n        filter_cfg=dict(filter_empty_gt=True, min_size=32),\n        pipeline=train_pipeline,\n        backend_args=backend_args))\nval_dataloader = dict(\n    batch_size=2,\n    num_workers=2,\n    persistent_workers=True,\n    drop_last=False,\n    sampler=dict(type='DefaultSampler', shuffle=False),\n    dataset=dict(\n        type='RepeatDataset',\n        times=3,\n        dataset=dict(\n            type=dataset_type,\n            data_root=data_root,\n            ann_file='annotations/instances_val2017.json',\n            data_prefix=dict(img='val2017/'),\n            test_mode=True,\n            pipeline=test_pipeline,\n            backend_args=backend_args)))\ntest_dataloader = val_dataloader\n\nval_evaluator = dict(\n    type='CocoMetric',\n    ann_file=data_root + 'annotations/instances_val2017.json',\n    metric='bbox',\n    backend_args=backend_args)\ntest_evaluator = val_evaluator\n\n# training schedule for 3x with `RepeatDataset`\ntrain_cfg = dict(type='EpochBasedTrainLoop', max_epochs=12, val_interval=1)\nval_cfg = dict(type='ValLoop')\ntest_cfg = dict(type='TestLoop')\n\n# learning rate\n# Experiments show that using milestones=[9, 11] has higher performance\nparam_scheduler = [\n    dict(\n        type='LinearLR', start_factor=0.001, by_epoch=False, begin=0, end=500),\n    dict(\n        type='MultiStepLR',\n        begin=0,\n        end=12,\n        by_epoch=True,\n        milestones=[9, 11],\n        gamma=0.1)\n]\n\n# optimizer\noptim_wrapper = dict(\n    type='OptimWrapper',\n    optimizer=dict(type='SGD', lr=0.02, momentum=0.9, weight_decay=0.0001))\n\n# Default setting for scaling LR automatically\n#   - `enable` means enable scaling LR automatically\n#       or not by default.\n#   - `base_batch_size` = (8 GPUs) x (2 samples per GPU).\nauto_scale_lr = dict(enable=False, base_batch_size=16)\n", "path": "configs/common/ms_3x_coco-instance.py"}], "after_files": [{"content": "_base_ = '../_base_/default_runtime.py'\n\n# dataset settings\ndataset_type = 'CocoDataset'\ndata_root = 'data/coco/'\n\n# Example to use different file client\n# Method 1: simply set the data root and let the file I/O module\n# automatically infer from prefix (not support LMDB and Memcache yet)\n\n# data_root = 's3://openmmlab/datasets/detection/coco/'\n\n# Method 2: Use `backend_args`, `file_client_args` in versions before 3.0.0rc6\n# backend_args = dict(\n#     backend='petrel',\n#     path_mapping=dict({\n#         './data/': 's3://openmmlab/datasets/detection/',\n#         'data/': 's3://openmmlab/datasets/detection/'\n#     }))\nbackend_args = None\n\ntrain_pipeline = [\n    dict(type='LoadImageFromFile', backend_args=backend_args),\n    dict(type='LoadAnnotations', with_bbox=True, with_mask=True),\n    dict(\n        type='RandomResize', scale=[(1333, 640), (1333, 800)],\n        keep_ratio=True),\n    dict(type='RandomFlip', prob=0.5),\n    dict(type='PackDetInputs')\n]\ntest_pipeline = [\n    dict(type='LoadImageFromFile', backend_args=backend_args),\n    dict(type='Resize', scale=(1333, 800), keep_ratio=True),\n    dict(type='LoadAnnotations', with_bbox=True, with_mask=True),\n    dict(\n        type='PackDetInputs',\n        meta_keys=('img_id', 'img_path', 'ori_shape', 'img_shape',\n                   'scale_factor'))\n]\ntrain_dataloader = dict(\n    batch_size=2,\n    num_workers=2,\n    persistent_workers=True,\n    sampler=dict(type='DefaultSampler', shuffle=True),\n    batch_sampler=dict(type='AspectRatioBatchSampler'),\n    dataset=dict(\n        type='RepeatDataset',\n        times=3,\n        dataset=dict(\n            type=dataset_type,\n            data_root=data_root,\n            ann_file='annotations/instances_train2017.json',\n            data_prefix=dict(img='train2017/'),\n            filter_cfg=dict(filter_empty_gt=True, min_size=32),\n            pipeline=train_pipeline,\n            backend_args=backend_args)))\nval_dataloader = dict(\n    batch_size=1,\n    num_workers=2,\n    persistent_workers=True,\n    drop_last=False,\n    sampler=dict(type='DefaultSampler', shuffle=False),\n    dataset=dict(\n        type=dataset_type,\n        data_root=data_root,\n        ann_file='annotations/instances_val2017.json',\n        data_prefix=dict(img='val2017/'),\n        test_mode=True,\n        pipeline=test_pipeline,\n        backend_args=backend_args))\ntest_dataloader = val_dataloader\n\nval_evaluator = dict(\n    type='CocoMetric',\n    ann_file=data_root + 'annotations/instances_val2017.json',\n    metric='bbox',\n    backend_args=backend_args)\ntest_evaluator = val_evaluator\n\n# training schedule for 3x with `RepeatDataset`\ntrain_cfg = dict(type='EpochBasedTrainLoop', max_epochs=12, val_interval=1)\nval_cfg = dict(type='ValLoop')\ntest_cfg = dict(type='TestLoop')\n\n# learning rate\n# Experiments show that using milestones=[9, 11] has higher performance\nparam_scheduler = [\n    dict(\n        type='LinearLR', start_factor=0.001, by_epoch=False, begin=0, end=500),\n    dict(\n        type='MultiStepLR',\n        begin=0,\n        end=12,\n        by_epoch=True,\n        milestones=[9, 11],\n        gamma=0.1)\n]\n\n# optimizer\noptim_wrapper = dict(\n    type='OptimWrapper',\n    optimizer=dict(type='SGD', lr=0.02, momentum=0.9, weight_decay=0.0001))\n\n# Default setting for scaling LR automatically\n#   - `enable` means enable scaling LR automatically\n#       or not by default.\n#   - `base_batch_size` = (8 GPUs) x (2 samples per GPU).\nauto_scale_lr = dict(enable=False, base_batch_size=16)\n", "path": "configs/common/ms_3x_coco-instance.py"}]}