Extract warnings from CI artifacts
Author: ydshieh
Pull request: yes

# What does this PR do?

The default behavior is to extract the `DeprecationWarning`, but it could be changed by specifying `--targets`.

Currently, I don't use this script in our CI workflow file. If it is desired, we can  add an extra job in our CI  workflow to generate this report at the end, but this could be done in a separate PR if you allow me :-)

Comments:
_The documentation is not available anymore as the PR was closed or merged._

This is the current list of `DeprecationWarning`. I could NOT find any thing from torch/TF/accelerate. Hope I don't miss anything here.


```bash
[
    "/opt/conda/lib/python3.8/site-packages/sklearn/utils/multiclass.py:14: DeprecationWarning: Please use `spmatrix` from the `scipy.sparse` namespace, the `scipy.sparse.base` namespace is deprecated.\nfrom scipy.sparse.base import spmatrix",
    "/transformers/src/transformers/commands/add_new_model_like.py:1079: DeprecationWarning: invalid escape sequence \\s\ncontent = re.sub(\"<!--\\s*Copyright (\\d+)\\s\", f\"<!--Copyright {CURRENT_YEAR} \", content)",
    "/transformers/src/transformers/commands/add_new_model_like.py:1105: DeprecationWarning: invalid escape sequence \\s\nelif re.search(\"^#\\s+\\S+\", block) is not None:",
    "/transformers/src/transformers/commands/add_new_model_like.py:1117: DeprecationWarning: invalid escape sequence \\s\nblock_class = re.search(\"^#+\\s+(\\S.*)$\", block_title).groups()[0]",
    "/transformers/src/transformers/commands/add_new_model_like.py:126: DeprecationWarning: invalid escape sequence \\s\nsearch = re.search(\"^(\\s*)(?:\\S|$)\", line)",
    "/transformers/src/transformers/commands/add_new_model_like.py:427: DeprecationWarning: invalid escape sequence \\d\ncontent = re.sub(\"# Copyright (\\d+)\\s\", f\"# Copyright {CURRENT_YEAR} \", content)",
    "/transformers/src/transformers/commands/add_new_model_like.py:476: DeprecationWarning: invalid escape sequence \\s\nhas_copied_from = re.search(\"^#\\s+Copied from\", obj, flags=re.MULTILINE) is not None",
    "/transformers/src/transformers/commands/add_new_model_like.py:568: DeprecationWarning: invalid escape sequence \\s\n_re_checkpoint_for_doc = re.compile(\"^_CHECKPOINT_FOR_DOC\\s+=\\s+(\\S*)\\s*$\", flags=re.MULTILINE)",
    "/transformers/src/transformers/commands/add_new_model_like.py:811: DeprecationWarning: invalid escape sequence \\s\nre.search('^\\s*\"(tokenization|processing|feature_extraction)', lines[idx]) is None",
    "/transformers/src/transformers/commands/add_new_model_like.py:812: DeprecationWarning: invalid escape sequence \\s\nand re.search(\"^\\s*from .(tokenization|processing|feature_extraction)\", lines[idx]) is None",
    "/transformers/src/transformers/models/deformable_detr/modeling_deformable_detr.py:1796: DeprecationWarning: invalid escape sequence \\.\n_keys_to_ignore_on_load_missing = [\"bbox_embed\\.[1-9]\\d*\", \"class_embed\\.[1-9]\\d*\"]",
    "/transformers/src/transformers/models/deit/image_processing_deit.py:117: DeprecationWarning: BICUBIC is deprecated and will be removed in Pillow 10 (2023-07-01). Use Resampling.BICUBIC instead.\nresample: PILImageResampling = PIL.Image.BICUBIC,",
    "/transformers/src/transformers/models/deit/image_processing_deit.py:86: DeprecationWarning: BICUBIC is deprecated and will be removed in Pillow 10 (2023-07-01). Use Resampling.BICUBIC instead.\nresample: PILImageResampling = PIL.Image.BICUBIC,",
    "/transformers/src/transformers/models/glpn/modeling_glpn.py:637: DeprecationWarning: invalid escape sequence \\s\n\"\"\"",
    "/transformers/src/transformers/models/jukebox/tokenization_jukebox.py:152: DeprecationWarning: invalid escape sequence \\-\noov = \"[^A-Za-z0-9.,:;!?\\-'\\\"()\\[\\] \\t\\n]+\"",
    "/transformers/src/transformers/models/jukebox/tokenization_jukebox.py:155: DeprecationWarning: invalid escape sequence \\-\noov = oov.replace(\"\\-'\", \"\\-+'\")",
    "/transformers/src/transformers/models/jukebox/tokenization_jukebox.py:234: DeprecationWarning: invalid escape sequence \\-\nself.out_of_vocab = regex.compile(\"[^A-Za-z0-9.,:;!?\\-'\\\"()\\[\\] \\t\\n]+\")",
    "/transformers/src/transformers/models/jukebox/tokenization_jukebox.py:243: DeprecationWarning: invalid escape sequence \\-\nself.out_of_vocab = regex.compile(\"[^A-Za-z0-9.,:;!?\\-+'\\\"()\\[\\] \\t\\n]+\")",
    "/transformers/src/transformers/models/maskformer/feature_extraction_maskformer.py:313: DeprecationWarning: NEAREST is deprecated and will be removed in Pillow 10 (2023-07-01). Use Resampling.NEAREST or Dither.NONE instead.\ntarget = self.resize(target, size=size, resample=Image.NEAREST)",
    "/transformers/src/transformers/models/maskformer/modeling_maskformer.py:2066: DeprecationWarning: invalid escape sequence \\e\n\"\"\"",
    "/transformers/src/transformers/models/mobilevit/image_processing_mobilevit.py:141: DeprecationWarning: BILINEAR is deprecated and will be removed in Pillow 10 (2023-07-01). Use Resampling.BILINEAR instead.\nresample: PILImageResampling = PIL.Image.BILINEAR,",
    "/transformers/src/transformers/models/perceiver/image_processing_perceiver.py:156: DeprecationWarning: BICUBIC is deprecated and will be removed in Pillow 10 (2023-07-01). Use Resampling.BICUBIC instead.\nresample: PILImageResampling = PIL.Image.BICUBIC,",
    "/transformers/src/transformers/models/segformer/image_processing_segformer.py:304: DeprecationWarning: NEAREST is deprecated and will be removed in Pillow 10 (2023-07-01). Use Resampling.NEAREST or Dither.NONE instead.\nresample=PIL.Image.NEAREST,",
    "/transformers/src/transformers/models/segformer/image_processing_segformer.py:441: DeprecationWarning: NEAREST is deprecated and will be removed in Pillow 10 (2023-07-01). Use Resampling.NEAREST or Dither.NONE instead.\nresample=PIL.Image.NEAREST,",
    "/transformers/src/transformers/models/t5/tokenization_t5.py:217: DeprecationWarning: invalid escape sequence \\d\nset(filter(lambda x: bool(re.search(\"<extra_id_\\d+>\", x)) is not None, self.additional_special_tokens))",
    "/transformers/src/transformers/models/t5/tokenization_t5_fast.py:240: DeprecationWarning: invalid escape sequence \\d\nset(filter(lambda x: bool(re.search(\"<extra_id_\\d+>\", x)) is not None, self.additional_special_tokens))",
    "/transformers/src/transformers/models/transfo_xl/modeling_transfo_xl.py:1018: DeprecationWarning: The output of TransfoXL will be updated in v5 to support a single loss as first argument. In orderto use that updated output, please specify `trainer_compatible=True` as your configuration attribute.\nwarnings.warn(",
    "/transformers/tests/models/maskformer/test_feature_extraction_maskformer.py:407: DeprecationWarning: Please use assertEqual instead.\nself.assertEquals(inputs[\"mask_labels\"][0].sum().item(), 41527.0)",
    "/transformers/tests/models/maskformer/test_feature_extraction_maskformer.py:408: DeprecationWarning: Please use assertEqual instead.\nself.assertEquals(inputs[\"mask_labels\"][1].sum().item(), 26259.0)",
    "/transformers/tests/models/maskformer/test_feature_extraction_maskformer.py:449: DeprecationWarning: Please use assertEqual instead.\nself.assertEquals(inputs[\"mask_labels\"][0].sum().item(), 170200.0)",
    "/transformers/tests/models/maskformer/test_feature_extraction_maskformer.py:450: DeprecationWarning: Please use assertEqual instead.\nself.assertEquals(inputs[\"mask_labels\"][1].sum().item(), 257036.0)",
    "/transformers/tests/models/maskformer/test_feature_extraction_maskformer.py:514: DeprecationWarning: Please use assertEqual instead.\nself.assertEquals(inputs[\"mask_labels\"][0].sum().item(), 315193.0)",
    "/transformers/tests/models/maskformer/test_feature_extraction_maskformer.py:515: DeprecationWarning: Please use assertEqual instead.\nself.assertEquals(inputs[\"mask_labels\"][1].sum().item(), 350747.0)",
    "/transformers/tests/models/realm/test_modeling_realm.py:394: DeprecationWarning: `np.object` is a deprecated alias for the builtin `object`. To silence this warning, use `object` by itself. Doing this will not modify any behavior and is safe.\nDeprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations\ndtype=np.object,",
    "/transformers/tests/models/realm/test_retrieval_realm.py:103: DeprecationWarning: `np.object` is a deprecated alias for the builtin `object`. To silence this warning, use `object` by itself. Doing this will not modify any behavior and is safe.\nDeprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations\ndtype=np.object,",
    "/transformers/tests/models/realm/test_retrieval_realm.py:119: DeprecationWarning: `np.long` is a deprecated alias for `np.compat.long`. To silence this warning, use `np.compat.long` by itself. In the likely event your code does not need to work on Python 2 you can use the builtin `int` for which `np.compat.long` is itself an alias. Doing this will not modify any behaviour and is safe. When replacing `np.long`, you may wish to use e.g. `np.int64` or `np.int32` to specify the precision. If you wish to review your current use, check the release note link for additional information.\nDeprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations\nretrieved_block_ids = np.array([0, 3], dtype=np.long)",
    "/transformers/tests/models/realm/test_retrieval_realm.py:154: DeprecationWarning: `np.long` is a deprecated alias for `np.compat.long`. To silence this warning, use `np.compat.long` by itself. In the likely event your code does not need to work on Python 2 you can use the builtin `int` for which `np.compat.long` is itself an alias. Doing this will not modify any behaviour and is safe. When replacing `np.long`, you may wish to use e.g. `np.int64` or `np.int32` to specify the precision. If you wish to review your current use, check the release note link for additional information.\nDeprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations\nretrieved_block_ids = np.array([0, 3, 5], dtype=np.long)",
    "/transformers/tests/models/t5/test_tokenization_t5.py:387: DeprecationWarning: Please use assertEqual instead.\nself.assertEquals(len(sentinel_tokens), 10)",
    "/transformers/tests/models/t5/test_tokenization_t5.py:389: DeprecationWarning: invalid escape sequence \\d\nself.assertTrue([re.search(\"<extra_id_\\d+>\", token) is not None for token in sentinel_tokens])",
    "/transformers/tests/models/t5/test_tokenization_t5.py:398: DeprecationWarning: Please use assertEqual instead.\nself.assertEquals(len(sentinel_tokens), 10)",
    "/transformers/tests/models/t5/test_tokenization_t5.py:400: DeprecationWarning: invalid escape sequence \\d\nself.assertTrue([re.search(\"<extra_id_\\d+>\", token) is not None for token in sentinel_tokens])",
    "/transformers/tests/sagemaker/conftest.py:36: DeprecationWarning: invalid escape sequence \\D\n{\"Name\": \"train_runtime\", \"Regex\": \"train_runtime.*=\\D*(.*?)$\"},",
    "/transformers/tests/sagemaker/conftest.py:37: DeprecationWarning: invalid escape sequence \\D\n{\"Name\": \"eval_accuracy\", \"Regex\": \"eval_accuracy.*=\\D*(.*?)$\"},",
    "/transformers/tests/sagemaker/conftest.py:38: DeprecationWarning: invalid escape sequence \\D\n{\"Name\": \"eval_loss\", \"Regex\": \"eval_loss.*=\\D*(.*?)$\"},",
    "/transformers/tests/sagemaker/conftest.py:42: DeprecationWarning: invalid escape sequence \\D\n{\"Name\": \"train_runtime\", \"Regex\": \"train_runtime.*=\\D*(.*?)$\"},",
    "/transformers/tests/sagemaker/conftest.py:43: DeprecationWarning: invalid escape sequence \\D\n{\"Name\": \"eval_accuracy\", \"Regex\": \"loss.*=\\D*(.*?)]?$\"},",
    "/transformers/tests/sagemaker/conftest.py:44: DeprecationWarning: invalid escape sequence \\D\n{\"Name\": \"eval_loss\", \"Regex\": \"sparse_categorical_accuracy.*=\\D*(.*?)]?$\"},",
    "/transformers/tests/utils/test_add_new_model_like.py:156: DeprecationWarning: invalid escape sequence \\s\nself.assertEqual(add_content_to_text(test_text, line, add_before=re.compile('^\\s*\"bert\":')), expected)",
    "/transformers/tests/utils/test_add_new_model_like.py:163: DeprecationWarning: invalid escape sequence \\s\nself.assertEqual(add_content_to_text(test_text, line, add_after=re.compile('^\\s*\"gpt\":')), expected)",
    "/transformers/tests/utils/test_add_new_model_like.py:196: DeprecationWarning: invalid escape sequence \\s\nadd_content_to_file(file_name, line, add_before=re.compile('^\\s*\"bert\":'))",
    "/transformers/tests/utils/test_add_new_model_like.py:212: DeprecationWarning: invalid escape sequence \\s\nadd_content_to_file(file_name, line, add_after=re.compile('^\\s*\"gpt\":'))",
    "/usr/local/lib/python3.8/dist-packages/detectron2/data/transforms/augmentation_impl.py:113: DeprecationWarning: BILINEAR is deprecated and will be removed in Pillow 10 (2023-07-01). Use Resampling.BILINEAR instead.\ndef __init__(self, shape, interp=Image.BILINEAR):",
    "/usr/local/lib/python3.8/dist-packages/detectron2/data/transforms/augmentation_impl.py:140: DeprecationWarning: BILINEAR is deprecated and will be removed in Pillow 10 (2023-07-01). Use Resampling.BILINEAR instead.\nself, short_edge_length, max_size=sys.maxsize, sample_style=\"range\", interp=Image.BILINEAR",
    "/usr/local/lib/python3.8/dist-packages/detectron2/data/transforms/augmentation_impl.py:214: DeprecationWarning: BILINEAR is deprecated and will be removed in Pillow 10 (2023-07-01). Use Resampling.BILINEAR instead.\ninterp: int = Image.BILINEAR,",
    "/usr/local/lib/python3.8/dist-packages/detectron2/data/transforms/augmentation_impl.py:635: DeprecationWarning: BILINEAR is deprecated and will be removed in Pillow 10 (2023-07-01). Use Resampling.BILINEAR instead.\ndef __init__(self, shape_list, interp=Image.BILINEAR):",
    "/usr/local/lib/python3.8/dist-packages/detectron2/data/transforms/transform.py:46: DeprecationWarning: LINEAR is deprecated and will be removed in Pillow 10 (2023-07-01). Use Resampling.BILINEAR instead.\ndef __init__(self, src_rect, output_size, interp=Image.LINEAR, fill=0):",
    "/usr/local/lib/python3.8/dist-packages/tf2onnx/tf_utils.py:58: DeprecationWarning: `np.str` is a deprecated alias for the builtin `str`. To silence this warning, use `str` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.str_` here.\nDeprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations\nnp_data = np_data.astype(np.str).astype(object)",
    "/workspace/transformers/src/transformers/models/t5/tokenization_t5.py:217: DeprecationWarning: invalid escape sequence \\d\nset(filter(lambda x: bool(re.search(\"<extra_id_\\d+>\", x)) is not None, self.additional_special_tokens))",
    "/workspace/transformers/src/transformers/models/t5/tokenization_t5_fast.py:240: DeprecationWarning: invalid escape sequence \\d\nset(filter(lambda x: bool(re.search(\"<extra_id_\\d+>\", x)) is not None, self.additional_special_tokens))"
]
```