# embeddings_queue

created_at: 2024-08-26 20:30:03
topic: persistent://default/default/621deaf2-9359-4ac4-ada0-047176703e13
id: a8637029-957b-4961-a88b-b1995717f30b
encoding: FLOAT32
metadata:
{"url": "https://huggingface.co/docs/transformers/index", "title": "\ud83e\udd17 Transformers", "tokens": 9875, "retrieve_doc": false, "source": "transformers", "_node_content": "{\"id_\": \"a8637029-957b-4961-a88b-b1995717f30b\", \"embedding\": null, \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/index\", \"title\": \"\\ud83e\\udd17 Transformers\", \"tokens\": 9875, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"ae56fe8d-ab49-4ab6-bff5-8b020af1916f\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/index\", \"title\": \"\\ud83e\\udd17 Transformers\", \"tokens\": 9875, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"hash\": \"836865c358dea9b81d80ebb705572b7f9f4dcfd6479dc208d646d8499b9bd468\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"8a6f266d-0a05-4ef0-8da1-0584f4cc6879\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/index\", \"title\": \"\\ud83e\\udd17 Transformers\", \"tokens\": 9875, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"hash\": \"f13d16ca5d3110d9e7db27344eb24788f6689372a0957e4bcb76cf43eb70e719\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"d43bea50-7fb6-4e6c-8234-8bcf06a32a63\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"d33c38c64386fafda00cea812a9b7346e5b8efa0f1dd3c2348c050247fae9f89\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 23066, \"end_char_idx\": 24016, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "ae56fe8d-ab49-4ab6-bff5-8b020af1916f", "doc_id": "ae56fe8d-ab49-4ab6-bff5-8b020af1916f", "ref_doc_id": "ae56fe8d-ab49-4ab6-bff5-8b020af1916f", "chroma:document": "|       \u2705        |         \u274c         |      \u274c      |\n|                           [MMS](model_doc/mms)                           |       \u2705        |         \u2705         |      \u2705      |\n|                    [MobileBERT](model_doc/mobilebert)                    |       \u2705        |         \u2705         |      \u274c      |\n|                  [MobileNetV1](model_doc/mobilenet_v1)                   |       \u2705        |         \u274c         |      \u274c      |\n|                  [MobileNetV2](model_doc/mobilenet_v2)                   |       \u2705        |         \u274c         |      \u274c      |\n|                     [MobileViT](model_doc/mobilevit)                     |       \u2705        |         \u2705         |      \u274c      |\n|                   [MobileViTV2](model_doc/mobilevitv2)                   |       \u2705        |         \u274c         |      \u274c      |\n|                         [MPNet](model_doc/mpnet)                         |       \u2705        |         \u2705         |      \u274c      |\n|"}


created_at: 2024-08-26 20:30:03
topic: persistent://default/default/621deaf2-9359-4ac4-ada0-047176703e13
id: d43bea50-7fb6-4e6c-8234-8bcf06a32a63
encoding: FLOAT32
metadata:
{"url": "https://huggingface.co/docs/transformers/index", "title": "\ud83e\udd17 Transformers", "tokens": 9875, "retrieve_doc": false, "source": "transformers", "_node_content": "{\"id_\": \"d43bea50-7fb6-4e6c-8234-8bcf06a32a63\", \"embedding\": null, \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/index\", \"title\": \"\\ud83e\\udd17 Transformers\", \"tokens\": 9875, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"ae56fe8d-ab49-4ab6-bff5-8b020af1916f\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/index\", \"title\": \"\\ud83e\\udd17 Transformers\", \"tokens\": 9875, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"hash\": \"836865c358dea9b81d80ebb705572b7f9f4dcfd6479dc208d646d8499b9bd468\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"a8637029-957b-4961-a88b-b1995717f30b\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/index\", \"title\": \"\\ud83e\\udd17 Transformers\", \"tokens\": 9875, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"hash\": \"741de6302bf72a8cd2910db23f13518d33e284ae25271cadbcd5fb272f125e18\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"d2d937c4-ab55-4796-bdd9-ba391a86c9af\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"23e2ab7ef252db4597a8444c71ec56eca712691e20d3fb19b39408e19486df90\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 23578, \"end_char_idx\": 24502, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "ae56fe8d-ab49-4ab6-bff5-8b020af1916f", "doc_id": "ae56fe8d-ab49-4ab6-bff5-8b020af1916f", "ref_doc_id": "ae56fe8d-ab49-4ab6-bff5-8b020af1916f", "chroma:document": "|       \u2705        |         \u274c         |      \u274c      |\n|                     [MobileViT](model_doc/mobilevit)                     |       \u2705        |         \u2705         |      \u274c      |\n|                   [MobileViTV2](model_doc/mobilevitv2)                   |       \u2705        |         \u274c         |      \u274c      |\n|                         [MPNet](model_doc/mpnet)                         |       \u2705        |         \u2705         |      \u274c      |\n|                           [MPT](model_doc/mpt)                           |       \u2705        |         \u274c         |      \u274c      |\n|                           [MRA](model_doc/mra)                           |       \u2705        |         \u274c         |      \u274c      |\n|                           [MT5](model_doc/mt5)                           |       \u2705        |         \u2705         |      \u2705      |\n|                      [MusicGen](model_doc/musicgen)                      |       \u2705        |         \u274c"}


created_at: 2024-08-26 20:30:03
topic: persistent://default/default/621deaf2-9359-4ac4-ada0-047176703e13
id: d2d937c4-ab55-4796-bdd9-ba391a86c9af
encoding: FLOAT32
metadata:
{"url": "https://huggingface.co/docs/transformers/index", "title": "\ud83e\udd17 Transformers", "tokens": 9875, "retrieve_doc": false, "source": "transformers", "_node_content": "{\"id_\": \"d2d937c4-ab55-4796-bdd9-ba391a86c9af\", \"embedding\": null, \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/index\", \"title\": \"\\ud83e\\udd17 Transformers\", \"tokens\": 9875, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"ae56fe8d-ab49-4ab6-bff5-8b020af1916f\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/index\", \"title\": \"\\ud83e\\udd17 Transformers\", \"tokens\": 9875, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"hash\": \"836865c358dea9b81d80ebb705572b7f9f4dcfd6479dc208d646d8499b9bd468\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"d43bea50-7fb6-4e6c-8234-8bcf06a32a63\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/index\", \"title\": \"\\ud83e\\udd17 Transformers\", \"tokens\": 9875, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"hash\": \"c8834468aed62e86bc9694607669958b7f6f3bc208213d3d61677f28ad10eef1\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"f0de7de4-1e13-4e20-9201-b46e23ebfd21\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"e052ec8007c8e808f4c59a6ca7cadb2e66a589f3858b78e5b4f3c84a7fa48e47\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 24043, \"end_char_idx\": 24964, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "ae56fe8d-ab49-4ab6-bff5-8b020af1916f", "doc_id": "ae56fe8d-ab49-4ab6-bff5-8b020af1916f", "ref_doc_id": "ae56fe8d-ab49-4ab6-bff5-8b020af1916f", "chroma:document": "[MPT](model_doc/mpt)                           |       \u2705        |         \u274c         |      \u274c      |\n|                           [MRA](model_doc/mra)                           |       \u2705        |         \u274c         |      \u274c      |\n|                           [MT5](model_doc/mt5)                           |       \u2705        |         \u2705         |      \u2705      |\n|                      [MusicGen](model_doc/musicgen)                      |       \u2705        |         \u274c         |      \u274c      |\n|               [MusicGen Melody](model_doc/musicgen_melody)               |       \u2705        |         \u274c         |      \u274c      |\n|                           [MVP](model_doc/mvp)                           |       \u2705        |         \u274c         |      \u274c      |\n|                           [NAT](model_doc/nat)                           |       \u2705        |         \u274c         |      \u274c      |\n|                      [Nemotron](model_doc/nemotron)"}


created_at: 2024-08-26 20:30:03
topic: persistent://default/default/621deaf2-9359-4ac4-ada0-047176703e13
id: f0de7de4-1e13-4e20-9201-b46e23ebfd21
encoding: FLOAT32
metadata:
{"url": "https://huggingface.co/docs/transformers/index", "title": "\ud83e\udd17 Transformers", "tokens": 9875, "retrieve_doc": false, "source": "transformers", "_node_content": "{\"id_\": \"f0de7de4-1e13-4e20-9201-b46e23ebfd21\", \"embedding\": null, \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/index\", \"title\": \"\\ud83e\\udd17 Transformers\", \"tokens\": 9875, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"ae56fe8d-ab49-4ab6-bff5-8b020af1916f\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/index\", \"title\": \"\\ud83e\\udd17 Transformers\", \"tokens\": 9875, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"hash\": \"836865c358dea9b81d80ebb705572b7f9f4dcfd6479dc208d646d8499b9bd468\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"d2d937c4-ab55-4796-bdd9-ba391a86c9af\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/index\", \"title\": \"\\ud83e\\udd17 Transformers\", \"tokens\": 9875, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"hash\": \"452e14e0dd9687f3b4ab99ea9404ddc0860fb96dca0a31c64f44e8de5462d122\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"83749417-09db-4eef-8187-2c2ef9706a9b\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"02df87c270888648a339858e489a587a19b57a4b917b8e25ed4d0e000eb259b3\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 24491, \"end_char_idx\": 25424, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "ae56fe8d-ab49-4ab6-bff5-8b020af1916f", "doc_id": "ae56fe8d-ab49-4ab6-bff5-8b020af1916f", "ref_doc_id": "ae56fe8d-ab49-4ab6-bff5-8b020af1916f", "chroma:document": "|         \u274c         |      \u274c      |\n|               [MusicGen Melody](model_doc/musicgen_melody)               |       \u2705        |         \u274c         |      \u274c      |\n|                           [MVP](model_doc/mvp)                           |       \u2705        |         \u274c         |      \u274c      |\n|                           [NAT](model_doc/nat)                           |       \u2705        |         \u274c         |      \u274c      |\n|                      [Nemotron](model_doc/nemotron)                      |       \u2705        |         \u274c         |      \u274c      |\n|                         [Nezha](model_doc/nezha)                         |       \u2705        |         \u274c         |      \u274c      |\n|                          [NLLB](model_doc/nllb)                          |       \u2705        |         \u274c         |      \u274c      |\n|                      [NLLB-MOE](model_doc/nllb-moe)                      |       \u2705        |         \u274c         |      \u274c      |\n|"}


created_at: 2024-08-26 20:30:03
topic: persistent://default/default/621deaf2-9359-4ac4-ada0-047176703e13
id: 83749417-09db-4eef-8187-2c2ef9706a9b
encoding: FLOAT32
metadata:
{"url": "https://huggingface.co/docs/transformers/index", "title": "\ud83e\udd17 Transformers", "tokens": 9875, "retrieve_doc": false, "source": "transformers", "_node_content": "{\"id_\": \"83749417-09db-4eef-8187-2c2ef9706a9b\", \"embedding\": null, \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/index\", \"title\": \"\\ud83e\\udd17 Transformers\", \"tokens\": 9875, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"ae56fe8d-ab49-4ab6-bff5-8b020af1916f\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/index\", \"title\": \"\\ud83e\\udd17 Transformers\", \"tokens\": 9875, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"hash\": \"836865c358dea9b81d80ebb705572b7f9f4dcfd6479dc208d646d8499b9bd468\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"f0de7de4-1e13-4e20-9201-b46e23ebfd21\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/index\", \"title\": \"\\ud83e\\udd17 Transformers\", \"tokens\": 9875, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"hash\": \"3cc0398a46ff7e353bd50c32c16ee9b96f98ed430ed695f378668aba444ced17\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"27f0d062-c20a-4e9e-ac9a-e9c1b76cc9a0\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"ec015772ac15c63f77357545f554e0fe78e11e76952c0032ae91aac1f16cb2ed\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 24986, \"end_char_idx\": 25910, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "ae56fe8d-ab49-4ab6-bff5-8b020af1916f", "doc_id": "ae56fe8d-ab49-4ab6-bff5-8b020af1916f", "ref_doc_id": "ae56fe8d-ab49-4ab6-bff5-8b020af1916f", "chroma:document": "|       \u2705        |         \u274c         |      \u274c      |\n|                         [Nezha](model_doc/nezha)                         |       \u2705        |         \u274c         |      \u274c      |\n|                          [NLLB](model_doc/nllb)                          |       \u2705        |         \u274c         |      \u274c      |\n|                      [NLLB-MOE](model_doc/nllb-moe)                      |       \u2705        |         \u274c         |      \u274c      |\n|                        [Nougat](model_doc/nougat)                        |       \u2705        |         \u2705         |      \u2705      |\n|                 [Nystr\u00f6mformer](model_doc/nystromformer)                 |       \u2705        |         \u274c         |      \u274c      |\n|                          [OLMo](model_doc/olmo)                          |       \u2705        |         \u274c         |      \u274c      |\n|                     [OneFormer](model_doc/oneformer)                     |       \u2705        |         \u274c"}


created_at: 2024-08-26 20:30:03
topic: persistent://default/default/621deaf2-9359-4ac4-ada0-047176703e13
id: 27f0d062-c20a-4e9e-ac9a-e9c1b76cc9a0
encoding: FLOAT32
metadata:
{"url": "https://huggingface.co/docs/transformers/index", "title": "\ud83e\udd17 Transformers", "tokens": 9875, "retrieve_doc": false, "source": "transformers", "_node_content": "{\"id_\": \"27f0d062-c20a-4e9e-ac9a-e9c1b76cc9a0\", \"embedding\": null, \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/index\", \"title\": \"\\ud83e\\udd17 Transformers\", \"tokens\": 9875, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"ae56fe8d-ab49-4ab6-bff5-8b020af1916f\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/index\", \"title\": \"\\ud83e\\udd17 Transformers\", \"tokens\": 9875, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"hash\": \"836865c358dea9b81d80ebb705572b7f9f4dcfd6479dc208d646d8499b9bd468\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"83749417-09db-4eef-8187-2c2ef9706a9b\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/index\", \"title\": \"\\ud83e\\udd17 Transformers\", \"tokens\": 9875, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"hash\": \"69df8871cb928c12d0fde73a76d0b3e0f79cc3e88b4f549cb40221015be179fe\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"f40ab089-d376-4392-983a-e8238beaf8bf\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"1260f2284fbe2cdf23cbcf47961d42ef3b5c4f08c8cee7166705ccd28a51b51b\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 25421, \"end_char_idx\": 26395, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "ae56fe8d-ab49-4ab6-bff5-8b020af1916f", "doc_id": "ae56fe8d-ab49-4ab6-bff5-8b020af1916f", "ref_doc_id": "ae56fe8d-ab49-4ab6-bff5-8b020af1916f", "chroma:document": "|\n|                        [Nougat](model_doc/nougat)                        |       \u2705        |         \u2705         |      \u2705      |\n|                 [Nystr\u00f6mformer](model_doc/nystromformer)                 |       \u2705        |         \u274c         |      \u274c      |\n|                          [OLMo](model_doc/olmo)                          |       \u2705        |         \u274c         |      \u274c      |\n|                     [OneFormer](model_doc/oneformer)                     |       \u2705        |         \u274c         |      \u274c      |\n|                    [OpenAI GPT](model_doc/openai-gpt)                    |       \u2705        |         \u2705         |      \u274c      |\n|                      [OpenAI GPT-2](model_doc/gpt2)                      |       \u2705        |         \u2705         |      \u2705      |\n|                    [OpenLlama](model_doc/open-llama)                     |       \u2705        |         \u274c         |      \u274c      |\n|                           [OPT](model_doc/opt)                           |"}


created_at: 2024-08-26 20:30:03
topic: persistent://default/default/621deaf2-9359-4ac4-ada0-047176703e13
id: f40ab089-d376-4392-983a-e8238beaf8bf
encoding: FLOAT32
metadata:
{"url": "https://huggingface.co/docs/transformers/index", "title": "\ud83e\udd17 Transformers", "tokens": 9875, "retrieve_doc": false, "source": "transformers", "_node_content": "{\"id_\": \"f40ab089-d376-4392-983a-e8238beaf8bf\", \"embedding\": null, \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/index\", \"title\": \"\\ud83e\\udd17 Transformers\", \"tokens\": 9875, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"ae56fe8d-ab49-4ab6-bff5-8b020af1916f\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/index\", \"title\": \"\\ud83e\\udd17 Transformers\", \"tokens\": 9875, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"hash\": \"836865c358dea9b81d80ebb705572b7f9f4dcfd6479dc208d646d8499b9bd468\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"27f0d062-c20a-4e9e-ac9a-e9c1b76cc9a0\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/index\", \"title\": \"\\ud83e\\udd17 Transformers\", \"tokens\": 9875, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"hash\": \"6d4dc0158119fc11effa53c96cb8de80ca94f368168f311272a63753ef330073\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"fa841613-98c6-4a13-a387-917f14d3b360\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"fddd28d85bddfd5ab0be354f3136b5a3e4e1d8e14ecc8f8361ac2d64c4c57510\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 25909, \"end_char_idx\": 26832, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "ae56fe8d-ab49-4ab6-bff5-8b020af1916f", "doc_id": "ae56fe8d-ab49-4ab6-bff5-8b020af1916f", "ref_doc_id": "ae56fe8d-ab49-4ab6-bff5-8b020af1916f", "chroma:document": "\u274c         |      \u274c      |\n|                    [OpenAI GPT](model_doc/openai-gpt)                    |       \u2705        |         \u2705         |      \u274c      |\n|                      [OpenAI GPT-2](model_doc/gpt2)                      |       \u2705        |         \u2705         |      \u2705      |\n|                    [OpenLlama](model_doc/open-llama)                     |       \u2705        |         \u274c         |      \u274c      |\n|                           [OPT](model_doc/opt)                           |       \u2705        |         \u2705         |      \u2705      |\n|                       [OWL-ViT](model_doc/owlvit)                        |       \u2705        |         \u274c         |      \u274c      |\n|                         [OWLv2](model_doc/owlv2)                         |       \u2705        |         \u274c         |      \u274c      |\n|                     [PaliGemma](model_doc/paligemma)                     |       \u2705        |         \u274c         |      \u274c      |\n|"}


created_at: 2024-08-26 20:30:03
topic: persistent://default/default/621deaf2-9359-4ac4-ada0-047176703e13
id: fa841613-98c6-4a13-a387-917f14d3b360
encoding: FLOAT32
metadata:
{"url": "https://huggingface.co/docs/transformers/index", "title": "\ud83e\udd17 Transformers", "tokens": 9875, "retrieve_doc": false, "source": "transformers", "_node_content": "{\"id_\": \"fa841613-98c6-4a13-a387-917f14d3b360\", \"embedding\": null, \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/index\", \"title\": \"\\ud83e\\udd17 Transformers\", \"tokens\": 9875, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"ae56fe8d-ab49-4ab6-bff5-8b020af1916f\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/index\", \"title\": \"\\ud83e\\udd17 Transformers\", \"tokens\": 9875, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"hash\": \"836865c358dea9b81d80ebb705572b7f9f4dcfd6479dc208d646d8499b9bd468\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"f40ab089-d376-4392-983a-e8238beaf8bf\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/index\", \"title\": \"\\ud83e\\udd17 Transformers\", \"tokens\": 9875, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"hash\": \"0abc5e657d480b039e521ce53e3a4252768f6c3f238a331b6d909b42afa863ec\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"75356b4e-bd6e-4f6e-9636-09e28e85ecd4\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"c694232f5e44271acb49b206c8cf594c098dbc6e52375a66dcc6faa8c02b3874\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 26394, \"end_char_idx\": 27335, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "ae56fe8d-ab49-4ab6-bff5-8b020af1916f", "doc_id": "ae56fe8d-ab49-4ab6-bff5-8b020af1916f", "ref_doc_id": "ae56fe8d-ab49-4ab6-bff5-8b020af1916f", "chroma:document": "|       \u2705        |         \u2705         |      \u2705      |\n|                       [OWL-ViT](model_doc/owlvit)                        |       \u2705        |         \u274c         |      \u274c      |\n|                         [OWLv2](model_doc/owlv2)                         |       \u2705        |         \u274c         |      \u274c      |\n|                     [PaliGemma](model_doc/paligemma)                     |       \u2705        |         \u274c         |      \u274c      |\n|                  [PatchTSMixer](model_doc/patchtsmixer)                  |       \u2705        |         \u274c         |      \u274c      |\n|                      [PatchTST](model_doc/patchtst)                      |       \u2705        |         \u274c         |      \u274c      |\n|                       [Pegasus](model_doc/pegasus)                       |       \u2705        |         \u2705         |      \u2705      |\n|                     [PEGASUS-X](model_doc/pegasus_x)                     |       \u2705        |         \u274c         |      \u274c"}


created_at: 2024-08-26 20:30:03
topic: persistent://default/default/621deaf2-9359-4ac4-ada0-047176703e13
id: 75356b4e-bd6e-4f6e-9636-09e28e85ecd4
encoding: FLOAT32
metadata:
{"url": "https://huggingface.co/docs/transformers/index", "title": "\ud83e\udd17 Transformers", "tokens": 9875, "retrieve_doc": false, "source": "transformers", "_node_content": "{\"id_\": \"75356b4e-bd6e-4f6e-9636-09e28e85ecd4\", \"embedding\": null, \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/index\", \"title\": \"\\ud83e\\udd17 Transformers\", \"tokens\": 9875, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"ae56fe8d-ab49-4ab6-bff5-8b020af1916f\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/index\", \"title\": \"\\ud83e\\udd17 Transformers\", \"tokens\": 9875, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"hash\": \"836865c358dea9b81d80ebb705572b7f9f4dcfd6479dc208d646d8499b9bd468\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"fa841613-98c6-4a13-a387-917f14d3b360\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/index\", \"title\": \"\\ud83e\\udd17 Transformers\", \"tokens\": 9875, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"hash\": \"942ff439bf900ceb0647bc9241c0479de71354dbd24c18d66f856dfe985649a0\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"ba395bb1-d4e8-469a-b6e3-8abd29d4dbc5\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"b3cd6d923678bddbded590d6c23d80b7b5fa3f2ea4b0141fac25c3b911cda5cb\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 26850, \"end_char_idx\": 27811, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "ae56fe8d-ab49-4ab6-bff5-8b020af1916f", "doc_id": "ae56fe8d-ab49-4ab6-bff5-8b020af1916f", "ref_doc_id": "ae56fe8d-ab49-4ab6-bff5-8b020af1916f", "chroma:document": "[PatchTSMixer](model_doc/patchtsmixer)                  |       \u2705        |         \u274c         |      \u274c      |\n|                      [PatchTST](model_doc/patchtst)                      |       \u2705        |         \u274c         |      \u274c      |\n|                       [Pegasus](model_doc/pegasus)                       |       \u2705        |         \u2705         |      \u2705      |\n|                     [PEGASUS-X](model_doc/pegasus_x)                     |       \u2705        |         \u274c         |      \u274c      |\n|                     [Perceiver](model_doc/perceiver)                     |       \u2705        |         \u274c         |      \u274c      |\n|                     [Persimmon](model_doc/persimmon)                     |       \u2705        |         \u274c         |      \u274c      |\n|                           [Phi](model_doc/phi)                           |       \u2705        |         \u274c         |      \u274c      |\n|                          [Phi3](model_doc/phi3)                          |       \u2705"}


created_at: 2024-08-26 20:30:03
topic: persistent://default/default/621deaf2-9359-4ac4-ada0-047176703e13
id: ba395bb1-d4e8-469a-b6e3-8abd29d4dbc5
encoding: FLOAT32
metadata:
{"url": "https://huggingface.co/docs/transformers/index", "title": "\ud83e\udd17 Transformers", "tokens": 9875, "retrieve_doc": false, "source": "transformers", "_node_content": "{\"id_\": \"ba395bb1-d4e8-469a-b6e3-8abd29d4dbc5\", \"embedding\": null, \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/index\", \"title\": \"\\ud83e\\udd17 Transformers\", \"tokens\": 9875, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"ae56fe8d-ab49-4ab6-bff5-8b020af1916f\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/index\", \"title\": \"\\ud83e\\udd17 Transformers\", \"tokens\": 9875, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"hash\": \"836865c358dea9b81d80ebb705572b7f9f4dcfd6479dc208d646d8499b9bd468\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"75356b4e-bd6e-4f6e-9636-09e28e85ecd4\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/index\", \"title\": \"\\ud83e\\udd17 Transformers\", \"tokens\": 9875, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"hash\": \"1d719ad1c44059e6d508613e9fb62476ab2ac3cd122c929fce5b205faae8d1f7\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"4482727b-6a2b-4b7b-830e-617747a92e03\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"bf780a405d0fa7b36e52c0e5912981d2c0c21d1f00c46b0bfb2cb2adce0bf7ae\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 27327, \"end_char_idx\": 28294, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "ae56fe8d-ab49-4ab6-bff5-8b020af1916f", "doc_id": "ae56fe8d-ab49-4ab6-bff5-8b020af1916f", "ref_doc_id": "ae56fe8d-ab49-4ab6-bff5-8b020af1916f", "chroma:document": "|      \u274c      |\n|                     [Perceiver](model_doc/perceiver)                     |       \u2705        |         \u274c         |      \u274c      |\n|                     [Persimmon](model_doc/persimmon)                     |       \u2705        |         \u274c         |      \u274c      |\n|                           [Phi](model_doc/phi)                           |       \u2705        |         \u274c         |      \u274c      |\n|                          [Phi3](model_doc/phi3)                          |       \u2705        |         \u274c         |      \u274c      |\n|                       [PhoBERT](model_doc/phobert)                       |       \u2705        |         \u2705         |      \u2705      |\n|                    [Pix2Struct](model_doc/pix2struct)                    |       \u2705        |         \u274c         |      \u274c      |\n|                        [PLBart](model_doc/plbart)                        |       \u2705        |         \u274c         |      \u274c      |\n|                    [PoolFormer](model_doc/poolformer)"}


created_at: 2024-08-26 20:30:03
topic: persistent://default/default/621deaf2-9359-4ac4-ada0-047176703e13
id: 4482727b-6a2b-4b7b-830e-617747a92e03
encoding: FLOAT32
metadata:
{"url": "https://huggingface.co/docs/transformers/index", "title": "\ud83e\udd17 Transformers", "tokens": 9875, "retrieve_doc": false, "source": "transformers", "_node_content": "{\"id_\": \"4482727b-6a2b-4b7b-830e-617747a92e03\", \"embedding\": null, \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/index\", \"title\": \"\\ud83e\\udd17 Transformers\", \"tokens\": 9875, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"ae56fe8d-ab49-4ab6-bff5-8b020af1916f\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/index\", \"title\": \"\\ud83e\\udd17 Transformers\", \"tokens\": 9875, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"hash\": \"836865c358dea9b81d80ebb705572b7f9f4dcfd6479dc208d646d8499b9bd468\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"ba395bb1-d4e8-469a-b6e3-8abd29d4dbc5\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/index\", \"title\": \"\\ud83e\\udd17 Transformers\", \"tokens\": 9875, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"hash\": \"dcc46b56f4f692822ccefda5b15e0669d458fb28f868978ae446717dc4c5ff92\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"23abf4d5-a24a-4739-bb71-2825cb9de674\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"384dbe82566148709e7420b888de79edf66afdb239f9a50b38f95f1e99e053a0\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 27802, \"end_char_idx\": 28752, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "ae56fe8d-ab49-4ab6-bff5-8b020af1916f", "doc_id": "ae56fe8d-ab49-4ab6-bff5-8b020af1916f", "ref_doc_id": "ae56fe8d-ab49-4ab6-bff5-8b020af1916f", "chroma:document": "|       \u2705        |         \u274c         |      \u274c      |\n|                       [PhoBERT](model_doc/phobert)                       |       \u2705        |         \u2705         |      \u2705      |\n|                    [Pix2Struct](model_doc/pix2struct)                    |       \u2705        |         \u274c         |      \u274c      |\n|                        [PLBart](model_doc/plbart)                        |       \u2705        |         \u274c         |      \u274c      |\n|                    [PoolFormer](model_doc/poolformer)                    |       \u2705        |         \u274c         |      \u274c      |\n|                     [Pop2Piano](model_doc/pop2piano)                     |       \u2705        |         \u274c         |      \u274c      |\n|                    [ProphetNet](model_doc/prophetnet)                    |       \u2705        |         \u274c         |      \u274c      |\n|                           [PVT](model_doc/pvt)                           |       \u2705        |         \u274c         |      \u274c      |\n|"}


created_at: 2024-08-26 20:30:03
topic: persistent://default/default/621deaf2-9359-4ac4-ada0-047176703e13
id: 23abf4d5-a24a-4739-bb71-2825cb9de674
encoding: FLOAT32
metadata:
{"url": "https://huggingface.co/docs/transformers/index", "title": "\ud83e\udd17 Transformers", "tokens": 9875, "retrieve_doc": false, "source": "transformers", "_node_content": "{\"id_\": \"23abf4d5-a24a-4739-bb71-2825cb9de674\", \"embedding\": null, \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/index\", \"title\": \"\\ud83e\\udd17 Transformers\", \"tokens\": 9875, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"ae56fe8d-ab49-4ab6-bff5-8b020af1916f\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/index\", \"title\": \"\\ud83e\\udd17 Transformers\", \"tokens\": 9875, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"hash\": \"836865c358dea9b81d80ebb705572b7f9f4dcfd6479dc208d646d8499b9bd468\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"4482727b-6a2b-4b7b-830e-617747a92e03\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/index\", \"title\": \"\\ud83e\\udd17 Transformers\", \"tokens\": 9875, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"hash\": \"d72769146ea90edbf4994cdcabbb71af2887007e8f5b44bb8c599db433aa0db3\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"4ef08cf1-d620-47c6-82ae-51ddb19e87cd\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"9ed5082c7ae74973b950749e33a0b60de23f0faf523e6521421ce7cb449ccd55\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 28314, \"end_char_idx\": 29238, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "ae56fe8d-ab49-4ab6-bff5-8b020af1916f", "doc_id": "ae56fe8d-ab49-4ab6-bff5-8b020af1916f", "ref_doc_id": "ae56fe8d-ab49-4ab6-bff5-8b020af1916f", "chroma:document": "|       \u2705        |         \u274c         |      \u274c      |\n|                     [Pop2Piano](model_doc/pop2piano)                     |       \u2705        |         \u274c         |      \u274c      |\n|                    [ProphetNet](model_doc/prophetnet)                    |       \u2705        |         \u274c         |      \u274c      |\n|                           [PVT](model_doc/pvt)                           |       \u2705        |         \u274c         |      \u274c      |\n|                        [PVTv2](model_doc/pvt_v2)                         |       \u2705        |         \u274c         |      \u274c      |\n|                       [QDQBert](model_doc/qdqbert)                       |       \u2705        |         \u274c         |      \u274c      |\n|                         [Qwen2](model_doc/qwen2)                         |       \u2705        |         \u274c         |      \u274c      |\n|                   [Qwen2Audio](model_doc/qwen2_audio)                    |       \u2705        |         \u274c"}


created_at: 2024-08-26 20:30:03
topic: persistent://default/default/621deaf2-9359-4ac4-ada0-047176703e13
id: 4ef08cf1-d620-47c6-82ae-51ddb19e87cd
encoding: FLOAT32
metadata:
{"url": "https://huggingface.co/docs/transformers/index", "title": "\ud83e\udd17 Transformers", "tokens": 9875, "retrieve_doc": false, "source": "transformers", "_node_content": "{\"id_\": \"4ef08cf1-d620-47c6-82ae-51ddb19e87cd\", \"embedding\": null, \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/index\", \"title\": \"\\ud83e\\udd17 Transformers\", \"tokens\": 9875, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"ae56fe8d-ab49-4ab6-bff5-8b020af1916f\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/index\", \"title\": \"\\ud83e\\udd17 Transformers\", \"tokens\": 9875, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"hash\": \"836865c358dea9b81d80ebb705572b7f9f4dcfd6479dc208d646d8499b9bd468\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"23abf4d5-a24a-4739-bb71-2825cb9de674\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/index\", \"title\": \"\\ud83e\\udd17 Transformers\", \"tokens\": 9875, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"hash\": \"f97ee59556df34b4a51095d3a4ab7cea69d291e0aaa14ae9301dfbbd5f1e3bd7\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"d7d63cfd-cf88-4b0a-a2d6-58c6aa192ab1\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"e92019d9c8b9c6c78476b29af5897d6c47a0631747ad8eeccfc7e70b0328d5cf\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 28776, \"end_char_idx\": 29697, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "ae56fe8d-ab49-4ab6-bff5-8b020af1916f", "doc_id": "ae56fe8d-ab49-4ab6-bff5-8b020af1916f", "ref_doc_id": "ae56fe8d-ab49-4ab6-bff5-8b020af1916f", "chroma:document": "[PVTv2](model_doc/pvt_v2)                         |       \u2705        |         \u274c         |      \u274c      |\n|                       [QDQBert](model_doc/qdqbert)                       |       \u2705        |         \u274c         |      \u274c      |\n|                         [Qwen2](model_doc/qwen2)                         |       \u2705        |         \u274c         |      \u274c      |\n|                   [Qwen2Audio](model_doc/qwen2_audio)                    |       \u2705        |         \u274c         |      \u274c      |\n|                     [Qwen2MoE](model_doc/qwen2_moe)                      |       \u2705        |         \u274c         |      \u274c      |\n|                      [Qwen2VL](model_doc/qwen2_vl)                       |       \u2705        |         \u274c         |      \u274c      |\n|                           [RAG](model_doc/rag)                           |       \u2705        |         \u2705         |      \u274c      |\n|                         [REALM](model_doc/realm)"}


created_at: 2024-08-26 20:30:03
topic: persistent://default/default/621deaf2-9359-4ac4-ada0-047176703e13
id: d7d63cfd-cf88-4b0a-a2d6-58c6aa192ab1
encoding: FLOAT32
metadata:
{"url": "https://huggingface.co/docs/transformers/index", "title": "\ud83e\udd17 Transformers", "tokens": 9875, "retrieve_doc": false, "source": "transformers", "_node_content": "{\"id_\": \"d7d63cfd-cf88-4b0a-a2d6-58c6aa192ab1\", \"embedding\": null, \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/index\", \"title\": \"\\ud83e\\udd17 Transformers\", \"tokens\": 9875, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"ae56fe8d-ab49-4ab6-bff5-8b020af1916f\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/index\", \"title\": \"\\ud83e\\udd17 Transformers\", \"tokens\": 9875, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"hash\": \"836865c358dea9b81d80ebb705572b7f9f4dcfd6479dc208d646d8499b9bd468\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"4ef08cf1-d620-47c6-82ae-51ddb19e87cd\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/index\", \"title\": \"\\ud83e\\udd17 Transformers\", \"tokens\": 9875, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"hash\": \"f3ecbc20595e4bd3c634cd5ea5472d871d48b2725ff1c56610d8c4e8084deb2f\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"e0c2e932-dfc9-40bf-a42f-580d33ae70ec\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"32ccbcef1609fc9efcb9c990ebec3d80525ae4dc3c3f5f26b19489d168c69657\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 29237, \"end_char_idx\": 30160, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "ae56fe8d-ab49-4ab6-bff5-8b020af1916f", "doc_id": "ae56fe8d-ab49-4ab6-bff5-8b020af1916f", "ref_doc_id": "ae56fe8d-ab49-4ab6-bff5-8b020af1916f", "chroma:document": "\u274c         |      \u274c      |\n|                     [Qwen2MoE](model_doc/qwen2_moe)                      |       \u2705        |         \u274c         |      \u274c      |\n|                      [Qwen2VL](model_doc/qwen2_vl)                       |       \u2705        |         \u274c         |      \u274c      |\n|                           [RAG](model_doc/rag)                           |       \u2705        |         \u2705         |      \u274c      |\n|                         [REALM](model_doc/realm)                         |       \u2705        |         \u274c         |      \u274c      |\n|               [RecurrentGemma](model_doc/recurrent_gemma)                |       \u2705        |         \u274c         |      \u274c      |\n|                      [Reformer](model_doc/reformer)                      |       \u2705        |         \u274c         |      \u274c      |\n|                        [RegNet](model_doc/regnet)                        |       \u2705        |         \u2705         |      \u2705      |\n|"}


created_at: 2024-08-26 20:30:03
topic: persistent://default/default/621deaf2-9359-4ac4-ada0-047176703e13
id: e0c2e932-dfc9-40bf-a42f-580d33ae70ec
encoding: FLOAT32
metadata:
{"url": "https://huggingface.co/docs/transformers/index", "title": "\ud83e\udd17 Transformers", "tokens": 9875, "retrieve_doc": false, "source": "transformers", "_node_content": "{\"id_\": \"e0c2e932-dfc9-40bf-a42f-580d33ae70ec\", \"embedding\": null, \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/index\", \"title\": \"\\ud83e\\udd17 Transformers\", \"tokens\": 9875, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"ae56fe8d-ab49-4ab6-bff5-8b020af1916f\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/index\", \"title\": \"\\ud83e\\udd17 Transformers\", \"tokens\": 9875, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"hash\": \"836865c358dea9b81d80ebb705572b7f9f4dcfd6479dc208d646d8499b9bd468\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"d7d63cfd-cf88-4b0a-a2d6-58c6aa192ab1\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/index\", \"title\": \"\\ud83e\\udd17 Transformers\", \"tokens\": 9875, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"hash\": \"afd1627485d84e9917f4f5ddecc10d24585796ed94fc951cc55e3124609fa3a2\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"43e15f9b-f030-4998-80d1-0edcdf726449\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"f2c0b6c9b04469ba1f152045063cb4e2233f528c8c3d3aa1c30e0ea08478245c\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 29722, \"end_char_idx\": 30672, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "ae56fe8d-ab49-4ab6-bff5-8b020af1916f", "doc_id": "ae56fe8d-ab49-4ab6-bff5-8b020af1916f", "ref_doc_id": "ae56fe8d-ab49-4ab6-bff5-8b020af1916f", "chroma:document": "|       \u2705        |         \u274c         |      \u274c      |\n|               [RecurrentGemma](model_doc/recurrent_gemma)                |       \u2705        |         \u274c         |      \u274c      |\n|                      [Reformer](model_doc/reformer)                      |       \u2705        |         \u274c         |      \u274c      |\n|                        [RegNet](model_doc/regnet)                        |       \u2705        |         \u2705         |      \u2705      |\n|                       [RemBERT](model_doc/rembert)                       |       \u2705        |         \u2705         |      \u274c      |\n|                        [ResNet](model_doc/resnet)                        |       \u2705        |         \u2705         |      \u2705      |\n|                     [RetriBERT](model_doc/retribert)                     |       \u2705        |         \u274c         |      \u274c      |\n|                       [RoBERTa](model_doc/roberta)                       |       \u2705        |         \u2705         |      \u2705      |\n|"}


created_at: 2024-08-26 20:30:03
topic: persistent://default/default/621deaf2-9359-4ac4-ada0-047176703e13
id: 43e15f9b-f030-4998-80d1-0edcdf726449
encoding: FLOAT32
metadata:
{"url": "https://huggingface.co/docs/transformers/index", "title": "\ud83e\udd17 Transformers", "tokens": 9875, "retrieve_doc": false, "source": "transformers", "_node_content": "{\"id_\": \"43e15f9b-f030-4998-80d1-0edcdf726449\", \"embedding\": null, \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/index\", \"title\": \"\\ud83e\\udd17 Transformers\", \"tokens\": 9875, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"ae56fe8d-ab49-4ab6-bff5-8b020af1916f\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/index\", \"title\": \"\\ud83e\\udd17 Transformers\", \"tokens\": 9875, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"hash\": \"836865c358dea9b81d80ebb705572b7f9f4dcfd6479dc208d646d8499b9bd468\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"e0c2e932-dfc9-40bf-a42f-580d33ae70ec\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/index\", \"title\": \"\\ud83e\\udd17 Transformers\", \"tokens\": 9875, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"hash\": \"6a49f1d6a5dc2871665fdfaca08c9b32b02d5c01047a3abcdfd5328bc5628b5e\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"4dd29fdb-338c-4517-90ca-f74565e8638a\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"019b699020d178e44e04594b5f9ab0e626efb2e792bcf2e7e4e420687f99bf25\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 30183, \"end_char_idx\": 31158, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "ae56fe8d-ab49-4ab6-bff5-8b020af1916f", "doc_id": "ae56fe8d-ab49-4ab6-bff5-8b020af1916f", "ref_doc_id": "ae56fe8d-ab49-4ab6-bff5-8b020af1916f", "chroma:document": "[RemBERT](model_doc/rembert)                       |       \u2705        |         \u2705         |      \u274c      |\n|                        [ResNet](model_doc/resnet)                        |       \u2705        |         \u2705         |      \u2705      |\n|                     [RetriBERT](model_doc/retribert)                     |       \u2705        |         \u274c         |      \u274c      |\n|                       [RoBERTa](model_doc/roberta)                       |       \u2705        |         \u2705         |      \u2705      |\n|          [RoBERTa-PreLayerNorm](model_doc/roberta-prelayernorm)          |       \u2705        |         \u2705         |      \u2705      |\n|                      [RoCBert](model_doc/roc_bert)                       |       \u2705        |         \u274c         |      \u274c      |\n|                      [RoFormer](model_doc/roformer)                      |       \u2705        |         \u2705         |      \u2705      |\n|                       [RT-DETR](model_doc/rt_detr)                       |       \u2705        |         \u274c"}


created_at: 2024-08-26 20:30:03
topic: persistent://default/default/621deaf2-9359-4ac4-ada0-047176703e13
id: 4dd29fdb-338c-4517-90ca-f74565e8638a
encoding: FLOAT32
metadata:
{"url": "https://huggingface.co/docs/transformers/index", "title": "\ud83e\udd17 Transformers", "tokens": 9875, "retrieve_doc": false, "source": "transformers", "_node_content": "{\"id_\": \"4dd29fdb-338c-4517-90ca-f74565e8638a\", \"embedding\": null, \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/index\", \"title\": \"\\ud83e\\udd17 Transformers\", \"tokens\": 9875, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"ae56fe8d-ab49-4ab6-bff5-8b020af1916f\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/index\", \"title\": \"\\ud83e\\udd17 Transformers\", \"tokens\": 9875, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"hash\": \"836865c358dea9b81d80ebb705572b7f9f4dcfd6479dc208d646d8499b9bd468\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"43e15f9b-f030-4998-80d1-0edcdf726449\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/index\", \"title\": \"\\ud83e\\udd17 Transformers\", \"tokens\": 9875, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"hash\": \"c130f9c3f757b20be9e64852355ad1f294fa2cdf8f9458aa08a6821d173bd185\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"78873839-4610-4387-9d81-c80f3ca5c93e\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"4ec5b0434c6faf00513bea372339509a03fcb25901b4105b5ee4f2ecfb66fac9\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 30662, \"end_char_idx\": 31643, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "ae56fe8d-ab49-4ab6-bff5-8b020af1916f", "doc_id": "ae56fe8d-ab49-4ab6-bff5-8b020af1916f", "ref_doc_id": "ae56fe8d-ab49-4ab6-bff5-8b020af1916f", "chroma:document": "\u2705      |\n|          [RoBERTa-PreLayerNorm](model_doc/roberta-prelayernorm)          |       \u2705        |         \u2705         |      \u2705      |\n|                      [RoCBert](model_doc/roc_bert)                       |       \u2705        |         \u274c         |      \u274c      |\n|                      [RoFormer](model_doc/roformer)                      |       \u2705        |         \u2705         |      \u2705      |\n|                       [RT-DETR](model_doc/rt_detr)                       |       \u2705        |         \u274c         |      \u274c      |\n|                [RT-DETR-ResNet](model_doc/rt_detr_resnet)                |       \u2705        |         \u274c         |      \u274c      |\n|                          [RWKV](model_doc/rwkv)                          |       \u2705        |         \u274c         |      \u274c      |\n|                           [SAM](model_doc/sam)                           |       \u2705        |         \u2705         |      \u274c      |\n|                  [SeamlessM4T](model_doc/seamless_m4t)                   |"}


created_at: 2024-08-26 20:30:03
topic: persistent://default/default/621deaf2-9359-4ac4-ada0-047176703e13
id: 78873839-4610-4387-9d81-c80f3ca5c93e
encoding: FLOAT32
metadata:
{"url": "https://huggingface.co/docs/transformers/index", "title": "\ud83e\udd17 Transformers", "tokens": 9875, "retrieve_doc": false, "source": "transformers", "_node_content": "{\"id_\": \"78873839-4610-4387-9d81-c80f3ca5c93e\", \"embedding\": null, \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/index\", \"title\": \"\\ud83e\\udd17 Transformers\", \"tokens\": 9875, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"ae56fe8d-ab49-4ab6-bff5-8b020af1916f\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/index\", \"title\": \"\\ud83e\\udd17 Transformers\", \"tokens\": 9875, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"hash\": \"836865c358dea9b81d80ebb705572b7f9f4dcfd6479dc208d646d8499b9bd468\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"4dd29fdb-338c-4517-90ca-f74565e8638a\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/index\", \"title\": \"\\ud83e\\udd17 Transformers\", \"tokens\": 9875, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"hash\": \"5c4c245f021b3e0485c5e5acd2d934aa4fb4d07aa6876d43c41bd821014a4ffb\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"1aa287e6-4b5b-4981-8abb-4f67ed7da7ba\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"c5ce05de614ff35cfe5a3324ef771c85af18917bfec2ca8357fbd25e77813998\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 31157, \"end_char_idx\": 32080, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "ae56fe8d-ab49-4ab6-bff5-8b020af1916f", "doc_id": "ae56fe8d-ab49-4ab6-bff5-8b020af1916f", "ref_doc_id": "ae56fe8d-ab49-4ab6-bff5-8b020af1916f", "chroma:document": "\u274c         |      \u274c      |\n|                [RT-DETR-ResNet](model_doc/rt_detr_resnet)                |       \u2705        |         \u274c         |      \u274c      |\n|                          [RWKV](model_doc/rwkv)                          |       \u2705        |         \u274c         |      \u274c      |\n|                           [SAM](model_doc/sam)                           |       \u2705        |         \u2705         |      \u274c      |\n|                  [SeamlessM4T](model_doc/seamless_m4t)                   |       \u2705        |         \u274c         |      \u274c      |\n|                [SeamlessM4Tv2](model_doc/seamless_m4t_v2)                |       \u2705        |         \u274c         |      \u274c      |\n|                     [SegFormer](model_doc/segformer)                     |       \u2705        |         \u2705         |      \u274c      |\n|                        [SegGPT](model_doc/seggpt)                        |       \u2705        |         \u274c         |      \u274c      |\n|"}


created_at: 2024-08-26 20:30:03
topic: persistent://default/default/621deaf2-9359-4ac4-ada0-047176703e13
id: 1aa287e6-4b5b-4981-8abb-4f67ed7da7ba
encoding: FLOAT32
metadata:
{"url": "https://huggingface.co/docs/transformers/index", "title": "\ud83e\udd17 Transformers", "tokens": 9875, "retrieve_doc": false, "source": "transformers", "_node_content": "{\"id_\": \"1aa287e6-4b5b-4981-8abb-4f67ed7da7ba\", \"embedding\": null, \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/index\", \"title\": \"\\ud83e\\udd17 Transformers\", \"tokens\": 9875, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"ae56fe8d-ab49-4ab6-bff5-8b020af1916f\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/index\", \"title\": \"\\ud83e\\udd17 Transformers\", \"tokens\": 9875, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"hash\": \"836865c358dea9b81d80ebb705572b7f9f4dcfd6479dc208d646d8499b9bd468\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"78873839-4610-4387-9d81-c80f3ca5c93e\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/index\", \"title\": \"\\ud83e\\udd17 Transformers\", \"tokens\": 9875, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"hash\": \"a93120b94f625dca634c08b76772d8c1ade560604aa0b3bbbeffd69a326602b5\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"0635ae74-9e2c-45f1-a46c-a12b2a5493dd\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"2e7df9f617f7f71ec329cf50538bb908b7b39d3eff24e5e88a32f3fb0b22ea03\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 31642, \"end_char_idx\": 32592, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "ae56fe8d-ab49-4ab6-bff5-8b020af1916f", "doc_id": "ae56fe8d-ab49-4ab6-bff5-8b020af1916f", "ref_doc_id": "ae56fe8d-ab49-4ab6-bff5-8b020af1916f", "chroma:document": "|       \u2705        |         \u274c         |      \u274c      |\n|                [SeamlessM4Tv2](model_doc/seamless_m4t_v2)                |       \u2705        |         \u274c         |      \u274c      |\n|                     [SegFormer](model_doc/segformer)                     |       \u2705        |         \u2705         |      \u274c      |\n|                        [SegGPT](model_doc/seggpt)                        |       \u2705        |         \u274c         |      \u274c      |\n|                           [SEW](model_doc/sew)                           |       \u2705        |         \u274c         |      \u274c      |\n|                         [SEW-D](model_doc/sew-d)                         |       \u2705        |         \u274c         |      \u274c      |\n|                        [SigLIP](model_doc/siglip)                        |       \u2705        |         \u274c         |      \u274c      |\n|        [Speech Encoder decoder](model_doc/speech-encoder-decoder)        |       \u2705        |         \u274c         |      \u2705      |\n|"}


created_at: 2024-08-26 20:30:03
topic: persistent://default/default/621deaf2-9359-4ac4-ada0-047176703e13
id: 0635ae74-9e2c-45f1-a46c-a12b2a5493dd
encoding: FLOAT32
metadata:
{"url": "https://huggingface.co/docs/transformers/index", "title": "\ud83e\udd17 Transformers", "tokens": 9875, "retrieve_doc": false, "source": "transformers", "_node_content": "{\"id_\": \"0635ae74-9e2c-45f1-a46c-a12b2a5493dd\", \"embedding\": null, \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/index\", \"title\": \"\\ud83e\\udd17 Transformers\", \"tokens\": 9875, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"ae56fe8d-ab49-4ab6-bff5-8b020af1916f\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/index\", \"title\": \"\\ud83e\\udd17 Transformers\", \"tokens\": 9875, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"hash\": \"836865c358dea9b81d80ebb705572b7f9f4dcfd6479dc208d646d8499b9bd468\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"1aa287e6-4b5b-4981-8abb-4f67ed7da7ba\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/index\", \"title\": \"\\ud83e\\udd17 Transformers\", \"tokens\": 9875, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"hash\": \"d7e8d401411696c5c688d1f86d20ba90c43eee54bbf44324642b4d22d9180110\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"9396e42f-260c-4a3c-9889-48afd916f096\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"822a4564d1704ae55a4c997e200e4150062818052105cbaf50191893fde9d75c\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 32107, \"end_char_idx\": 33095, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "ae56fe8d-ab49-4ab6-bff5-8b020af1916f", "doc_id": "ae56fe8d-ab49-4ab6-bff5-8b020af1916f", "ref_doc_id": "ae56fe8d-ab49-4ab6-bff5-8b020af1916f", "chroma:document": "[SEW](model_doc/sew)                           |       \u2705        |         \u274c         |      \u274c      |\n|                         [SEW-D](model_doc/sew-d)                         |       \u2705        |         \u274c         |      \u274c      |\n|                        [SigLIP](model_doc/siglip)                        |       \u2705        |         \u274c         |      \u274c      |\n|        [Speech Encoder decoder](model_doc/speech-encoder-decoder)        |       \u2705        |         \u274c         |      \u2705      |\n|                 [Speech2Text](model_doc/speech_to_text)                  |       \u2705        |         \u2705         |      \u274c      |\n|                      [SpeechT5](model_doc/speecht5)                      |       \u2705        |         \u274c         |      \u274c      |\n|                      [Splinter](model_doc/splinter)                      |       \u2705        |         \u274c         |      \u274c      |\n|                   [SqueezeBERT](model_doc/squeezebert)                   |       \u2705        |         \u274c         |      \u274c"}


created_at: 2024-08-26 20:30:03
topic: persistent://default/default/621deaf2-9359-4ac4-ada0-047176703e13
id: 9396e42f-260c-4a3c-9889-48afd916f096
encoding: FLOAT32
metadata:
{"url": "https://huggingface.co/docs/transformers/index", "title": "\ud83e\udd17 Transformers", "tokens": 9875, "retrieve_doc": false, "source": "transformers", "_node_content": "{\"id_\": \"9396e42f-260c-4a3c-9889-48afd916f096\", \"embedding\": null, \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/index\", \"title\": \"\\ud83e\\udd17 Transformers\", \"tokens\": 9875, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"ae56fe8d-ab49-4ab6-bff5-8b020af1916f\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/index\", \"title\": \"\\ud83e\\udd17 Transformers\", \"tokens\": 9875, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"hash\": \"836865c358dea9b81d80ebb705572b7f9f4dcfd6479dc208d646d8499b9bd468\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"0635ae74-9e2c-45f1-a46c-a12b2a5493dd\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/index\", \"title\": \"\\ud83e\\udd17 Transformers\", \"tokens\": 9875, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"hash\": \"8515edfb9599bbfa80022219403de86aa1caa4c52bbcc1c9885f146448512209\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"f7ef4897-53ab-4e7e-a19b-140a59a23920\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"c4bb5caa24e9c043bb19d2deac3b99031092f60c339ca7b8d1d9cc104d79d86c\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 32589, \"end_char_idx\": 33590, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "ae56fe8d-ab49-4ab6-bff5-8b020af1916f", "doc_id": "ae56fe8d-ab49-4ab6-bff5-8b020af1916f", "ref_doc_id": "ae56fe8d-ab49-4ab6-bff5-8b020af1916f", "chroma:document": "|\n|                 [Speech2Text](model_doc/speech_to_text)                  |       \u2705        |         \u2705         |      \u274c      |\n|                      [SpeechT5](model_doc/speecht5)                      |       \u2705        |         \u274c         |      \u274c      |\n|                      [Splinter](model_doc/splinter)                      |       \u2705        |         \u274c         |      \u274c      |\n|                   [SqueezeBERT](model_doc/squeezebert)                   |       \u2705        |         \u274c         |      \u274c      |\n|                      [StableLm](model_doc/stablelm)                      |       \u2705        |         \u274c         |      \u274c      |\n|                    [Starcoder2](model_doc/starcoder2)                    |       \u2705        |         \u274c         |      \u274c      |\n|                    [SuperPoint](model_doc/superpoint)                    |       \u2705        |         \u274c         |      \u274c      |\n|                   [SwiftFormer](model_doc/swiftformer)                   |       \u2705        |         \u2705"}


created_at: 2024-08-26 20:30:03
topic: persistent://default/default/621deaf2-9359-4ac4-ada0-047176703e13
id: f7ef4897-53ab-4e7e-a19b-140a59a23920
encoding: FLOAT32
metadata:
{"url": "https://huggingface.co/docs/transformers/index", "title": "\ud83e\udd17 Transformers", "tokens": 9875, "retrieve_doc": false, "source": "transformers", "_node_content": "{\"id_\": \"f7ef4897-53ab-4e7e-a19b-140a59a23920\", \"embedding\": null, \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/index\", \"title\": \"\\ud83e\\udd17 Transformers\", \"tokens\": 9875, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"ae56fe8d-ab49-4ab6-bff5-8b020af1916f\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/index\", \"title\": \"\\ud83e\\udd17 Transformers\", \"tokens\": 9875, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"hash\": \"836865c358dea9b81d80ebb705572b7f9f4dcfd6479dc208d646d8499b9bd468\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"9396e42f-260c-4a3c-9889-48afd916f096\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/index\", \"title\": \"\\ud83e\\udd17 Transformers\", \"tokens\": 9875, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"hash\": \"9c909a3163175172d5643009f58fa50d6674c54647aaf4961f54392b794b555b\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"9be8f067-cbb6-4887-b371-fe258d10aff9\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"f2877feeaec504a6c6e2a3c73f3417f8a6473b361391298be4c45026ab7b86c3\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 33087, \"end_char_idx\": 34112, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "ae56fe8d-ab49-4ab6-bff5-8b020af1916f", "doc_id": "ae56fe8d-ab49-4ab6-bff5-8b020af1916f", "ref_doc_id": "ae56fe8d-ab49-4ab6-bff5-8b020af1916f", "chroma:document": "|      \u274c      |\n|                      [StableLm](model_doc/stablelm)                      |       \u2705        |         \u274c         |      \u274c      |\n|                    [Starcoder2](model_doc/starcoder2)                    |       \u2705        |         \u274c         |      \u274c      |\n|                    [SuperPoint](model_doc/superpoint)                    |       \u2705        |         \u274c         |      \u274c      |\n|                   [SwiftFormer](model_doc/swiftformer)                   |       \u2705        |         \u2705         |      \u274c      |\n|                    [Swin Transformer](model_doc/swin)                    |       \u2705        |         \u2705         |      \u274c      |\n|                 [Swin Transformer V2](model_doc/swinv2)                  |       \u2705        |         \u274c         |      \u274c      |\n|                       [Swin2SR](model_doc/swin2sr)                       |       \u2705        |         \u274c         |      \u274c      |\n|           [SwitchTransformers](model_doc/switch_transformers)            |       \u2705        |         \u274c         |"}


created_at: 2024-08-26 20:30:03
topic: persistent://default/default/621deaf2-9359-4ac4-ada0-047176703e13
id: 9be8f067-cbb6-4887-b371-fe258d10aff9
encoding: FLOAT32
metadata:
{"url": "https://huggingface.co/docs/transformers/index", "title": "\ud83e\udd17 Transformers", "tokens": 9875, "retrieve_doc": false, "source": "transformers", "_node_content": "{\"id_\": \"9be8f067-cbb6-4887-b371-fe258d10aff9\", \"embedding\": null, \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/index\", \"title\": \"\\ud83e\\udd17 Transformers\", \"tokens\": 9875, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"ae56fe8d-ab49-4ab6-bff5-8b020af1916f\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/index\", \"title\": \"\\ud83e\\udd17 Transformers\", \"tokens\": 9875, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"hash\": \"836865c358dea9b81d80ebb705572b7f9f4dcfd6479dc208d646d8499b9bd468\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"f7ef4897-53ab-4e7e-a19b-140a59a23920\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/index\", \"title\": \"\\ud83e\\udd17 Transformers\", \"tokens\": 9875, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"hash\": \"7174e03975b4e13bad6c53d72b7ae8fa1ac76cbcb0c571f6a2b2fb06d6ba432f\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"db804067-5407-4f3a-a168-e4674fbb1f10\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"b9ab9dd487a49cff562d2fff47d2e1b33c8e423b65832f8615d5fa50907b0c68\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 33589, \"end_char_idx\": 34587, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "ae56fe8d-ab49-4ab6-bff5-8b020af1916f", "doc_id": "ae56fe8d-ab49-4ab6-bff5-8b020af1916f", "ref_doc_id": "ae56fe8d-ab49-4ab6-bff5-8b020af1916f", "chroma:document": "\u2705         |      \u274c      |\n|                    [Swin Transformer](model_doc/swin)                    |       \u2705        |         \u2705         |      \u274c      |\n|                 [Swin Transformer V2](model_doc/swinv2)                  |       \u2705        |         \u274c         |      \u274c      |\n|                       [Swin2SR](model_doc/swin2sr)                       |       \u2705        |         \u274c         |      \u274c      |\n|           [SwitchTransformers](model_doc/switch_transformers)            |       \u2705        |         \u274c         |      \u274c      |\n|                            [T5](model_doc/t5)                            |       \u2705        |         \u2705         |      \u2705      |\n|                        [T5v1.1](model_doc/t5v1.1)                        |       \u2705        |         \u2705         |      \u2705      |\n|             [Table Transformer](model_doc/table-transformer)             |       \u2705        |         \u274c         |      \u274c      |\n|                         [TAPAS](model_doc/tapas)                         |"}


created_at: 2024-08-26 20:30:03
topic: persistent://default/default/621deaf2-9359-4ac4-ada0-047176703e13
id: db804067-5407-4f3a-a168-e4674fbb1f10
encoding: FLOAT32
metadata:
{"url": "https://huggingface.co/docs/transformers/index", "title": "\ud83e\udd17 Transformers", "tokens": 9875, "retrieve_doc": false, "source": "transformers", "_node_content": "{\"id_\": \"db804067-5407-4f3a-a168-e4674fbb1f10\", \"embedding\": null, \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/index\", \"title\": \"\\ud83e\\udd17 Transformers\", \"tokens\": 9875, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"ae56fe8d-ab49-4ab6-bff5-8b020af1916f\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/index\", \"title\": \"\\ud83e\\udd17 Transformers\", \"tokens\": 9875, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"hash\": \"836865c358dea9b81d80ebb705572b7f9f4dcfd6479dc208d646d8499b9bd468\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"9be8f067-cbb6-4887-b371-fe258d10aff9\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/index\", \"title\": \"\\ud83e\\udd17 Transformers\", \"tokens\": 9875, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"hash\": \"8e02c63ffe70e1f392f6e8a9e3e25366aed389487369e38439e8bd3edf85fa99\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"616e120c-3ae0-4995-b64b-1c854430bde4\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"027b69a25bf24c89add0ba2e7d03163f89b7e81809d7ea1de6dfcb061c85b67f\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 34101, \"end_char_idx\": 35136, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "ae56fe8d-ab49-4ab6-bff5-8b020af1916f", "doc_id": "ae56fe8d-ab49-4ab6-bff5-8b020af1916f", "ref_doc_id": "ae56fe8d-ab49-4ab6-bff5-8b020af1916f", "chroma:document": "\u274c         |      \u274c      |\n|                            [T5](model_doc/t5)                            |       \u2705        |         \u2705         |      \u2705      |\n|                        [T5v1.1](model_doc/t5v1.1)                        |       \u2705        |         \u2705         |      \u2705      |\n|             [Table Transformer](model_doc/table-transformer)             |       \u2705        |         \u274c         |      \u274c      |\n|                         [TAPAS](model_doc/tapas)                         |       \u2705        |         \u2705         |      \u274c      |\n|                         [TAPEX](model_doc/tapex)                         |       \u2705        |         \u2705         |      \u2705      |\n|       [Time Series Transformer](model_doc/time_series_transformer)       |       \u2705        |         \u274c         |      \u274c      |\n|                   [TimeSformer](model_doc/timesformer)                   |       \u2705        |         \u274c         |      \u274c      |\n|        [Trajectory Transformer](model_doc/trajectory_transformer)        |       \u2705        |         \u274c         |"}


created_at: 2024-08-26 20:30:03
topic: persistent://default/default/621deaf2-9359-4ac4-ada0-047176703e13
id: 616e120c-3ae0-4995-b64b-1c854430bde4
encoding: FLOAT32
metadata:
{"url": "https://huggingface.co/docs/transformers/index", "title": "\ud83e\udd17 Transformers", "tokens": 9875, "retrieve_doc": false, "source": "transformers", "_node_content": "{\"id_\": \"616e120c-3ae0-4995-b64b-1c854430bde4\", \"embedding\": null, \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/index\", \"title\": \"\\ud83e\\udd17 Transformers\", \"tokens\": 9875, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"ae56fe8d-ab49-4ab6-bff5-8b020af1916f\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/index\", \"title\": \"\\ud83e\\udd17 Transformers\", \"tokens\": 9875, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"hash\": \"836865c358dea9b81d80ebb705572b7f9f4dcfd6479dc208d646d8499b9bd468\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"db804067-5407-4f3a-a168-e4674fbb1f10\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/index\", \"title\": \"\\ud83e\\udd17 Transformers\", \"tokens\": 9875, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"hash\": \"6d9323a182cf3728d3b89c088825abfda6057092a6ebf198c1ef7399e7be4b4f\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"77fbcb21-82ee-494e-8d4e-6fa50fe6a5df\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"14013ebc478453b2a4c34ffc024211f146f3c69405b22f4a77b970d7395bcf59\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 34586, \"end_char_idx\": 35611, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "ae56fe8d-ab49-4ab6-bff5-8b020af1916f", "doc_id": "ae56fe8d-ab49-4ab6-bff5-8b020af1916f", "ref_doc_id": "ae56fe8d-ab49-4ab6-bff5-8b020af1916f", "chroma:document": "|       \u2705        |         \u2705         |      \u274c      |\n|                         [TAPEX](model_doc/tapex)                         |       \u2705        |         \u2705         |      \u2705      |\n|       [Time Series Transformer](model_doc/time_series_transformer)       |       \u2705        |         \u274c         |      \u274c      |\n|                   [TimeSformer](model_doc/timesformer)                   |       \u2705        |         \u274c         |      \u274c      |\n|        [Trajectory Transformer](model_doc/trajectory_transformer)        |       \u2705        |         \u274c         |      \u274c      |\n|                  [Transformer-XL](model_doc/transfo-xl)                  |       \u2705        |         \u2705         |      \u274c      |\n|                         [TrOCR](model_doc/trocr)                         |       \u2705        |         \u274c         |      \u274c      |\n|                          [TVLT](model_doc/tvlt)                          |       \u2705        |         \u274c         |      \u274c      |\n|                           [TVP](model_doc/tvp)                           |"}


created_at: 2024-08-26 20:30:03
topic: persistent://default/default/621deaf2-9359-4ac4-ada0-047176703e13
id: 77fbcb21-82ee-494e-8d4e-6fa50fe6a5df
encoding: FLOAT32
metadata:
{"url": "https://huggingface.co/docs/transformers/index", "title": "\ud83e\udd17 Transformers", "tokens": 9875, "retrieve_doc": false, "source": "transformers", "_node_content": "{\"id_\": \"77fbcb21-82ee-494e-8d4e-6fa50fe6a5df\", \"embedding\": null, \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/index\", \"title\": \"\\ud83e\\udd17 Transformers\", \"tokens\": 9875, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"ae56fe8d-ab49-4ab6-bff5-8b020af1916f\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/index\", \"title\": \"\\ud83e\\udd17 Transformers\", \"tokens\": 9875, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"hash\": \"836865c358dea9b81d80ebb705572b7f9f4dcfd6479dc208d646d8499b9bd468\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"616e120c-3ae0-4995-b64b-1c854430bde4\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/index\", \"title\": \"\\ud83e\\udd17 Transformers\", \"tokens\": 9875, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"hash\": \"0c8e7078deb7981f0503fae079b65d1be283a6abf796016d91e4fe5ff837db2b\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"c84ea8e7-d01d-4bda-b39b-6a15b3cb04de\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"491b4dc00cad5496da8d2c82b0716bc45acef676fd5af25ecf1de2462000f434\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 35125, \"end_char_idx\": 36048, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "ae56fe8d-ab49-4ab6-bff5-8b020af1916f", "doc_id": "ae56fe8d-ab49-4ab6-bff5-8b020af1916f", "ref_doc_id": "ae56fe8d-ab49-4ab6-bff5-8b020af1916f", "chroma:document": "\u274c         |      \u274c      |\n|                  [Transformer-XL](model_doc/transfo-xl)                  |       \u2705        |         \u2705         |      \u274c      |\n|                         [TrOCR](model_doc/trocr)                         |       \u2705        |         \u274c         |      \u274c      |\n|                          [TVLT](model_doc/tvlt)                          |       \u2705        |         \u274c         |      \u274c      |\n|                           [TVP](model_doc/tvp)                           |       \u2705        |         \u274c         |      \u274c      |\n|                          [UDOP](model_doc/udop)                          |       \u2705        |         \u274c         |      \u274c      |\n|                           [UL2](model_doc/ul2)                           |       \u2705        |         \u2705         |      \u2705      |\n|                          [UMT5](model_doc/umt5)                          |       \u2705        |         \u274c         |      \u274c      |\n|"}


created_at: 2024-08-26 20:30:03
topic: persistent://default/default/621deaf2-9359-4ac4-ada0-047176703e13
id: c84ea8e7-d01d-4bda-b39b-6a15b3cb04de
encoding: FLOAT32
metadata:
{"url": "https://huggingface.co/docs/transformers/index", "title": "\ud83e\udd17 Transformers", "tokens": 9875, "retrieve_doc": false, "source": "transformers", "_node_content": "{\"id_\": \"c84ea8e7-d01d-4bda-b39b-6a15b3cb04de\", \"embedding\": null, \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/index\", \"title\": \"\\ud83e\\udd17 Transformers\", \"tokens\": 9875, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"ae56fe8d-ab49-4ab6-bff5-8b020af1916f\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/index\", \"title\": \"\\ud83e\\udd17 Transformers\", \"tokens\": 9875, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"hash\": \"836865c358dea9b81d80ebb705572b7f9f4dcfd6479dc208d646d8499b9bd468\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"77fbcb21-82ee-494e-8d4e-6fa50fe6a5df\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/index\", \"title\": \"\\ud83e\\udd17 Transformers\", \"tokens\": 9875, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"hash\": \"88c3ce94006d69056399b619f0123c66d31fcd30725322a5ca70a72e157fb54e\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"b98236be-70e0-43ef-a5bc-560112655701\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"d1658002720beb10432a8f938a824c7a3cd5aa3f457d74d52e883ed0c7697c60\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 35610, \"end_char_idx\": 36544, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "ae56fe8d-ab49-4ab6-bff5-8b020af1916f", "doc_id": "ae56fe8d-ab49-4ab6-bff5-8b020af1916f", "ref_doc_id": "ae56fe8d-ab49-4ab6-bff5-8b020af1916f", "chroma:document": "|       \u2705        |         \u274c         |      \u274c      |\n|                          [UDOP](model_doc/udop)                          |       \u2705        |         \u274c         |      \u274c      |\n|                           [UL2](model_doc/ul2)                           |       \u2705        |         \u2705         |      \u2705      |\n|                          [UMT5](model_doc/umt5)                          |       \u2705        |         \u274c         |      \u274c      |\n|                     [UniSpeech](model_doc/unispeech)                     |       \u2705        |         \u274c         |      \u274c      |\n|                 [UniSpeechSat](model_doc/unispeech-sat)                  |       \u2705        |         \u274c         |      \u274c      |\n|                       [UnivNet](model_doc/univnet)                       |       \u2705        |         \u274c         |      \u274c      |\n|                       [UPerNet](model_doc/upernet)                       |       \u2705        |         \u274c         |"}


created_at: 2024-08-26 20:30:03
topic: persistent://default/default/621deaf2-9359-4ac4-ada0-047176703e13
id: b98236be-70e0-43ef-a5bc-560112655701
encoding: FLOAT32
metadata:
{"url": "https://huggingface.co/docs/transformers/index", "title": "\ud83e\udd17 Transformers", "tokens": 9875, "retrieve_doc": false, "source": "transformers", "_node_content": "{\"id_\": \"b98236be-70e0-43ef-a5bc-560112655701\", \"embedding\": null, \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/index\", \"title\": \"\\ud83e\\udd17 Transformers\", \"tokens\": 9875, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"ae56fe8d-ab49-4ab6-bff5-8b020af1916f\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/index\", \"title\": \"\\ud83e\\udd17 Transformers\", \"tokens\": 9875, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"hash\": \"836865c358dea9b81d80ebb705572b7f9f4dcfd6479dc208d646d8499b9bd468\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"c84ea8e7-d01d-4bda-b39b-6a15b3cb04de\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/index\", \"title\": \"\\ud83e\\udd17 Transformers\", \"tokens\": 9875, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"hash\": \"bcc79778acf6b10f8feebfdaf5b514912a1ef70ba0e2b2075df2e388e73a9399\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"c69e5afa-4043-48b6-8e4a-49bb635de92d\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"f6fa1decd338bdcc407c6998a24256d299eb1432e6bf2f9fd923a22d5458881d\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 36038, \"end_char_idx\": 36992, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "ae56fe8d-ab49-4ab6-bff5-8b020af1916f", "doc_id": "ae56fe8d-ab49-4ab6-bff5-8b020af1916f", "ref_doc_id": "ae56fe8d-ab49-4ab6-bff5-8b020af1916f", "chroma:document": "\u274c      |\n|                     [UniSpeech](model_doc/unispeech)                     |       \u2705        |         \u274c         |      \u274c      |\n|                 [UniSpeechSat](model_doc/unispeech-sat)                  |       \u2705        |         \u274c         |      \u274c      |\n|                       [UnivNet](model_doc/univnet)                       |       \u2705        |         \u274c         |      \u274c      |\n|                       [UPerNet](model_doc/upernet)                       |       \u2705        |         \u274c         |      \u274c      |\n|                           [VAN](model_doc/van)                           |       \u2705        |         \u274c         |      \u274c      |\n|                   [VideoLlava](model_doc/video_llava)                    |       \u2705        |         \u274c         |      \u274c      |\n|                      [VideoMAE](model_doc/videomae)                      |       \u2705        |         \u274c         |      \u274c      |\n|                          [ViLT](model_doc/vilt)"}


created_at: 2024-08-26 20:30:03
topic: persistent://default/default/621deaf2-9359-4ac4-ada0-047176703e13
id: c69e5afa-4043-48b6-8e4a-49bb635de92d
encoding: FLOAT32
metadata:
{"url": "https://huggingface.co/docs/transformers/index", "title": "\ud83e\udd17 Transformers", "tokens": 9875, "retrieve_doc": false, "source": "transformers", "_node_content": "{\"id_\": \"c69e5afa-4043-48b6-8e4a-49bb635de92d\", \"embedding\": null, \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/index\", \"title\": \"\\ud83e\\udd17 Transformers\", \"tokens\": 9875, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"ae56fe8d-ab49-4ab6-bff5-8b020af1916f\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/index\", \"title\": \"\\ud83e\\udd17 Transformers\", \"tokens\": 9875, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"hash\": \"836865c358dea9b81d80ebb705572b7f9f4dcfd6479dc208d646d8499b9bd468\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"b98236be-70e0-43ef-a5bc-560112655701\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/index\", \"title\": \"\\ud83e\\udd17 Transformers\", \"tokens\": 9875, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"hash\": \"bdd5d07a7068cbe9b21f65678771ca3b417a193c94921491575e66251ae4423e\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"d167a09f-5aab-4ea6-a7bd-ec731663f737\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"31e14a65f1aba868307a74888f31ca8772a0c191032c769a11eae265c921d5d2\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 36533, \"end_char_idx\": 37548, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "ae56fe8d-ab49-4ab6-bff5-8b020af1916f", "doc_id": "ae56fe8d-ab49-4ab6-bff5-8b020af1916f", "ref_doc_id": "ae56fe8d-ab49-4ab6-bff5-8b020af1916f", "chroma:document": "\u274c         |      \u274c      |\n|                           [VAN](model_doc/van)                           |       \u2705        |         \u274c         |      \u274c      |\n|                   [VideoLlava](model_doc/video_llava)                    |       \u2705        |         \u274c         |      \u274c      |\n|                      [VideoMAE](model_doc/videomae)                      |       \u2705        |         \u274c         |      \u274c      |\n|                          [ViLT](model_doc/vilt)                          |       \u2705        |         \u274c         |      \u274c      |\n|                      [VipLlava](model_doc/vipllava)                      |       \u2705        |         \u274c         |      \u274c      |\n|        [Vision Encoder decoder](model_doc/vision-encoder-decoder)        |       \u2705        |         \u2705         |      \u2705      |\n|       [VisionTextDualEncoder](model_doc/vision-text-dual-encoder)        |       \u2705        |         \u2705         |      \u2705      |\n|                   [VisualBERT](model_doc/visual_bert)                    |       \u2705        |"}


created_at: 2024-08-26 20:30:03
topic: persistent://default/default/621deaf2-9359-4ac4-ada0-047176703e13
id: d167a09f-5aab-4ea6-a7bd-ec731663f737
encoding: FLOAT32
metadata:
{"url": "https://huggingface.co/docs/transformers/index", "title": "\ud83e\udd17 Transformers", "tokens": 9875, "retrieve_doc": false, "source": "transformers", "_node_content": "{\"id_\": \"d167a09f-5aab-4ea6-a7bd-ec731663f737\", \"embedding\": null, \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/index\", \"title\": \"\\ud83e\\udd17 Transformers\", \"tokens\": 9875, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"ae56fe8d-ab49-4ab6-bff5-8b020af1916f\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/index\", \"title\": \"\\ud83e\\udd17 Transformers\", \"tokens\": 9875, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"hash\": \"836865c358dea9b81d80ebb705572b7f9f4dcfd6479dc208d646d8499b9bd468\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"c69e5afa-4043-48b6-8e4a-49bb635de92d\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/index\", \"title\": \"\\ud83e\\udd17 Transformers\", \"tokens\": 9875, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"hash\": \"40d8b1482ce06a8d7dc87540d79da9e9248bf9da732f6bed1e65f6e0469ecbc0\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"ba17de40-3512-44b3-be2e-13c4a7fd30c1\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"d29f2d8b062b48dd302acf953682fa5b0347fd55934d18c92208983f513bcd7d\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 37018, \"end_char_idx\": 38018, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "ae56fe8d-ab49-4ab6-bff5-8b020af1916f", "doc_id": "ae56fe8d-ab49-4ab6-bff5-8b020af1916f", "ref_doc_id": "ae56fe8d-ab49-4ab6-bff5-8b020af1916f", "chroma:document": "|       \u2705        |         \u274c         |      \u274c      |\n|                      [VipLlava](model_doc/vipllava)                      |       \u2705        |         \u274c         |      \u274c      |\n|        [Vision Encoder decoder](model_doc/vision-encoder-decoder)        |       \u2705        |         \u2705         |      \u2705      |\n|       [VisionTextDualEncoder](model_doc/vision-text-dual-encoder)        |       \u2705        |         \u2705         |      \u2705      |\n|                   [VisualBERT](model_doc/visual_bert)                    |       \u2705        |         \u274c         |      \u274c      |\n|                           [ViT](model_doc/vit)                           |       \u2705        |         \u2705         |      \u2705      |\n|                    [ViT Hybrid](model_doc/vit_hybrid)                    |       \u2705        |         \u274c         |      \u274c      |\n|                        [VitDet](model_doc/vitdet)                        |       \u2705        |         \u274c         |      \u274c      |\n|                       [ViTMAE](model_doc/vit_mae)"}


created_at: 2024-08-26 20:30:03
topic: persistent://default/default/621deaf2-9359-4ac4-ada0-047176703e13
id: ba17de40-3512-44b3-be2e-13c4a7fd30c1
encoding: FLOAT32
metadata:
{"url": "https://huggingface.co/docs/transformers/index", "title": "\ud83e\udd17 Transformers", "tokens": 9875, "retrieve_doc": false, "source": "transformers", "_node_content": "{\"id_\": \"ba17de40-3512-44b3-be2e-13c4a7fd30c1\", \"embedding\": null, \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/index\", \"title\": \"\\ud83e\\udd17 Transformers\", \"tokens\": 9875, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"ae56fe8d-ab49-4ab6-bff5-8b020af1916f\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/index\", \"title\": \"\\ud83e\\udd17 Transformers\", \"tokens\": 9875, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"hash\": \"836865c358dea9b81d80ebb705572b7f9f4dcfd6479dc208d646d8499b9bd468\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"d167a09f-5aab-4ea6-a7bd-ec731663f737\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/index\", \"title\": \"\\ud83e\\udd17 Transformers\", \"tokens\": 9875, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"hash\": \"3922004f56c68a92bdecf4141a54f19ba345533fdcb5f026a13b73d899b4bc22\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"9e3ca454-92cf-4e3d-8f76-20cfd9f4a11f\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"ac1c6faa57a9d3a1719c3717895ff5601ce700392c86bfeba740104c43f44cee\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 37547, \"end_char_idx\": 38480, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "ae56fe8d-ab49-4ab6-bff5-8b020af1916f", "doc_id": "ae56fe8d-ab49-4ab6-bff5-8b020af1916f", "ref_doc_id": "ae56fe8d-ab49-4ab6-bff5-8b020af1916f", "chroma:document": "|         \u274c         |      \u274c      |\n|                           [ViT](model_doc/vit)                           |       \u2705        |         \u2705         |      \u2705      |\n|                    [ViT Hybrid](model_doc/vit_hybrid)                    |       \u2705        |         \u274c         |      \u274c      |\n|                        [VitDet](model_doc/vitdet)                        |       \u2705        |         \u274c         |      \u274c      |\n|                       [ViTMAE](model_doc/vit_mae)                        |       \u2705        |         \u2705         |      \u274c      |\n|                      [ViTMatte](model_doc/vitmatte)                      |       \u2705        |         \u274c         |      \u274c      |\n|                       [ViTMSN](model_doc/vit_msn)                        |       \u2705        |         \u274c         |      \u274c      |\n|                          [VITS](model_doc/vits)                          |       \u2705        |         \u274c         |      \u274c      |\n|"}


created_at: 2024-08-26 20:30:03
topic: persistent://default/default/621deaf2-9359-4ac4-ada0-047176703e13
id: 9e3ca454-92cf-4e3d-8f76-20cfd9f4a11f
encoding: FLOAT32
metadata:
{"url": "https://huggingface.co/docs/transformers/index", "title": "\ud83e\udd17 Transformers", "tokens": 9875, "retrieve_doc": false, "source": "transformers", "_node_content": "{\"id_\": \"9e3ca454-92cf-4e3d-8f76-20cfd9f4a11f\", \"embedding\": null, \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/index\", \"title\": \"\\ud83e\\udd17 Transformers\", \"tokens\": 9875, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"ae56fe8d-ab49-4ab6-bff5-8b020af1916f\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/index\", \"title\": \"\\ud83e\\udd17 Transformers\", \"tokens\": 9875, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"hash\": \"836865c358dea9b81d80ebb705572b7f9f4dcfd6479dc208d646d8499b9bd468\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"ba17de40-3512-44b3-be2e-13c4a7fd30c1\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/index\", \"title\": \"\\ud83e\\udd17 Transformers\", \"tokens\": 9875, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"hash\": \"d8c6264c5d40cb5dbf27e12e10a061f59ccafae023df33895dc85658e4301dee\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"5505ee32-e187-4768-ab83-c4437f5cdba1\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"151b86a7753c69941c264bb0031df54cbfaed5a9cd06b415ae829824051ca26b\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 38042, \"end_char_idx\": 38966, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "ae56fe8d-ab49-4ab6-bff5-8b020af1916f", "doc_id": "ae56fe8d-ab49-4ab6-bff5-8b020af1916f", "ref_doc_id": "ae56fe8d-ab49-4ab6-bff5-8b020af1916f", "chroma:document": "|       \u2705        |         \u2705         |      \u274c      |\n|                      [ViTMatte](model_doc/vitmatte)                      |       \u2705        |         \u274c         |      \u274c      |\n|                       [ViTMSN](model_doc/vit_msn)                        |       \u2705        |         \u274c         |      \u274c      |\n|                          [VITS](model_doc/vits)                          |       \u2705        |         \u274c         |      \u274c      |\n|                         [ViViT](model_doc/vivit)                         |       \u2705        |         \u274c         |      \u274c      |\n|                      [Wav2Vec2](model_doc/wav2vec2)                      |       \u2705        |         \u2705         |      \u2705      |\n|                 [Wav2Vec2-BERT](model_doc/wav2vec2-bert)                 |       \u2705        |         \u274c         |      \u274c      |\n|            [Wav2Vec2-Conformer](model_doc/wav2vec2-conformer)            |       \u2705        |         \u274c"}


created_at: 2024-08-26 20:30:03
topic: persistent://default/default/621deaf2-9359-4ac4-ada0-047176703e13
id: 5505ee32-e187-4768-ab83-c4437f5cdba1
encoding: FLOAT32
metadata:
{"url": "https://huggingface.co/docs/transformers/index", "title": "\ud83e\udd17 Transformers", "tokens": 9875, "retrieve_doc": false, "source": "transformers", "_node_content": "{\"id_\": \"5505ee32-e187-4768-ab83-c4437f5cdba1\", \"embedding\": null, \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/index\", \"title\": \"\\ud83e\\udd17 Transformers\", \"tokens\": 9875, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"ae56fe8d-ab49-4ab6-bff5-8b020af1916f\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/index\", \"title\": \"\\ud83e\\udd17 Transformers\", \"tokens\": 9875, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"hash\": \"836865c358dea9b81d80ebb705572b7f9f4dcfd6479dc208d646d8499b9bd468\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"9e3ca454-92cf-4e3d-8f76-20cfd9f4a11f\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/index\", \"title\": \"\\ud83e\\udd17 Transformers\", \"tokens\": 9875, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"hash\": \"8dc83ed27cde68be320fb212fa2ab92471eaea71708e2aa0e03816d2249a2ad6\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"e206fb57-0267-45ba-9044-64ddb0490fa3\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"c8e09ae160cbf12eea06b75fcdb45246c577d282e58b78e007c2f594848969a0\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 38477, \"end_char_idx\": 39451, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "ae56fe8d-ab49-4ab6-bff5-8b020af1916f", "doc_id": "ae56fe8d-ab49-4ab6-bff5-8b020af1916f", "ref_doc_id": "ae56fe8d-ab49-4ab6-bff5-8b020af1916f", "chroma:document": "|\n|                         [ViViT](model_doc/vivit)                         |       \u2705        |         \u274c         |      \u274c      |\n|                      [Wav2Vec2](model_doc/wav2vec2)                      |       \u2705        |         \u2705         |      \u2705      |\n|                 [Wav2Vec2-BERT](model_doc/wav2vec2-bert)                 |       \u2705        |         \u274c         |      \u274c      |\n|            [Wav2Vec2-Conformer](model_doc/wav2vec2-conformer)            |       \u2705        |         \u274c         |      \u274c      |\n|              [Wav2Vec2Phoneme](model_doc/wav2vec2_phoneme)               |       \u2705        |         \u2705         |      \u2705      |\n|                         [WavLM](model_doc/wavlm)                         |       \u2705        |         \u274c         |      \u274c      |\n|                       [Whisper](model_doc/whisper)                       |       \u2705        |         \u2705         |      \u2705      |\n|                        [X-CLIP](model_doc/xclip)                         |"}


created_at: 2024-08-26 20:30:03
topic: persistent://default/default/621deaf2-9359-4ac4-ada0-047176703e13
id: e206fb57-0267-45ba-9044-64ddb0490fa3
encoding: FLOAT32
metadata:
{"url": "https://huggingface.co/docs/transformers/index", "title": "\ud83e\udd17 Transformers", "tokens": 9875, "retrieve_doc": false, "source": "transformers", "_node_content": "{\"id_\": \"e206fb57-0267-45ba-9044-64ddb0490fa3\", \"embedding\": null, \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/index\", \"title\": \"\\ud83e\\udd17 Transformers\", \"tokens\": 9875, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"ae56fe8d-ab49-4ab6-bff5-8b020af1916f\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/index\", \"title\": \"\\ud83e\\udd17 Transformers\", \"tokens\": 9875, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"hash\": \"836865c358dea9b81d80ebb705572b7f9f4dcfd6479dc208d646d8499b9bd468\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"5505ee32-e187-4768-ab83-c4437f5cdba1\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/index\", \"title\": \"\\ud83e\\udd17 Transformers\", \"tokens\": 9875, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"hash\": \"96805c71c11277cdc9144203dbbd00cafca6055fb625e549ab3f1dd9ba814226\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"c2b5b845-88ed-4aea-8162-1c1c5545c969\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"89ef2d94085ed50fd42be18d4ab245f2f0020396f63f4ff0170e02295ec33e03\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 38965, \"end_char_idx\": 39888, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "ae56fe8d-ab49-4ab6-bff5-8b020af1916f", "doc_id": "ae56fe8d-ab49-4ab6-bff5-8b020af1916f", "ref_doc_id": "ae56fe8d-ab49-4ab6-bff5-8b020af1916f", "chroma:document": "\u274c         |      \u274c      |\n|              [Wav2Vec2Phoneme](model_doc/wav2vec2_phoneme)               |       \u2705        |         \u2705         |      \u2705      |\n|                         [WavLM](model_doc/wavlm)                         |       \u2705        |         \u274c         |      \u274c      |\n|                       [Whisper](model_doc/whisper)                       |       \u2705        |         \u2705         |      \u2705      |\n|                        [X-CLIP](model_doc/xclip)                         |       \u2705        |         \u274c         |      \u274c      |\n|                         [X-MOD](model_doc/xmod)                          |       \u2705        |         \u274c         |      \u274c      |\n|                          [XGLM](model_doc/xglm)                          |       \u2705        |         \u2705         |      \u2705      |\n|                           [XLM](model_doc/xlm)                           |       \u2705        |         \u2705         |      \u274c      |\n|"}


created_at: 2024-08-26 20:30:03
topic: persistent://default/default/621deaf2-9359-4ac4-ada0-047176703e13
id: c2b5b845-88ed-4aea-8162-1c1c5545c969
encoding: FLOAT32
metadata:
{"url": "https://huggingface.co/docs/transformers/index", "title": "\ud83e\udd17 Transformers", "tokens": 9875, "retrieve_doc": false, "source": "transformers", "_node_content": "{\"id_\": \"c2b5b845-88ed-4aea-8162-1c1c5545c969\", \"embedding\": null, \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/index\", \"title\": \"\\ud83e\\udd17 Transformers\", \"tokens\": 9875, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"ae56fe8d-ab49-4ab6-bff5-8b020af1916f\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/index\", \"title\": \"\\ud83e\\udd17 Transformers\", \"tokens\": 9875, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"hash\": \"836865c358dea9b81d80ebb705572b7f9f4dcfd6479dc208d646d8499b9bd468\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"e206fb57-0267-45ba-9044-64ddb0490fa3\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/index\", \"title\": \"\\ud83e\\udd17 Transformers\", \"tokens\": 9875, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"hash\": \"b1b7f99e1249cae4f67018422502eb66e5c2db4103100fe018479d38de2ea898\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"9fa2af0d-f0fe-4ade-a091-dbcc415bb981\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"04f00db1c44de05f1778bf3123d588e1811fd8dc898eab0707e316a69d6c39fc\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 39450, \"end_char_idx\": 40384, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "ae56fe8d-ab49-4ab6-bff5-8b020af1916f", "doc_id": "ae56fe8d-ab49-4ab6-bff5-8b020af1916f", "ref_doc_id": "ae56fe8d-ab49-4ab6-bff5-8b020af1916f", "chroma:document": "|       \u2705        |         \u274c         |      \u274c      |\n|                         [X-MOD](model_doc/xmod)                          |       \u2705        |         \u274c         |      \u274c      |\n|                          [XGLM](model_doc/xglm)                          |       \u2705        |         \u2705         |      \u2705      |\n|                           [XLM](model_doc/xlm)                           |       \u2705        |         \u2705         |      \u274c      |\n|                [XLM-ProphetNet](model_doc/xlm-prophetnet)                |       \u2705        |         \u274c         |      \u274c      |\n|                   [XLM-RoBERTa](model_doc/xlm-roberta)                   |       \u2705        |         \u2705         |      \u2705      |\n|                [XLM-RoBERTa-XL](model_doc/xlm-roberta-xl)                |       \u2705        |         \u274c         |      \u274c      |\n|                         [XLM-V](model_doc/xlm-v)                         |       \u2705        |         \u2705         |"}


created_at: 2024-08-26 20:30:03
topic: persistent://default/default/621deaf2-9359-4ac4-ada0-047176703e13
id: 9fa2af0d-f0fe-4ade-a091-dbcc415bb981
encoding: FLOAT32
metadata:
{"url": "https://huggingface.co/docs/transformers/index", "title": "\ud83e\udd17 Transformers", "tokens": 9875, "retrieve_doc": false, "source": "transformers", "_node_content": "{\"id_\": \"9fa2af0d-f0fe-4ade-a091-dbcc415bb981\", \"embedding\": null, \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/index\", \"title\": \"\\ud83e\\udd17 Transformers\", \"tokens\": 9875, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"ae56fe8d-ab49-4ab6-bff5-8b020af1916f\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/index\", \"title\": \"\\ud83e\\udd17 Transformers\", \"tokens\": 9875, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"hash\": \"836865c358dea9b81d80ebb705572b7f9f4dcfd6479dc208d646d8499b9bd468\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"c2b5b845-88ed-4aea-8162-1c1c5545c969\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/index\", \"title\": \"\\ud83e\\udd17 Transformers\", \"tokens\": 9875, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"hash\": \"b69f88ba6cd3fcffab8322a2e2ff41f7dc2f27bffd6abf97e6f298e784d18dfe\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"651dd095-7db7-49f8-a2d8-4a20cf3c9e9e\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"35dcea3d60fa7250bcba97817c42fcda84183f4a83e6c35dfb96995870141bbf\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 39885, \"end_char_idx\": 40833, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "ae56fe8d-ab49-4ab6-bff5-8b020af1916f", "doc_id": "ae56fe8d-ab49-4ab6-bff5-8b020af1916f", "ref_doc_id": "ae56fe8d-ab49-4ab6-bff5-8b020af1916f", "chroma:document": "|\n|                [XLM-ProphetNet](model_doc/xlm-prophetnet)                |       \u2705        |         \u274c         |      \u274c      |\n|                   [XLM-RoBERTa](model_doc/xlm-roberta)                   |       \u2705        |         \u2705         |      \u2705      |\n|                [XLM-RoBERTa-XL](model_doc/xlm-roberta-xl)                |       \u2705        |         \u274c         |      \u274c      |\n|                         [XLM-V](model_doc/xlm-v)                         |       \u2705        |         \u2705         |      \u2705      |\n|                         [XLNet](model_doc/xlnet)                         |       \u2705        |         \u2705         |      \u274c      |\n|                         [XLS-R](model_doc/xls_r)                         |       \u2705        |         \u2705         |      \u2705      |\n|                 [XLSR-Wav2Vec2](model_doc/xlsr_wav2vec2)                 |       \u2705        |         \u2705         |      \u2705      |\n|                         [YOLOS](model_doc/yolos)"}


created_at: 2024-08-26 20:30:03
topic: persistent://default/default/621deaf2-9359-4ac4-ada0-047176703e13
id: 651dd095-7db7-49f8-a2d8-4a20cf3c9e9e
encoding: FLOAT32
metadata:
{"url": "https://huggingface.co/docs/transformers/index", "title": "\ud83e\udd17 Transformers", "tokens": 9875, "retrieve_doc": false, "source": "transformers", "_node_content": "{\"id_\": \"651dd095-7db7-49f8-a2d8-4a20cf3c9e9e\", \"embedding\": null, \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/index\", \"title\": \"\\ud83e\\udd17 Transformers\", \"tokens\": 9875, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"ae56fe8d-ab49-4ab6-bff5-8b020af1916f\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/index\", \"title\": \"\\ud83e\\udd17 Transformers\", \"tokens\": 9875, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"hash\": \"836865c358dea9b81d80ebb705572b7f9f4dcfd6479dc208d646d8499b9bd468\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"9fa2af0d-f0fe-4ade-a091-dbcc415bb981\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/index\", \"title\": \"\\ud83e\\udd17 Transformers\", \"tokens\": 9875, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"hash\": \"37271e24208c4f7d72835757f0ae5d0644f8a6a4e79a3c9e235197ce04765f64\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 40383, \"end_char_idx\": 41185, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "ae56fe8d-ab49-4ab6-bff5-8b020af1916f", "doc_id": "ae56fe8d-ab49-4ab6-bff5-8b020af1916f", "ref_doc_id": "ae56fe8d-ab49-4ab6-bff5-8b020af1916f", "chroma:document": "|      \u2705      |\n|                         [XLNet](model_doc/xlnet)                         |       \u2705        |         \u2705         |      \u274c      |\n|                         [XLS-R](model_doc/xls_r)                         |       \u2705        |         \u2705         |      \u2705      |\n|                 [XLSR-Wav2Vec2](model_doc/xlsr_wav2vec2)                 |       \u2705        |         \u2705         |      \u2705      |\n|                         [YOLOS](model_doc/yolos)                         |       \u2705        |         \u274c         |      \u274c      |\n|                          [YOSO](model_doc/yoso)                          |       \u2705        |         \u274c         |      \u274c      |\n|                      [ZoeDepth](model_doc/zoedepth)                      |       \u2705        |         \u274c         |      \u274c      |\n\n<!-- End table-->"}


created_at: 2024-08-26 20:30:03
topic: persistent://default/default/621deaf2-9359-4ac4-ada0-047176703e13
id: 8e81a112-e222-44fc-83af-aaf1a27907de
encoding: FLOAT32
metadata:
{"url": "https://huggingface.co/docs/transformers/llm_tutorial_optimization", "title": "Optimizing LLMs for Speed and Memory", "tokens": 12767, "retrieve_doc": false, "source": "transformers", "_node_content": "{\"id_\": \"8e81a112-e222-44fc-83af-aaf1a27907de\", \"embedding\": null, \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/llm_tutorial_optimization\", \"title\": \"Optimizing LLMs for Speed and Memory\", \"tokens\": 12767, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"3d4a5be0-96a4-4cae-bb80-ec65cee94a22\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/llm_tutorial_optimization\", \"title\": \"Optimizing LLMs for Speed and Memory\", \"tokens\": 12767, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"hash\": \"bb1f2b699b61342ca13b75611df36eb9e3379ec4485edf0807dfbeb683246cf4\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"7a20c243-35c5-41a4-992b-0af2f7000f18\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"18ceb50f5c015cfd9900fa1d273897dd22119d0eff75c60692928bbf7bd0485b\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 0, \"end_char_idx\": 3282, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "3d4a5be0-96a4-4cae-bb80-ec65cee94a22", "doc_id": "3d4a5be0-96a4-4cae-bb80-ec65cee94a22", "ref_doc_id": "3d4a5be0-96a4-4cae-bb80-ec65cee94a22", "chroma:document": "# Optimizing LLMs for Speed and Memory\n\n[[open-in-colab]]\n\nLarge Language Models (LLMs) such as GPT3/4, [Falcon](https://huggingface.co/tiiuae/falcon-40b), and [Llama](https://huggingface.co/meta-llama/Llama-2-70b-hf) are rapidly advancing in their ability to tackle human-centric tasks, establishing themselves as essential tools in modern knowledge-based industries.\nDeploying these models in real-world tasks remains challenging, however:\n\n-   To exhibit near-human text understanding and generation capabilities, LLMs currently require to be composed of billions of parameters (see [Kaplan et al](https://arxiv.org/abs/2001.08361), [Wei et. al](https://arxiv.org/abs/2206.07682)). This consequently amplifies the memory demands for inference.\n-   In many real-world tasks, LLMs need to be given extensive contextual information. This necessitates the model's capability to manage very long input sequences during inference.\n\nThe crux of these challenges lies in augmenting the computational and memory capabilities of LLMs, especially when handling expansive input sequences.\n\nIn this guide, we will go over the effective techniques for efficient LLM deployment:\n\n1.  **Lower Precision:** Research has shown that operating at reduced numerical precision, namely [8-bit and 4-bit](./main_classes/quantization.md) can achieve computational advantages without a considerable decline in model performance.\n\n2.  **Flash Attention:** Flash Attention is a variation of the attention algorithm that not only provides a more memory-efficient approach but also realizes increased efficiency due to optimized GPU memory utilization.\n\n3.  **Architectural Innovations:** Considering that LLMs are always deployed in the same way during inference, namely autoregressive text generation with a long input context, specialized model architectures have been proposed that allow for more efficient inference. The most important advancement in model architectures hereby are [Alibi](https://arxiv.org/abs/2108.12409), [Rotary embeddings](https://arxiv.org/abs/2104.09864), [Multi-Query Attention (MQA)](https://arxiv.org/abs/1911.02150) and [Grouped-Query-Attention (GQA)]((https://arxiv.org/abs/2305.13245)).\n\nThroughout this guide, we will offer an analysis of auto-regressive generation from a tensor's perspective. We delve into the pros and cons of adopting lower precision, provide a comprehensive exploration of the latest attention algorithms, and discuss improved LLM architectures. While doing so, we run practical examples showcasing each of the feature improvements.\n\n## 1. Lower Precision\n\nMemory requirements of LLMs can be best understood by seeing the LLM as a set of weight matrices and vectors and the text inputs as a sequence of vectors. In the following, the definition *weights* will be used to signify all model weight matrices and vectors.\n\nAt the time of writing this guide, LLMs consist of at least a couple billion parameters. Each parameter thereby is made of a decimal number, e.g. `4.5689` which is usually stored in either [float32](https://en.wikipedia.org/wiki/Single-precision_floating-point_format), [bfloat16](https://en.wikipedia.org/wiki/Bfloat16_floating-point_format), or [float16](https://en.wikipedia.org/wiki/Half-precision_floating-point_format) format."}


created_at: 2024-08-26 20:30:03
topic: persistent://default/default/621deaf2-9359-4ac4-ada0-047176703e13
id: 7a20c243-35c5-41a4-992b-0af2f7000f18
encoding: FLOAT32
metadata:
{"url": "https://huggingface.co/docs/transformers/llm_tutorial_optimization", "title": "Optimizing LLMs for Speed and Memory", "tokens": 12767, "retrieve_doc": false, "source": "transformers", "_node_content": "{\"id_\": \"7a20c243-35c5-41a4-992b-0af2f7000f18\", \"embedding\": null, \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/llm_tutorial_optimization\", \"title\": \"Optimizing LLMs for Speed and Memory\", \"tokens\": 12767, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"3d4a5be0-96a4-4cae-bb80-ec65cee94a22\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/llm_tutorial_optimization\", \"title\": \"Optimizing LLMs for Speed and Memory\", \"tokens\": 12767, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"hash\": \"bb1f2b699b61342ca13b75611df36eb9e3379ec4485edf0807dfbeb683246cf4\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"8e81a112-e222-44fc-83af-aaf1a27907de\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/llm_tutorial_optimization\", \"title\": \"Optimizing LLMs for Speed and Memory\", \"tokens\": 12767, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"hash\": \"750b233959dd68b6e6cd300e2af360ac5516198f8be18e6c24ded286f9c2516b\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"9f18c838-0bda-4eff-96d8-9480047a1082\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"ab1e062eedb3764ab287b71744c2fd9be9cb264aa71d1bca465816832d1ce640\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 1627, \"end_char_idx\": 4102, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "3d4a5be0-96a4-4cae-bb80-ec65cee94a22", "doc_id": "3d4a5be0-96a4-4cae-bb80-ec65cee94a22", "ref_doc_id": "3d4a5be0-96a4-4cae-bb80-ec65cee94a22", "chroma:document": "3.  **Architectural Innovations:** Considering that LLMs are always deployed in the same way during inference, namely autoregressive text generation with a long input context, specialized model architectures have been proposed that allow for more efficient inference. The most important advancement in model architectures hereby are [Alibi](https://arxiv.org/abs/2108.12409), [Rotary embeddings](https://arxiv.org/abs/2104.09864), [Multi-Query Attention (MQA)](https://arxiv.org/abs/1911.02150) and [Grouped-Query-Attention (GQA)]((https://arxiv.org/abs/2305.13245)).\n\nThroughout this guide, we will offer an analysis of auto-regressive generation from a tensor's perspective. We delve into the pros and cons of adopting lower precision, provide a comprehensive exploration of the latest attention algorithms, and discuss improved LLM architectures. While doing so, we run practical examples showcasing each of the feature improvements.\n\n## 1. Lower Precision\n\nMemory requirements of LLMs can be best understood by seeing the LLM as a set of weight matrices and vectors and the text inputs as a sequence of vectors. In the following, the definition *weights* will be used to signify all model weight matrices and vectors.\n\nAt the time of writing this guide, LLMs consist of at least a couple billion parameters. Each parameter thereby is made of a decimal number, e.g. `4.5689` which is usually stored in either [float32](https://en.wikipedia.org/wiki/Single-precision_floating-point_format), [bfloat16](https://en.wikipedia.org/wiki/Bfloat16_floating-point_format), or [float16](https://en.wikipedia.org/wiki/Half-precision_floating-point_format) format. This allows us to easily compute the memory requirement to load the LLM into memory:\n\n> *Loading the weights of a model having X billion parameters requires roughly 4 * X GB of VRAM in float32 precision*\n\nNowadays, models are however rarely trained in full float32 precision, but usually in bfloat16 precision or less frequently in float16 precision. Therefore the rule of thumb becomes:\n\n> *Loading the weights of a model having X billion parameters requires roughly 2 * X GB of VRAM in bfloat16/float16 precision*\n\nFor shorter text inputs (less than 1024 tokens), the memory requirement for inference is very much dominated by the memory requirement to load the weights. Therefore, for now, let's assume that the memory requirement for inference is equal to the memory requirement to load the model into the GPU VRAM."}


created_at: 2024-08-26 20:30:03
topic: persistent://default/default/621deaf2-9359-4ac4-ada0-047176703e13
id: 9f18c838-0bda-4eff-96d8-9480047a1082
encoding: FLOAT32
metadata:
{"url": "https://huggingface.co/docs/transformers/llm_tutorial_optimization", "title": "Optimizing LLMs for Speed and Memory", "tokens": 12767, "retrieve_doc": false, "source": "transformers", "_node_content": "{\"id_\": \"9f18c838-0bda-4eff-96d8-9480047a1082\", \"embedding\": null, \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/llm_tutorial_optimization\", \"title\": \"Optimizing LLMs for Speed and Memory\", \"tokens\": 12767, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"3d4a5be0-96a4-4cae-bb80-ec65cee94a22\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/llm_tutorial_optimization\", \"title\": \"Optimizing LLMs for Speed and Memory\", \"tokens\": 12767, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"hash\": \"bb1f2b699b61342ca13b75611df36eb9e3379ec4485edf0807dfbeb683246cf4\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"7a20c243-35c5-41a4-992b-0af2f7000f18\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/llm_tutorial_optimization\", \"title\": \"Optimizing LLMs for Speed and Memory\", \"tokens\": 12767, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"hash\": \"3bd7fb37b2fd755752ef715ffa3716bf6c22bb61cfa7c7323fc3374c65f9b22f\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"b661d63f-cd67-459b-b0c4-c41d9f7a2737\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"637e4164204c1370b39310c7856a390417c23a41d1275c376ef9cddb0ab3bc0f\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 2304, \"end_char_idx\": 5217, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "3d4a5be0-96a4-4cae-bb80-ec65cee94a22", "doc_id": "3d4a5be0-96a4-4cae-bb80-ec65cee94a22", "ref_doc_id": "3d4a5be0-96a4-4cae-bb80-ec65cee94a22", "chroma:document": "We delve into the pros and cons of adopting lower precision, provide a comprehensive exploration of the latest attention algorithms, and discuss improved LLM architectures. While doing so, we run practical examples showcasing each of the feature improvements.\n\n## 1. Lower Precision\n\nMemory requirements of LLMs can be best understood by seeing the LLM as a set of weight matrices and vectors and the text inputs as a sequence of vectors. In the following, the definition *weights* will be used to signify all model weight matrices and vectors.\n\nAt the time of writing this guide, LLMs consist of at least a couple billion parameters. Each parameter thereby is made of a decimal number, e.g. `4.5689` which is usually stored in either [float32](https://en.wikipedia.org/wiki/Single-precision_floating-point_format), [bfloat16](https://en.wikipedia.org/wiki/Bfloat16_floating-point_format), or [float16](https://en.wikipedia.org/wiki/Half-precision_floating-point_format) format. This allows us to easily compute the memory requirement to load the LLM into memory:\n\n> *Loading the weights of a model having X billion parameters requires roughly 4 * X GB of VRAM in float32 precision*\n\nNowadays, models are however rarely trained in full float32 precision, but usually in bfloat16 precision or less frequently in float16 precision. Therefore the rule of thumb becomes:\n\n> *Loading the weights of a model having X billion parameters requires roughly 2 * X GB of VRAM in bfloat16/float16 precision*\n\nFor shorter text inputs (less than 1024 tokens), the memory requirement for inference is very much dominated by the memory requirement to load the weights. Therefore, for now, let's assume that the memory requirement for inference is equal to the memory requirement to load the model into the GPU VRAM.\n\nTo give some examples of how much VRAM it roughly takes to load a model in bfloat16:\n\n-   **GPT3** requires 2 \\* 175 GB = **350 GB** VRAM\n-   [**Bloom**](https://huggingface.co/bigscience/bloom) requires 2 \\* 176 GB = **352 GB** VRAM\n-   [**Llama-2-70b**](https://huggingface.co/meta-llama/Llama-2-70b-hf) requires 2 \\* 70 GB = **140 GB** VRAM\n-   [**Falcon-40b**](https://huggingface.co/tiiuae/falcon-40b) requires 2 \\* 40 GB = **80 GB** VRAM\n-   [**MPT-30b**](https://huggingface.co/mosaicml/mpt-30b) requires 2 \\* 30 GB = **60 GB** VRAM\n-   [**bigcode/starcoder**](https://huggingface.co/bigcode/starcoder) requires 2 \\* 15.5 = **31 GB** VRAM\n\nAs of writing this document, the largest GPU chip on the market is the A100 & H100 offering 80GB of VRAM. Most of the models listed before require more than 80GB just to be loaded and therefore necessarily require [tensor parallelism](https://huggingface.co/docs/transformers/perf_train_gpu_many#tensor-parallelism) and/or [pipeline parallelism](https://huggingface.co/docs/transformers/perf_train_gpu_many#naive-model-parallelism-vertical-and-pipeline-parallelism)."}


created_at: 2024-08-26 20:30:03
topic: persistent://default/default/621deaf2-9359-4ac4-ada0-047176703e13
id: b661d63f-cd67-459b-b0c4-c41d9f7a2737
encoding: FLOAT32
metadata:
{"url": "https://huggingface.co/docs/transformers/llm_tutorial_optimization", "title": "Optimizing LLMs for Speed and Memory", "tokens": 12767, "retrieve_doc": false, "source": "transformers", "_node_content": "{\"id_\": \"b661d63f-cd67-459b-b0c4-c41d9f7a2737\", \"embedding\": null, \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/llm_tutorial_optimization\", \"title\": \"Optimizing LLMs for Speed and Memory\", \"tokens\": 12767, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"3d4a5be0-96a4-4cae-bb80-ec65cee94a22\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/llm_tutorial_optimization\", \"title\": \"Optimizing LLMs for Speed and Memory\", \"tokens\": 12767, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"hash\": \"bb1f2b699b61342ca13b75611df36eb9e3379ec4485edf0807dfbeb683246cf4\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"9f18c838-0bda-4eff-96d8-9480047a1082\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/llm_tutorial_optimization\", \"title\": \"Optimizing LLMs for Speed and Memory\", \"tokens\": 12767, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"hash\": \"3d35e9d9fe259ceebabe636c5237008d91cd27a4d9b8af703d0a11154cacd4ca\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"e4af1050-bee8-4761-ab89-a3c7f598528c\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"1787cf67b4e0c1f5f3ee54a0676f2ba0477b425237ca7298383638711980af20\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 3956, \"end_char_idx\": 6790, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "3d4a5be0-96a4-4cae-bb80-ec65cee94a22", "doc_id": "3d4a5be0-96a4-4cae-bb80-ec65cee94a22", "ref_doc_id": "3d4a5be0-96a4-4cae-bb80-ec65cee94a22", "chroma:document": "Therefore, for now, let's assume that the memory requirement for inference is equal to the memory requirement to load the model into the GPU VRAM.\n\nTo give some examples of how much VRAM it roughly takes to load a model in bfloat16:\n\n-   **GPT3** requires 2 \\* 175 GB = **350 GB** VRAM\n-   [**Bloom**](https://huggingface.co/bigscience/bloom) requires 2 \\* 176 GB = **352 GB** VRAM\n-   [**Llama-2-70b**](https://huggingface.co/meta-llama/Llama-2-70b-hf) requires 2 \\* 70 GB = **140 GB** VRAM\n-   [**Falcon-40b**](https://huggingface.co/tiiuae/falcon-40b) requires 2 \\* 40 GB = **80 GB** VRAM\n-   [**MPT-30b**](https://huggingface.co/mosaicml/mpt-30b) requires 2 \\* 30 GB = **60 GB** VRAM\n-   [**bigcode/starcoder**](https://huggingface.co/bigcode/starcoder) requires 2 \\* 15.5 = **31 GB** VRAM\n\nAs of writing this document, the largest GPU chip on the market is the A100 & H100 offering 80GB of VRAM. Most of the models listed before require more than 80GB just to be loaded and therefore necessarily require [tensor parallelism](https://huggingface.co/docs/transformers/perf_train_gpu_many#tensor-parallelism) and/or [pipeline parallelism](https://huggingface.co/docs/transformers/perf_train_gpu_many#naive-model-parallelism-vertical-and-pipeline-parallelism).\n\n\ud83e\udd17 Transformers does not support tensor parallelism out of the box as it requires the model architecture to be written in a specific way. If you're interested in writing models in a tensor-parallelism-friendly way, feel free to have a look at [the text-generation-inference library](https://github.com/huggingface/text-generation-inference/tree/main/server/text_generation_server/models/custom_modeling).\n\nNaive pipeline parallelism is supported out of the box. For this, simply load the model with `device=\"auto\"` which will automatically place the different layers on the available GPUs as explained [here](https://huggingface.co/docs/accelerate/v0.22.0/en/concept_guides/big_model_inference).\nNote, however that while very effective, this naive pipeline parallelism does not tackle the issues of GPU idling. For this more advanced pipeline parallelism is required as explained [here](https://huggingface.co/docs/transformers/en/perf_train_gpu_many#naive-model-parallelism-vertical-and-pipeline-parallelism).\n\nIf you have access to an 8 x 80GB A100 node, you could load BLOOM as follows\n\n```bash\n!pip install transformers accelerate bitsandbytes optimum\n```\n```python\nfrom transformers import AutoModelForCausalLM\n\nmodel = AutoModelForCausalLM.from_pretrained(\"bigscience/bloom\", device_map=\"auto\", pad_token_id=0)\n```\n\nBy using `device_map=\"auto\"` the attention layers would be equally distributed over all available GPUs.\n\nIn this guide, we will use [bigcode/octocoder](https://huggingface.co/bigcode/octocoder) as it can be run on a single 40 GB A100 GPU device chip."}


created_at: 2024-08-26 20:30:03
topic: persistent://default/default/621deaf2-9359-4ac4-ada0-047176703e13
id: e4af1050-bee8-4761-ab89-a3c7f598528c
encoding: FLOAT32
metadata:
{"url": "https://huggingface.co/docs/transformers/llm_tutorial_optimization", "title": "Optimizing LLMs for Speed and Memory", "tokens": 12767, "retrieve_doc": false, "source": "transformers", "_node_content": "{\"id_\": \"e4af1050-bee8-4761-ab89-a3c7f598528c\", \"embedding\": null, \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/llm_tutorial_optimization\", \"title\": \"Optimizing LLMs for Speed and Memory\", \"tokens\": 12767, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"3d4a5be0-96a4-4cae-bb80-ec65cee94a22\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/llm_tutorial_optimization\", \"title\": \"Optimizing LLMs for Speed and Memory\", \"tokens\": 12767, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"hash\": \"bb1f2b699b61342ca13b75611df36eb9e3379ec4485edf0807dfbeb683246cf4\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"b661d63f-cd67-459b-b0c4-c41d9f7a2737\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/llm_tutorial_optimization\", \"title\": \"Optimizing LLMs for Speed and Memory\", \"tokens\": 12767, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"hash\": \"5dd063ca12cf983af568f6fe7055aec40114375d9cd3b4c430dd2d6374ea0cc3\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"63b4db71-af45-4fd1-97d3-ddcbef835ac5\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"57697e8a545df8252585b85773501f9e061a33f3ba241660a58753937517cee3\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 5219, \"end_char_idx\": 8410, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "3d4a5be0-96a4-4cae-bb80-ec65cee94a22", "doc_id": "3d4a5be0-96a4-4cae-bb80-ec65cee94a22", "ref_doc_id": "3d4a5be0-96a4-4cae-bb80-ec65cee94a22", "chroma:document": "\ud83e\udd17 Transformers does not support tensor parallelism out of the box as it requires the model architecture to be written in a specific way. If you're interested in writing models in a tensor-parallelism-friendly way, feel free to have a look at [the text-generation-inference library](https://github.com/huggingface/text-generation-inference/tree/main/server/text_generation_server/models/custom_modeling).\n\nNaive pipeline parallelism is supported out of the box. For this, simply load the model with `device=\"auto\"` which will automatically place the different layers on the available GPUs as explained [here](https://huggingface.co/docs/accelerate/v0.22.0/en/concept_guides/big_model_inference).\nNote, however that while very effective, this naive pipeline parallelism does not tackle the issues of GPU idling. For this more advanced pipeline parallelism is required as explained [here](https://huggingface.co/docs/transformers/en/perf_train_gpu_many#naive-model-parallelism-vertical-and-pipeline-parallelism).\n\nIf you have access to an 8 x 80GB A100 node, you could load BLOOM as follows\n\n```bash\n!pip install transformers accelerate bitsandbytes optimum\n```\n```python\nfrom transformers import AutoModelForCausalLM\n\nmodel = AutoModelForCausalLM.from_pretrained(\"bigscience/bloom\", device_map=\"auto\", pad_token_id=0)\n```\n\nBy using `device_map=\"auto\"` the attention layers would be equally distributed over all available GPUs.\n\nIn this guide, we will use [bigcode/octocoder](https://huggingface.co/bigcode/octocoder) as it can be run on a single 40 GB A100 GPU device chip. Note that all memory and speed optimizations that we will apply going forward, are equally applicable to models that require model or tensor parallelism.\n\nSince the model is loaded in bfloat16 precision, using our rule of thumb above, we would expect the memory requirement to run inference with `bigcode/octocoder` to be around 31 GB VRAM. Let's give it a try.\n\nWe first load the model and tokenizer and then pass both to Transformers' [pipeline](https://huggingface.co/docs/transformers/main_classes/pipelines) object.\n\n```python\nfrom transformers import AutoModelForCausalLM, AutoTokenizer, pipeline\nimport torch\n\nmodel = AutoModelForCausalLM.from_pretrained(\"bigcode/octocoder\", torch_dtype=torch.bfloat16, device_map=\"auto\", pad_token_id=0)\ntokenizer = AutoTokenizer.from_pretrained(\"bigcode/octocoder\")\n\npipe = pipeline(\"text-generation\", model=model, tokenizer=tokenizer)\n```\n\n```python\nprompt = \"Question: Please write a function in Python that transforms bytes to Giga bytes.\\n\\nAnswer:\"\n\nresult = pipe(prompt, max_new_tokens=60)[0][\"generated_text\"][len(prompt):]\nresult\n```\n\n**Output**:\n```\nHere is a Python function that transforms bytes to Giga bytes:\\n\\n```python\\ndef bytes_to_giga_bytes(bytes):\\n    return bytes / 1024 / 1024 / 1024\\n```\\n\\nThis function takes a single\n```\n\nNice, we can now directly use the result to convert bytes into Gigabytes.\n\n```python\ndef bytes_to_giga_bytes(bytes):\n  return bytes / 1024 / 1024 / 1024\n```\n\nLet's call [`torch.cuda.max_memory_allocated`](https://pytorch.org/docs/stable/generated/torch.cuda.max_memory_allocated.html) to measure the peak GPU memory allocation."}


created_at: 2024-08-26 20:30:03
topic: persistent://default/default/621deaf2-9359-4ac4-ada0-047176703e13
id: 63b4db71-af45-4fd1-97d3-ddcbef835ac5
encoding: FLOAT32
metadata:
{"url": "https://huggingface.co/docs/transformers/llm_tutorial_optimization", "title": "Optimizing LLMs for Speed and Memory", "tokens": 12767, "retrieve_doc": false, "source": "transformers", "_node_content": "{\"id_\": \"63b4db71-af45-4fd1-97d3-ddcbef835ac5\", \"embedding\": null, \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/llm_tutorial_optimization\", \"title\": \"Optimizing LLMs for Speed and Memory\", \"tokens\": 12767, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"3d4a5be0-96a4-4cae-bb80-ec65cee94a22\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/llm_tutorial_optimization\", \"title\": \"Optimizing LLMs for Speed and Memory\", \"tokens\": 12767, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"hash\": \"bb1f2b699b61342ca13b75611df36eb9e3379ec4485edf0807dfbeb683246cf4\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"e4af1050-bee8-4761-ab89-a3c7f598528c\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/llm_tutorial_optimization\", \"title\": \"Optimizing LLMs for Speed and Memory\", \"tokens\": 12767, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"hash\": \"4194f31cb28ee16c87609b4c3b86218cff423d8551c816443049ef8ed94726b2\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"48fbda2c-e4b7-49d2-be11-7d69427b7086\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"43e5700112c8da992cf7535e6b834d154270f07660268e9926241bcb0928af88\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 6791, \"end_char_idx\": 9901, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "3d4a5be0-96a4-4cae-bb80-ec65cee94a22", "doc_id": "3d4a5be0-96a4-4cae-bb80-ec65cee94a22", "ref_doc_id": "3d4a5be0-96a4-4cae-bb80-ec65cee94a22", "chroma:document": "Note that all memory and speed optimizations that we will apply going forward, are equally applicable to models that require model or tensor parallelism.\n\nSince the model is loaded in bfloat16 precision, using our rule of thumb above, we would expect the memory requirement to run inference with `bigcode/octocoder` to be around 31 GB VRAM. Let's give it a try.\n\nWe first load the model and tokenizer and then pass both to Transformers' [pipeline](https://huggingface.co/docs/transformers/main_classes/pipelines) object.\n\n```python\nfrom transformers import AutoModelForCausalLM, AutoTokenizer, pipeline\nimport torch\n\nmodel = AutoModelForCausalLM.from_pretrained(\"bigcode/octocoder\", torch_dtype=torch.bfloat16, device_map=\"auto\", pad_token_id=0)\ntokenizer = AutoTokenizer.from_pretrained(\"bigcode/octocoder\")\n\npipe = pipeline(\"text-generation\", model=model, tokenizer=tokenizer)\n```\n\n```python\nprompt = \"Question: Please write a function in Python that transforms bytes to Giga bytes.\\n\\nAnswer:\"\n\nresult = pipe(prompt, max_new_tokens=60)[0][\"generated_text\"][len(prompt):]\nresult\n```\n\n**Output**:\n```\nHere is a Python function that transforms bytes to Giga bytes:\\n\\n```python\\ndef bytes_to_giga_bytes(bytes):\\n    return bytes / 1024 / 1024 / 1024\\n```\\n\\nThis function takes a single\n```\n\nNice, we can now directly use the result to convert bytes into Gigabytes.\n\n```python\ndef bytes_to_giga_bytes(bytes):\n  return bytes / 1024 / 1024 / 1024\n```\n\nLet's call [`torch.cuda.max_memory_allocated`](https://pytorch.org/docs/stable/generated/torch.cuda.max_memory_allocated.html) to measure the peak GPU memory allocation.\n\n```python\nbytes_to_giga_bytes(torch.cuda.max_memory_allocated())\n```\n\n**Output**:\n```bash\n29.0260648727417\n```\n\nClose enough to our back-of-the-envelope computation! We can see the number is not exactly correct as going from bytes to kilobytes requires a multiplication of 1024 instead of 1000. Therefore the back-of-the-envelope formula can also be understood as an \"at most X GB\" computation.\nNote that if we had tried to run the model in full float32 precision, a whopping 64 GB of VRAM would have been required.\n\n> Almost all models are trained in bfloat16 nowadays, there is no reason to run the model in full float32 precision if [your GPU supports bfloat16](https://discuss.pytorch.org/t/bfloat16-native-support/117155/5). Float32 won't give better inference results than the precision that was used to train the model.\n\nIf you are unsure in which format the model weights are stored on the Hub, you can always look into the checkpoint's config under `\"torch_dtype\"`, *e.g.* [here](https://huggingface.co/meta-llama/Llama-2-7b-hf/blob/6fdf2e60f86ff2481f2241aaee459f85b5b0bbb9/config.json#L21). It is recommended to set the model to the same precision type as written in the config when loading with `from_pretrained(..., torch_dtype=...)` except when the original type is float32 in which case one can use both `float16` or `bfloat16` for inference.\n\n\nLet's define a `flush(...)` function to free all allocated memory so that we can accurately measure the peak allocated GPU memory."}


created_at: 2024-08-26 20:30:03
topic: persistent://default/default/621deaf2-9359-4ac4-ada0-047176703e13
id: 48fbda2c-e4b7-49d2-be11-7d69427b7086
encoding: FLOAT32
metadata:
{"url": "https://huggingface.co/docs/transformers/llm_tutorial_optimization", "title": "Optimizing LLMs for Speed and Memory", "tokens": 12767, "retrieve_doc": false, "source": "transformers", "_node_content": "{\"id_\": \"48fbda2c-e4b7-49d2-be11-7d69427b7086\", \"embedding\": null, \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/llm_tutorial_optimization\", \"title\": \"Optimizing LLMs for Speed and Memory\", \"tokens\": 12767, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"3d4a5be0-96a4-4cae-bb80-ec65cee94a22\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/llm_tutorial_optimization\", \"title\": \"Optimizing LLMs for Speed and Memory\", \"tokens\": 12767, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"hash\": \"bb1f2b699b61342ca13b75611df36eb9e3379ec4485edf0807dfbeb683246cf4\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"63b4db71-af45-4fd1-97d3-ddcbef835ac5\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/llm_tutorial_optimization\", \"title\": \"Optimizing LLMs for Speed and Memory\", \"tokens\": 12767, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"hash\": \"35bb99dc3ae88cc831d4a2a9758311c6b7f960a9c6f1fc36d4a7e33d79a218d7\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"670b0cf2-f9e5-4203-a400-0876d14f369b\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"a00581045b45484befbe08bca38772d4c8c0ca1d032bc477874c6ef0a12216d0\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 8412, \"end_char_idx\": 11493, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "3d4a5be0-96a4-4cae-bb80-ec65cee94a22", "doc_id": "3d4a5be0-96a4-4cae-bb80-ec65cee94a22", "ref_doc_id": "3d4a5be0-96a4-4cae-bb80-ec65cee94a22", "chroma:document": "```python\nbytes_to_giga_bytes(torch.cuda.max_memory_allocated())\n```\n\n**Output**:\n```bash\n29.0260648727417\n```\n\nClose enough to our back-of-the-envelope computation! We can see the number is not exactly correct as going from bytes to kilobytes requires a multiplication of 1024 instead of 1000. Therefore the back-of-the-envelope formula can also be understood as an \"at most X GB\" computation.\nNote that if we had tried to run the model in full float32 precision, a whopping 64 GB of VRAM would have been required.\n\n> Almost all models are trained in bfloat16 nowadays, there is no reason to run the model in full float32 precision if [your GPU supports bfloat16](https://discuss.pytorch.org/t/bfloat16-native-support/117155/5). Float32 won't give better inference results than the precision that was used to train the model.\n\nIf you are unsure in which format the model weights are stored on the Hub, you can always look into the checkpoint's config under `\"torch_dtype\"`, *e.g.* [here](https://huggingface.co/meta-llama/Llama-2-7b-hf/blob/6fdf2e60f86ff2481f2241aaee459f85b5b0bbb9/config.json#L21). It is recommended to set the model to the same precision type as written in the config when loading with `from_pretrained(..., torch_dtype=...)` except when the original type is float32 in which case one can use both `float16` or `bfloat16` for inference.\n\n\nLet's define a `flush(...)` function to free all allocated memory so that we can accurately measure the peak allocated GPU memory.\n\n```python\ndel pipe\ndel model\n\nimport gc\nimport torch\n\ndef flush():\n  gc.collect()\n  torch.cuda.empty_cache()\n  torch.cuda.reset_peak_memory_stats()\n```\n\nLet's call it now for the next experiment.\n\n```python\nflush()\n```\nIn the recent version of the accelerate library, you can also use a utility method called `release_memory()`\n\n```python\nfrom accelerate.utils import release_memory\n# ...\n\nrelease_memory(model)\n```\n\nNow what if your GPU does not have 32 GB of VRAM? It has been found that model weights can be quantized to 8-bit or 4-bits without a significant loss in performance (see [Dettmers et al.](https://arxiv.org/abs/2208.07339)).\nModel can be quantized to even 3 or 2 bits with an acceptable loss in performance as shown in the recent [GPTQ paper](https://arxiv.org/abs/2210.17323) \ud83e\udd2f.\n\nWithout going into too many details, quantization schemes aim at reducing the precision of weights while trying to keep the model's inference results as accurate as possible (*a.k.a* as close as possible to bfloat16).\nNote that quantization works especially well for text generation since all we care about is choosing the *set of most likely next tokens* and don't really care about the exact values of the next token *logit* distribution.\nAll that matters is that the next token *logit* distribution stays roughly the same so that an `argmax` or `topk` operation gives the same results.\n\nThere are various quantization techniques, which we won't discuss in detail here, but in general, all quantization techniques work as follows:\n\n-   1.  Quantize all weights to the target precision\n-   2."}


created_at: 2024-08-26 20:30:03
topic: persistent://default/default/621deaf2-9359-4ac4-ada0-047176703e13
id: 670b0cf2-f9e5-4203-a400-0876d14f369b
encoding: FLOAT32
metadata:
{"url": "https://huggingface.co/docs/transformers/llm_tutorial_optimization", "title": "Optimizing LLMs for Speed and Memory", "tokens": 12767, "retrieve_doc": false, "source": "transformers", "_node_content": "{\"id_\": \"670b0cf2-f9e5-4203-a400-0876d14f369b\", \"embedding\": null, \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/llm_tutorial_optimization\", \"title\": \"Optimizing LLMs for Speed and Memory\", \"tokens\": 12767, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"3d4a5be0-96a4-4cae-bb80-ec65cee94a22\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/llm_tutorial_optimization\", \"title\": \"Optimizing LLMs for Speed and Memory\", \"tokens\": 12767, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"hash\": \"bb1f2b699b61342ca13b75611df36eb9e3379ec4485edf0807dfbeb683246cf4\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"48fbda2c-e4b7-49d2-be11-7d69427b7086\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/llm_tutorial_optimization\", \"title\": \"Optimizing LLMs for Speed and Memory\", \"tokens\": 12767, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"hash\": \"9c9cddc3d0e15a0f081499f8383301c5672eae164622a6e1286b53b7ee4b0553\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"bfe74bf8-afab-4812-8bd4-93f44f9c5adf\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"d47e75e1347e6f704d3fa7fbec990d7cfadca43f436a05fe4534ed088a686baf\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 9903, \"end_char_idx\": 12742, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "3d4a5be0-96a4-4cae-bb80-ec65cee94a22", "doc_id": "3d4a5be0-96a4-4cae-bb80-ec65cee94a22", "ref_doc_id": "3d4a5be0-96a4-4cae-bb80-ec65cee94a22", "chroma:document": "```python\ndel pipe\ndel model\n\nimport gc\nimport torch\n\ndef flush():\n  gc.collect()\n  torch.cuda.empty_cache()\n  torch.cuda.reset_peak_memory_stats()\n```\n\nLet's call it now for the next experiment.\n\n```python\nflush()\n```\nIn the recent version of the accelerate library, you can also use a utility method called `release_memory()`\n\n```python\nfrom accelerate.utils import release_memory\n# ...\n\nrelease_memory(model)\n```\n\nNow what if your GPU does not have 32 GB of VRAM? It has been found that model weights can be quantized to 8-bit or 4-bits without a significant loss in performance (see [Dettmers et al.](https://arxiv.org/abs/2208.07339)).\nModel can be quantized to even 3 or 2 bits with an acceptable loss in performance as shown in the recent [GPTQ paper](https://arxiv.org/abs/2210.17323) \ud83e\udd2f.\n\nWithout going into too many details, quantization schemes aim at reducing the precision of weights while trying to keep the model's inference results as accurate as possible (*a.k.a* as close as possible to bfloat16).\nNote that quantization works especially well for text generation since all we care about is choosing the *set of most likely next tokens* and don't really care about the exact values of the next token *logit* distribution.\nAll that matters is that the next token *logit* distribution stays roughly the same so that an `argmax` or `topk` operation gives the same results.\n\nThere are various quantization techniques, which we won't discuss in detail here, but in general, all quantization techniques work as follows:\n\n-   1.  Quantize all weights to the target precision\n-   2.  Load the quantized weights, and pass the input sequence of vectors in bfloat16 precision\n-   3.  Dynamically dequantize weights to bfloat16 to perform the computation with their input vectors in bfloat16 precision\n\nIn a nutshell, this means that *inputs-weight matrix* multiplications, with \\\\( X \\\\) being the *inputs*, \\\\( W \\\\) being a weight matrix and \\\\( Y \\\\) being the output:\n\n$$ Y = X * W $$\n\nare changed to\n\n$$ Y = X * \\text{dequantize}(W) $$\n\nfor every matrix multiplication. Dequantization and re-quantization is performed sequentially for all weight matrices as the inputs run through the network graph.\n\nTherefore, inference time is often **not** reduced when using quantized weights, but rather increases.\nEnough theory, let's give it a try! To quantize the weights with Transformers, you need to make sure that\nthe [`bitsandbytes`](https://github.com/TimDettmers/bitsandbytes) library is installed.\n\n```bash\n!pip install bitsandbytes\n```\n\nWe can then load models in 8-bit quantization by simply adding a `load_in_8bit=True` flag to `from_pretrained`.\n\n```python\nmodel = AutoModelForCausalLM.from_pretrained(\"bigcode/octocoder\", load_in_8bit=True, pad_token_id=0)\n```\n\nNow, let's run our example again and measure the memory usage."}


created_at: 2024-08-26 20:30:03
topic: persistent://default/default/621deaf2-9359-4ac4-ada0-047176703e13
id: bfe74bf8-afab-4812-8bd4-93f44f9c5adf
encoding: FLOAT32
metadata:
{"url": "https://huggingface.co/docs/transformers/llm_tutorial_optimization", "title": "Optimizing LLMs for Speed and Memory", "tokens": 12767, "retrieve_doc": false, "source": "transformers", "_node_content": "{\"id_\": \"bfe74bf8-afab-4812-8bd4-93f44f9c5adf\", \"embedding\": null, \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/llm_tutorial_optimization\", \"title\": \"Optimizing LLMs for Speed and Memory\", \"tokens\": 12767, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"3d4a5be0-96a4-4cae-bb80-ec65cee94a22\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/llm_tutorial_optimization\", \"title\": \"Optimizing LLMs for Speed and Memory\", \"tokens\": 12767, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"hash\": \"bb1f2b699b61342ca13b75611df36eb9e3379ec4485edf0807dfbeb683246cf4\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"670b0cf2-f9e5-4203-a400-0876d14f369b\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/llm_tutorial_optimization\", \"title\": \"Optimizing LLMs for Speed and Memory\", \"tokens\": 12767, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"hash\": \"f0c796e46edb85f2c38d6577a68436d8056ff4063bdcee9274a1696beac27a3f\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"dcbdb020-1df7-4596-b9c6-1fdfc11f17e0\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"bb9222685e59f39a7662ae5f59923f59ca4c6175c8cf66bcbe0c912178ebdbea\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 11141, \"end_char_idx\": 13966, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "3d4a5be0-96a4-4cae-bb80-ec65cee94a22", "doc_id": "3d4a5be0-96a4-4cae-bb80-ec65cee94a22", "ref_doc_id": "3d4a5be0-96a4-4cae-bb80-ec65cee94a22", "chroma:document": "All that matters is that the next token *logit* distribution stays roughly the same so that an `argmax` or `topk` operation gives the same results.\n\nThere are various quantization techniques, which we won't discuss in detail here, but in general, all quantization techniques work as follows:\n\n-   1.  Quantize all weights to the target precision\n-   2.  Load the quantized weights, and pass the input sequence of vectors in bfloat16 precision\n-   3.  Dynamically dequantize weights to bfloat16 to perform the computation with their input vectors in bfloat16 precision\n\nIn a nutshell, this means that *inputs-weight matrix* multiplications, with \\\\( X \\\\) being the *inputs*, \\\\( W \\\\) being a weight matrix and \\\\( Y \\\\) being the output:\n\n$$ Y = X * W $$\n\nare changed to\n\n$$ Y = X * \\text{dequantize}(W) $$\n\nfor every matrix multiplication. Dequantization and re-quantization is performed sequentially for all weight matrices as the inputs run through the network graph.\n\nTherefore, inference time is often **not** reduced when using quantized weights, but rather increases.\nEnough theory, let's give it a try! To quantize the weights with Transformers, you need to make sure that\nthe [`bitsandbytes`](https://github.com/TimDettmers/bitsandbytes) library is installed.\n\n```bash\n!pip install bitsandbytes\n```\n\nWe can then load models in 8-bit quantization by simply adding a `load_in_8bit=True` flag to `from_pretrained`.\n\n```python\nmodel = AutoModelForCausalLM.from_pretrained(\"bigcode/octocoder\", load_in_8bit=True, pad_token_id=0)\n```\n\nNow, let's run our example again and measure the memory usage.\n\n```python\npipe = pipeline(\"text-generation\", model=model, tokenizer=tokenizer)\n\nresult = pipe(prompt, max_new_tokens=60)[0][\"generated_text\"][len(prompt):]\nresult\n```\n\n**Output**:\n```\nHere is a Python function that transforms bytes to Giga bytes:\\n\\n```python\\ndef bytes_to_giga_bytes(bytes):\\n    return bytes / 1024 / 1024 / 1024\\n```\\n\\nThis function takes a single\n```\n\nNice, we're getting the same result as before, so no loss in accuracy! Let's look at how much memory was used this time.\n\n```python\nbytes_to_giga_bytes(torch.cuda.max_memory_allocated())\n```\n\n**Output**:\n```\n15.219234466552734\n```\n\nSignificantly less! We're down to just a bit over 15 GBs and could therefore run this model on consumer GPUs like the 4090.\nWe're seeing a very nice gain in memory efficiency and more or less no degradation to the model's output. However, we can also notice a slight slow-down during inference.\n\n\nWe delete the models and flush the memory again.\n```python\ndel model\ndel pipe\n```\n\n```python\nflush()\n```\n\nLet's see what peak GPU memory consumption 4-bit quantization gives. Quantizing the model to 4-bit can be done with the same API as before - this time by passing `load_in_4bit=True` instead of `load_in_8bit=True`."}


created_at: 2024-08-26 20:30:03
topic: persistent://default/default/621deaf2-9359-4ac4-ada0-047176703e13
id: dcbdb020-1df7-4596-b9c6-1fdfc11f17e0
encoding: FLOAT32
metadata:
{"url": "https://huggingface.co/docs/transformers/llm_tutorial_optimization", "title": "Optimizing LLMs for Speed and Memory", "tokens": 12767, "retrieve_doc": false, "source": "transformers", "_node_content": "{\"id_\": \"dcbdb020-1df7-4596-b9c6-1fdfc11f17e0\", \"embedding\": null, \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/llm_tutorial_optimization\", \"title\": \"Optimizing LLMs for Speed and Memory\", \"tokens\": 12767, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"3d4a5be0-96a4-4cae-bb80-ec65cee94a22\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/llm_tutorial_optimization\", \"title\": \"Optimizing LLMs for Speed and Memory\", \"tokens\": 12767, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"hash\": \"bb1f2b699b61342ca13b75611df36eb9e3379ec4485edf0807dfbeb683246cf4\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"bfe74bf8-afab-4812-8bd4-93f44f9c5adf\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/llm_tutorial_optimization\", \"title\": \"Optimizing LLMs for Speed and Memory\", \"tokens\": 12767, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"hash\": \"aa8cd3be093046d3257fbfab84458a41573d1754dd9c01f708a8c3e29c21e395\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"34c71458-216c-4008-ba1a-b44ba8573d82\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"2bd5ee5757e14d9009141febf29deb688a2c282eda6159678f8c696d279cdcba\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 12564, \"end_char_idx\": 15302, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "3d4a5be0-96a4-4cae-bb80-ec65cee94a22", "doc_id": "3d4a5be0-96a4-4cae-bb80-ec65cee94a22", "ref_doc_id": "3d4a5be0-96a4-4cae-bb80-ec65cee94a22", "chroma:document": "```python\nmodel = AutoModelForCausalLM.from_pretrained(\"bigcode/octocoder\", load_in_8bit=True, pad_token_id=0)\n```\n\nNow, let's run our example again and measure the memory usage.\n\n```python\npipe = pipeline(\"text-generation\", model=model, tokenizer=tokenizer)\n\nresult = pipe(prompt, max_new_tokens=60)[0][\"generated_text\"][len(prompt):]\nresult\n```\n\n**Output**:\n```\nHere is a Python function that transforms bytes to Giga bytes:\\n\\n```python\\ndef bytes_to_giga_bytes(bytes):\\n    return bytes / 1024 / 1024 / 1024\\n```\\n\\nThis function takes a single\n```\n\nNice, we're getting the same result as before, so no loss in accuracy! Let's look at how much memory was used this time.\n\n```python\nbytes_to_giga_bytes(torch.cuda.max_memory_allocated())\n```\n\n**Output**:\n```\n15.219234466552734\n```\n\nSignificantly less! We're down to just a bit over 15 GBs and could therefore run this model on consumer GPUs like the 4090.\nWe're seeing a very nice gain in memory efficiency and more or less no degradation to the model's output. However, we can also notice a slight slow-down during inference.\n\n\nWe delete the models and flush the memory again.\n```python\ndel model\ndel pipe\n```\n\n```python\nflush()\n```\n\nLet's see what peak GPU memory consumption 4-bit quantization gives. Quantizing the model to 4-bit can be done with the same API as before - this time by passing `load_in_4bit=True` instead of `load_in_8bit=True`.\n\n```python\nmodel = AutoModelForCausalLM.from_pretrained(\"bigcode/octocoder\", load_in_4bit=True, low_cpu_mem_usage=True, pad_token_id=0)\n\npipe = pipeline(\"text-generation\", model=model, tokenizer=tokenizer)\n\nresult = pipe(prompt, max_new_tokens=60)[0][\"generated_text\"][len(prompt):]\nresult\n```\n\n**Output**:\n```\nHere is a Python function that transforms bytes to Giga bytes:\\n\\n```\\ndef bytes_to_gigabytes(bytes):\\n    return bytes / 1024 / 1024 / 1024\\n```\\n\\nThis function takes a single argument\n```\n\nWe're almost seeing the same output text as before - just the `python` is missing just before the code snippet. Let's see how much memory was required.\n\n```python\nbytes_to_giga_bytes(torch.cuda.max_memory_allocated())\n```\n\n**Output**:\n```\n9.543574333190918\n```\n\nJust 9.5GB! That's really not a lot for a >15 billion parameter model.\n\nWhile we see very little degradation in accuracy for our model here, 4-bit quantization can in practice often lead to different results compared to 8-bit quantization or full `bfloat16` inference. It is up to the user to try it out.\n\nAlso note that inference here was again a bit slower compared to 8-bit quantization which is due to the more aggressive quantization method used for 4-bit quantization leading to \\\\( \\text{quantize} \\\\) and \\\\( \\text{dequantize} \\\\) taking longer during inference."}


created_at: 2024-08-26 20:30:03
topic: persistent://default/default/621deaf2-9359-4ac4-ada0-047176703e13
id: 34c71458-216c-4008-ba1a-b44ba8573d82
encoding: FLOAT32
metadata:
{"url": "https://huggingface.co/docs/transformers/llm_tutorial_optimization", "title": "Optimizing LLMs for Speed and Memory", "tokens": 12767, "retrieve_doc": false, "source": "transformers", "_node_content": "{\"id_\": \"34c71458-216c-4008-ba1a-b44ba8573d82\", \"embedding\": null, \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/llm_tutorial_optimization\", \"title\": \"Optimizing LLMs for Speed and Memory\", \"tokens\": 12767, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"3d4a5be0-96a4-4cae-bb80-ec65cee94a22\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/llm_tutorial_optimization\", \"title\": \"Optimizing LLMs for Speed and Memory\", \"tokens\": 12767, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"hash\": \"bb1f2b699b61342ca13b75611df36eb9e3379ec4485edf0807dfbeb683246cf4\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"dcbdb020-1df7-4596-b9c6-1fdfc11f17e0\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/llm_tutorial_optimization\", \"title\": \"Optimizing LLMs for Speed and Memory\", \"tokens\": 12767, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"hash\": \"c5212e80043bf9a429e65b0354ba865733d9ecb61838d049bcfee67541c126c2\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"cacd0fe4-95f3-48ad-98e6-b0f1f6c6ab71\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"98304f94ad2869bf3228b38524be068ad7f14e0ca8a602f28ad77d8e601015bd\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 13822, \"end_char_idx\": 16979, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "3d4a5be0-96a4-4cae-bb80-ec65cee94a22", "doc_id": "3d4a5be0-96a4-4cae-bb80-ec65cee94a22", "ref_doc_id": "3d4a5be0-96a4-4cae-bb80-ec65cee94a22", "chroma:document": "Quantizing the model to 4-bit can be done with the same API as before - this time by passing `load_in_4bit=True` instead of `load_in_8bit=True`.\n\n```python\nmodel = AutoModelForCausalLM.from_pretrained(\"bigcode/octocoder\", load_in_4bit=True, low_cpu_mem_usage=True, pad_token_id=0)\n\npipe = pipeline(\"text-generation\", model=model, tokenizer=tokenizer)\n\nresult = pipe(prompt, max_new_tokens=60)[0][\"generated_text\"][len(prompt):]\nresult\n```\n\n**Output**:\n```\nHere is a Python function that transforms bytes to Giga bytes:\\n\\n```\\ndef bytes_to_gigabytes(bytes):\\n    return bytes / 1024 / 1024 / 1024\\n```\\n\\nThis function takes a single argument\n```\n\nWe're almost seeing the same output text as before - just the `python` is missing just before the code snippet. Let's see how much memory was required.\n\n```python\nbytes_to_giga_bytes(torch.cuda.max_memory_allocated())\n```\n\n**Output**:\n```\n9.543574333190918\n```\n\nJust 9.5GB! That's really not a lot for a >15 billion parameter model.\n\nWhile we see very little degradation in accuracy for our model here, 4-bit quantization can in practice often lead to different results compared to 8-bit quantization or full `bfloat16` inference. It is up to the user to try it out.\n\nAlso note that inference here was again a bit slower compared to 8-bit quantization which is due to the more aggressive quantization method used for 4-bit quantization leading to \\\\( \\text{quantize} \\\\) and \\\\( \\text{dequantize} \\\\) taking longer during inference.\n\n```python\ndel model\ndel pipe\n```\n```python\nflush()\n```\n\nOverall, we saw that running OctoCoder in 8-bit precision reduced the required GPU VRAM from 32G GPU VRAM to only 15GB and running the model in 4-bit precision further reduces the required GPU VRAM to just a bit over 9GB.\n\n4-bit quantization allows the model to be run on GPUs such as RTX3090, V100, and T4 which are quite accessible for most people.\n\nFor more information on quantization and to see how one can quantize models to require even less GPU VRAM memory than 4-bit, we recommend looking into the [`AutoGPTQ`](https://huggingface.co/docs/transformers/main/en/main_classes/quantization#autogptq-integration%60) implementation.\n\n> As a conclusion, it is important to remember that model quantization trades improved memory efficiency against accuracy and in some cases inference time.\n\nIf GPU memory is not a constraint for your use case, there is often no need to look into quantization. However many GPUs simply can't run LLMs without quantization methods and in this case, 4-bit and 8-bit quantization schemes are extremely useful tools.\n\nFor more in-detail usage information, we strongly recommend taking a look at the [Transformers Quantization Docs](https://huggingface.co/docs/transformers/main_classes/quantization#general-usage).\nNext, let's look into how we can improve computational and memory efficiency by using better algorithms and an improved model architecture.\n\n## 2. Flash Attention\n\nToday's top-performing LLMs share more or less the same fundamental architecture that consists of feed-forward layers, activation layers, layer normalization layers, and most crucially, self-attention layers."}


created_at: 2024-08-26 20:30:03
topic: persistent://default/default/621deaf2-9359-4ac4-ada0-047176703e13
id: cacd0fe4-95f3-48ad-98e6-b0f1f6c6ab71
encoding: FLOAT32
metadata:
{"url": "https://huggingface.co/docs/transformers/llm_tutorial_optimization", "title": "Optimizing LLMs for Speed and Memory", "tokens": 12767, "retrieve_doc": false, "source": "transformers", "_node_content": "{\"id_\": \"cacd0fe4-95f3-48ad-98e6-b0f1f6c6ab71\", \"embedding\": null, \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/llm_tutorial_optimization\", \"title\": \"Optimizing LLMs for Speed and Memory\", \"tokens\": 12767, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"3d4a5be0-96a4-4cae-bb80-ec65cee94a22\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/llm_tutorial_optimization\", \"title\": \"Optimizing LLMs for Speed and Memory\", \"tokens\": 12767, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"hash\": \"bb1f2b699b61342ca13b75611df36eb9e3379ec4485edf0807dfbeb683246cf4\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"34c71458-216c-4008-ba1a-b44ba8573d82\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/llm_tutorial_optimization\", \"title\": \"Optimizing LLMs for Speed and Memory\", \"tokens\": 12767, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"hash\": \"22264f169ad35254910c57ac855bb5cd23d205510c68d050670526b697139af4\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"44f679f5-557d-4203-ab68-02a6559a04a5\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"023f51058026d1f146a53e2218eef553bab246f4dd0130463d98121450872a77\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 15304, \"end_char_idx\": 18322, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "3d4a5be0-96a4-4cae-bb80-ec65cee94a22", "doc_id": "3d4a5be0-96a4-4cae-bb80-ec65cee94a22", "ref_doc_id": "3d4a5be0-96a4-4cae-bb80-ec65cee94a22", "chroma:document": "```python\ndel model\ndel pipe\n```\n```python\nflush()\n```\n\nOverall, we saw that running OctoCoder in 8-bit precision reduced the required GPU VRAM from 32G GPU VRAM to only 15GB and running the model in 4-bit precision further reduces the required GPU VRAM to just a bit over 9GB.\n\n4-bit quantization allows the model to be run on GPUs such as RTX3090, V100, and T4 which are quite accessible for most people.\n\nFor more information on quantization and to see how one can quantize models to require even less GPU VRAM memory than 4-bit, we recommend looking into the [`AutoGPTQ`](https://huggingface.co/docs/transformers/main/en/main_classes/quantization#autogptq-integration%60) implementation.\n\n> As a conclusion, it is important to remember that model quantization trades improved memory efficiency against accuracy and in some cases inference time.\n\nIf GPU memory is not a constraint for your use case, there is often no need to look into quantization. However many GPUs simply can't run LLMs without quantization methods and in this case, 4-bit and 8-bit quantization schemes are extremely useful tools.\n\nFor more in-detail usage information, we strongly recommend taking a look at the [Transformers Quantization Docs](https://huggingface.co/docs/transformers/main_classes/quantization#general-usage).\nNext, let's look into how we can improve computational and memory efficiency by using better algorithms and an improved model architecture.\n\n## 2. Flash Attention\n\nToday's top-performing LLMs share more or less the same fundamental architecture that consists of feed-forward layers, activation layers, layer normalization layers, and most crucially, self-attention layers.\n\nSelf-attention layers are central to Large Language Models (LLMs) in that they enable the model to understand the contextual relationships between input tokens.\nHowever, the peak GPU memory consumption for self-attention layers grows *quadratically* both in compute and memory complexity with number of input tokens (also called *sequence length*) that we denote in the following by \\\\( N \\\\) .\nWhile this is not really noticeable for shorter input sequences (of up to 1000 input tokens), it becomes a serious problem for longer input sequences (at around 16000 input tokens).\n\nLet's take a closer look. The formula to compute the output \\\\( \\mathbf{O} \\\\) of a self-attention layer for an input \\\\( \\mathbf{X} \\\\) of length \\\\( N \\\\) is:\n\n$$ \\textbf{O} = \\text{Attn}(\\mathbf{X}) = \\mathbf{V} \\times \\text{Softmax}(\\mathbf{QK}^T) \\text{ with } \\mathbf{Q} = \\mathbf{W}_q \\mathbf{X}, \\mathbf{V} = \\mathbf{W}_v \\mathbf{X}, \\mathbf{K} = \\mathbf{W}_k \\mathbf{X} $$\n\n\\\\(  \\mathbf{X} = (\\mathbf{x}_1, ... \\mathbf{x}_{N}) \\\\) is thereby the input sequence to the attention layer. The projections \\\\( \\mathbf{Q} \\\\) and \\\\( \\mathbf{K} \\\\) will each consist of \\\\( N \\\\) vectors resulting in the \\\\( \\mathbf{QK}^T \\\\) being of size \\\\( N^2 \\\\) .\n\nLLMs usually have multiple attention heads, thus doing multiple self-attention computations in parallel."}


created_at: 2024-08-26 20:30:03
topic: persistent://default/default/621deaf2-9359-4ac4-ada0-047176703e13
id: 44f679f5-557d-4203-ab68-02a6559a04a5
encoding: FLOAT32
metadata:
{"url": "https://huggingface.co/docs/transformers/llm_tutorial_optimization", "title": "Optimizing LLMs for Speed and Memory", "tokens": 12767, "retrieve_doc": false, "source": "transformers", "_node_content": "{\"id_\": \"44f679f5-557d-4203-ab68-02a6559a04a5\", \"embedding\": null, \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/llm_tutorial_optimization\", \"title\": \"Optimizing LLMs for Speed and Memory\", \"tokens\": 12767, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"3d4a5be0-96a4-4cae-bb80-ec65cee94a22\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/llm_tutorial_optimization\", \"title\": \"Optimizing LLMs for Speed and Memory\", \"tokens\": 12767, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"hash\": \"bb1f2b699b61342ca13b75611df36eb9e3379ec4485edf0807dfbeb683246cf4\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"cacd0fe4-95f3-48ad-98e6-b0f1f6c6ab71\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/llm_tutorial_optimization\", \"title\": \"Optimizing LLMs for Speed and Memory\", \"tokens\": 12767, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"hash\": \"895e88f176bc2c2ba17b91a376639974bd07efa22186ccddab5c419744cfa648\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"1c529f0a-781f-436d-9199-3f9cd24c1576\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"da13bc0ab8fec21fc3182e9f565ba4eac443cc461ee00d3688e877450f2e616c\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 16981, \"end_char_idx\": 19439, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "3d4a5be0-96a4-4cae-bb80-ec65cee94a22", "doc_id": "3d4a5be0-96a4-4cae-bb80-ec65cee94a22", "ref_doc_id": "3d4a5be0-96a4-4cae-bb80-ec65cee94a22", "chroma:document": "Self-attention layers are central to Large Language Models (LLMs) in that they enable the model to understand the contextual relationships between input tokens.\nHowever, the peak GPU memory consumption for self-attention layers grows *quadratically* both in compute and memory complexity with number of input tokens (also called *sequence length*) that we denote in the following by \\\\( N \\\\) .\nWhile this is not really noticeable for shorter input sequences (of up to 1000 input tokens), it becomes a serious problem for longer input sequences (at around 16000 input tokens).\n\nLet's take a closer look. The formula to compute the output \\\\( \\mathbf{O} \\\\) of a self-attention layer for an input \\\\( \\mathbf{X} \\\\) of length \\\\( N \\\\) is:\n\n$$ \\textbf{O} = \\text{Attn}(\\mathbf{X}) = \\mathbf{V} \\times \\text{Softmax}(\\mathbf{QK}^T) \\text{ with } \\mathbf{Q} = \\mathbf{W}_q \\mathbf{X}, \\mathbf{V} = \\mathbf{W}_v \\mathbf{X}, \\mathbf{K} = \\mathbf{W}_k \\mathbf{X} $$\n\n\\\\(  \\mathbf{X} = (\\mathbf{x}_1, ... \\mathbf{x}_{N}) \\\\) is thereby the input sequence to the attention layer. The projections \\\\( \\mathbf{Q} \\\\) and \\\\( \\mathbf{K} \\\\) will each consist of \\\\( N \\\\) vectors resulting in the \\\\( \\mathbf{QK}^T \\\\) being of size \\\\( N^2 \\\\) .\n\nLLMs usually have multiple attention heads, thus doing multiple self-attention computations in parallel.\nAssuming, the LLM has 40 attention heads and runs in bfloat16 precision, we can calculate the memory requirement to store the \\\\( \\mathbf{QK^T} \\\\) matrices to be \\\\( 40 * 2 * N^2 \\\\) bytes. For \\\\( N=1000 \\\\) only around 50 MB of VRAM are needed, however, for \\\\( N=16000 \\\\) we would need 19 GB of VRAM, and for \\\\( N=100,000 \\\\) we would need almost 1TB just to store the \\\\( \\mathbf{QK}^T \\\\) matrices.\n\nLong story short, the default self-attention algorithm quickly becomes prohibitively memory-expensive for large input contexts.\n\nAs LLMs improve in text comprehension and generation, they are applied to increasingly complex tasks. While models once handled the translation or summarization of a few sentences, they now manage entire pages, demanding the capability to process extensive input lengths.\n\nHow can we get rid of the exorbitant memory requirements for large input lengths? We need a new way to compute the self-attention mechanism that gets rid of the \\\\( QK^T \\\\) matrix. [Tri Dao et al.](https://arxiv.org/abs/2205.14135) developed exactly such a new algorithm and called it **Flash Attention**."}


created_at: 2024-08-26 20:30:03
topic: persistent://default/default/621deaf2-9359-4ac4-ada0-047176703e13
id: 1c529f0a-781f-436d-9199-3f9cd24c1576
encoding: FLOAT32
metadata:
{"url": "https://huggingface.co/docs/transformers/llm_tutorial_optimization", "title": "Optimizing LLMs for Speed and Memory", "tokens": 12767, "retrieve_doc": false, "source": "transformers", "_node_content": "{\"id_\": \"1c529f0a-781f-436d-9199-3f9cd24c1576\", \"embedding\": null, \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/llm_tutorial_optimization\", \"title\": \"Optimizing LLMs for Speed and Memory\", \"tokens\": 12767, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"3d4a5be0-96a4-4cae-bb80-ec65cee94a22\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/llm_tutorial_optimization\", \"title\": \"Optimizing LLMs for Speed and Memory\", \"tokens\": 12767, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"hash\": \"bb1f2b699b61342ca13b75611df36eb9e3379ec4485edf0807dfbeb683246cf4\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"44f679f5-557d-4203-ab68-02a6559a04a5\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/llm_tutorial_optimization\", \"title\": \"Optimizing LLMs for Speed and Memory\", \"tokens\": 12767, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"hash\": \"f19f4f6cd670f843a2b1174af47de89fbcb980425e74b79ba49cc58b79f514be\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"759094c4-a051-4136-8639-35850ed14617\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"60d9ca93c754891cb6388c141a3d9001b9f04f822dabc8d8bb6f27db750c8ba3\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 18053, \"end_char_idx\": 20731, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "3d4a5be0-96a4-4cae-bb80-ec65cee94a22", "doc_id": "3d4a5be0-96a4-4cae-bb80-ec65cee94a22", "ref_doc_id": "3d4a5be0-96a4-4cae-bb80-ec65cee94a22", "chroma:document": "The projections \\\\( \\mathbf{Q} \\\\) and \\\\( \\mathbf{K} \\\\) will each consist of \\\\( N \\\\) vectors resulting in the \\\\( \\mathbf{QK}^T \\\\) being of size \\\\( N^2 \\\\) .\n\nLLMs usually have multiple attention heads, thus doing multiple self-attention computations in parallel.\nAssuming, the LLM has 40 attention heads and runs in bfloat16 precision, we can calculate the memory requirement to store the \\\\( \\mathbf{QK^T} \\\\) matrices to be \\\\( 40 * 2 * N^2 \\\\) bytes. For \\\\( N=1000 \\\\) only around 50 MB of VRAM are needed, however, for \\\\( N=16000 \\\\) we would need 19 GB of VRAM, and for \\\\( N=100,000 \\\\) we would need almost 1TB just to store the \\\\( \\mathbf{QK}^T \\\\) matrices.\n\nLong story short, the default self-attention algorithm quickly becomes prohibitively memory-expensive for large input contexts.\n\nAs LLMs improve in text comprehension and generation, they are applied to increasingly complex tasks. While models once handled the translation or summarization of a few sentences, they now manage entire pages, demanding the capability to process extensive input lengths.\n\nHow can we get rid of the exorbitant memory requirements for large input lengths? We need a new way to compute the self-attention mechanism that gets rid of the \\\\( QK^T \\\\) matrix. [Tri Dao et al.](https://arxiv.org/abs/2205.14135) developed exactly such a new algorithm and called it **Flash Attention**.\n\nIn a nutshell, Flash Attention breaks the  \\\\(\\mathbf{V} \\times \\text{Softmax}(\\mathbf{QK}^T\\\\)) computation apart and instead computes smaller chunks of the output by iterating over multiple softmax computation steps:\n\n$$ \\textbf{O}_i \\leftarrow s^a_{ij} * \\textbf{O}_i + s^b_{ij} * \\mathbf{V}_{j} \\times \\text{Softmax}(\\mathbf{QK}^T_{i,j}) \\text{ for multiple } i, j \\text{ iterations} $$\n\nwith \\\\( s^a_{ij} \\\\) and \\\\( s^b_{ij} \\\\) being some softmax normalization statistics that need to be recomputed for every \\\\( i \\\\) and \\\\( j \\\\) .\n\nPlease note that the whole Flash Attention is a bit more complex and is greatly simplified here as going in too much depth is out of scope for this guide. The reader is invited to take a look at the well-written [Flash Attention paper](https://arxiv.org/abs/2205.14135) for more details.\n\nThe main takeaway here is:\n\n> By keeping track of softmax normalization statistics and by using some smart mathematics, Flash Attention gives **numerical identical** outputs compared to the default self-attention layer at a memory cost that only increases linearly with \\\\( N \\\\) .\n\nLooking at the formula, one would intuitively say that Flash Attention must be much slower compared to the default self-attention formula as more computation needs to be done."}


created_at: 2024-08-26 20:30:03
topic: persistent://default/default/621deaf2-9359-4ac4-ada0-047176703e13
id: 759094c4-a051-4136-8639-35850ed14617
encoding: FLOAT32
metadata:
{"url": "https://huggingface.co/docs/transformers/llm_tutorial_optimization", "title": "Optimizing LLMs for Speed and Memory", "tokens": 12767, "retrieve_doc": false, "source": "transformers", "_node_content": "{\"id_\": \"759094c4-a051-4136-8639-35850ed14617\", \"embedding\": null, \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/llm_tutorial_optimization\", \"title\": \"Optimizing LLMs for Speed and Memory\", \"tokens\": 12767, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"3d4a5be0-96a4-4cae-bb80-ec65cee94a22\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/llm_tutorial_optimization\", \"title\": \"Optimizing LLMs for Speed and Memory\", \"tokens\": 12767, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"hash\": \"bb1f2b699b61342ca13b75611df36eb9e3379ec4485edf0807dfbeb683246cf4\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"1c529f0a-781f-436d-9199-3f9cd24c1576\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/llm_tutorial_optimization\", \"title\": \"Optimizing LLMs for Speed and Memory\", \"tokens\": 12767, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"hash\": \"a4d5c9b165609075480926898cc436827b420c25abe52ac72fffc7b88e979314\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"0c197c04-e552-4f3a-98a7-692a030fab82\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"bee6b6b65bed6cfa10cf27d5134d37246194f246e884428eb00cd4bd5581cd03\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 19215, \"end_char_idx\": 22592, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "3d4a5be0-96a4-4cae-bb80-ec65cee94a22", "doc_id": "3d4a5be0-96a4-4cae-bb80-ec65cee94a22", "ref_doc_id": "3d4a5be0-96a4-4cae-bb80-ec65cee94a22", "chroma:document": "We need a new way to compute the self-attention mechanism that gets rid of the \\\\( QK^T \\\\) matrix. [Tri Dao et al.](https://arxiv.org/abs/2205.14135) developed exactly such a new algorithm and called it **Flash Attention**.\n\nIn a nutshell, Flash Attention breaks the  \\\\(\\mathbf{V} \\times \\text{Softmax}(\\mathbf{QK}^T\\\\)) computation apart and instead computes smaller chunks of the output by iterating over multiple softmax computation steps:\n\n$$ \\textbf{O}_i \\leftarrow s^a_{ij} * \\textbf{O}_i + s^b_{ij} * \\mathbf{V}_{j} \\times \\text{Softmax}(\\mathbf{QK}^T_{i,j}) \\text{ for multiple } i, j \\text{ iterations} $$\n\nwith \\\\( s^a_{ij} \\\\) and \\\\( s^b_{ij} \\\\) being some softmax normalization statistics that need to be recomputed for every \\\\( i \\\\) and \\\\( j \\\\) .\n\nPlease note that the whole Flash Attention is a bit more complex and is greatly simplified here as going in too much depth is out of scope for this guide. The reader is invited to take a look at the well-written [Flash Attention paper](https://arxiv.org/abs/2205.14135) for more details.\n\nThe main takeaway here is:\n\n> By keeping track of softmax normalization statistics and by using some smart mathematics, Flash Attention gives **numerical identical** outputs compared to the default self-attention layer at a memory cost that only increases linearly with \\\\( N \\\\) .\n\nLooking at the formula, one would intuitively say that Flash Attention must be much slower compared to the default self-attention formula as more computation needs to be done. Indeed Flash Attention requires more FLOPs compared to normal attention as the softmax normalization statistics have to constantly be recomputed (see [paper](https://arxiv.org/abs/2205.14135) for more details if interested)\n\n> However, Flash Attention is much faster in inference compared to default attention which comes from its ability to significantly reduce the demands on the slower, high-bandwidth memory of the GPU (VRAM), focusing instead on the faster on-chip memory (SRAM).\n\nEssentially, Flash Attention makes sure that all intermediate write and read operations can be done using the fast *on-chip* SRAM memory instead of having to access the slower VRAM memory to compute the output vector \\\\( \\mathbf{O} \\\\) .\n\nIn practice, there is currently absolutely no reason to **not** use Flash Attention if available. The algorithm gives mathematically the same outputs, and is both faster and more memory-efficient.\n\nLet's look at a practical example.\n\nOur OctoCoder model now gets a significantly longer input prompt which includes a so-called *system prompt*. System prompts are used to steer the LLM into a better assistant that is tailored to the users' task.\nIn the following, we use a system prompt that will make OctoCoder a better coding assistant.\n\n```python\nsystem_prompt = \"\"\"Below are a series of dialogues between various people and an AI technical assistant.\nThe assistant tries to be helpful, polite, honest, sophisticated, emotionally aware, and humble but knowledgeable.\nThe assistant is happy to help with code questions and will do their best to understand exactly what is needed.\nIt also tries to avoid giving false or misleading information, and it caveats when it isn't entirely sure about the right answer.\nThat said, the assistant is practical really does its best, and doesn't let caution get too much in the way of being useful."}


created_at: 2024-08-26 20:30:03
topic: persistent://default/default/621deaf2-9359-4ac4-ada0-047176703e13
id: 0c197c04-e552-4f3a-98a7-692a030fab82
encoding: FLOAT32
metadata:
{"url": "https://huggingface.co/docs/transformers/llm_tutorial_optimization", "title": "Optimizing LLMs for Speed and Memory", "tokens": 12767, "retrieve_doc": false, "source": "transformers", "_node_content": "{\"id_\": \"0c197c04-e552-4f3a-98a7-692a030fab82\", \"embedding\": null, \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/llm_tutorial_optimization\", \"title\": \"Optimizing LLMs for Speed and Memory\", \"tokens\": 12767, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"3d4a5be0-96a4-4cae-bb80-ec65cee94a22\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/llm_tutorial_optimization\", \"title\": \"Optimizing LLMs for Speed and Memory\", \"tokens\": 12767, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"hash\": \"bb1f2b699b61342ca13b75611df36eb9e3379ec4485edf0807dfbeb683246cf4\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"759094c4-a051-4136-8639-35850ed14617\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/llm_tutorial_optimization\", \"title\": \"Optimizing LLMs for Speed and Memory\", \"tokens\": 12767, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"hash\": \"539beb3591c95a9ffd59e66f3fe28a79fcfd35e235da0ca0c4b8034aa3925af2\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"a92e8777-bcd9-45ff-ac19-49360bca21b4\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"ec6de3ec1a73968158524336b615c00b29a5022500cefa565d80500b76674616\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 20732, \"end_char_idx\": 24177, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "3d4a5be0-96a4-4cae-bb80-ec65cee94a22", "doc_id": "3d4a5be0-96a4-4cae-bb80-ec65cee94a22", "ref_doc_id": "3d4a5be0-96a4-4cae-bb80-ec65cee94a22", "chroma:document": "Indeed Flash Attention requires more FLOPs compared to normal attention as the softmax normalization statistics have to constantly be recomputed (see [paper](https://arxiv.org/abs/2205.14135) for more details if interested)\n\n> However, Flash Attention is much faster in inference compared to default attention which comes from its ability to significantly reduce the demands on the slower, high-bandwidth memory of the GPU (VRAM), focusing instead on the faster on-chip memory (SRAM).\n\nEssentially, Flash Attention makes sure that all intermediate write and read operations can be done using the fast *on-chip* SRAM memory instead of having to access the slower VRAM memory to compute the output vector \\\\( \\mathbf{O} \\\\) .\n\nIn practice, there is currently absolutely no reason to **not** use Flash Attention if available. The algorithm gives mathematically the same outputs, and is both faster and more memory-efficient.\n\nLet's look at a practical example.\n\nOur OctoCoder model now gets a significantly longer input prompt which includes a so-called *system prompt*. System prompts are used to steer the LLM into a better assistant that is tailored to the users' task.\nIn the following, we use a system prompt that will make OctoCoder a better coding assistant.\n\n```python\nsystem_prompt = \"\"\"Below are a series of dialogues between various people and an AI technical assistant.\nThe assistant tries to be helpful, polite, honest, sophisticated, emotionally aware, and humble but knowledgeable.\nThe assistant is happy to help with code questions and will do their best to understand exactly what is needed.\nIt also tries to avoid giving false or misleading information, and it caveats when it isn't entirely sure about the right answer.\nThat said, the assistant is practical really does its best, and doesn't let caution get too much in the way of being useful.\n\nThe Starcoder models are a series of 15.5B parameter models trained on 80+ programming languages from The Stack (v1.2) (excluding opt-out requests).\nThe model uses Multi Query Attention, was trained using the Fill-in-the-Middle objective, and with 8,192 tokens context window for a trillion tokens of heavily deduplicated data.\n\n-----\n\nQuestion: Write a function that takes two lists and returns a list that has alternating elements from each input list.\n\nAnswer: Sure. Here is a function that does that.\n\ndef alternating(list1, list2):\n   results = []\n   for i in range(len(list1)):\n       results.append(list1[i])\n       results.append(list2[i])\n   return results\n\nQuestion: Can you write some test cases for this function?\n\nAnswer: Sure, here are some tests.\n\nassert alternating([10, 20, 30], [1, 2, 3]) == [10, 1, 20, 2, 30, 3]\nassert alternating([True, False], [4, 5]) == [True, 4, False, 5]\nassert alternating([], []) == []\n\nQuestion: Modify the function so that it returns all input elements when the lists have uneven length. The elements from the longer list should be at the end.\n\nAnswer: Here is the modified function.\n\ndef alternating(list1, list2):\n   results = []\n   for i in range(min(len(list1), len(list2))):\n       results.append(list1[i])\n       results.append(list2[i])\n   if len(list1) > len(list2):\n       results.extend(list1[i+1:])\n   else:\n       results.extend(list2[i+1:])\n   return results\n\n-----\n\"\"\"\n```\nFor demonstration purposes, we duplicate the system prompt by ten so that the input length is long enough to observe Flash Attention's memory savings."}


created_at: 2024-08-26 20:30:03
topic: persistent://default/default/621deaf2-9359-4ac4-ada0-047176703e13
id: a92e8777-bcd9-45ff-ac19-49360bca21b4
encoding: FLOAT32
metadata:
{"url": "https://huggingface.co/docs/transformers/llm_tutorial_optimization", "title": "Optimizing LLMs for Speed and Memory", "tokens": 12767, "retrieve_doc": false, "source": "transformers", "_node_content": "{\"id_\": \"a92e8777-bcd9-45ff-ac19-49360bca21b4\", \"embedding\": null, \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/llm_tutorial_optimization\", \"title\": \"Optimizing LLMs for Speed and Memory\", \"tokens\": 12767, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"3d4a5be0-96a4-4cae-bb80-ec65cee94a22\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/llm_tutorial_optimization\", \"title\": \"Optimizing LLMs for Speed and Memory\", \"tokens\": 12767, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"hash\": \"bb1f2b699b61342ca13b75611df36eb9e3379ec4485edf0807dfbeb683246cf4\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"0c197c04-e552-4f3a-98a7-692a030fab82\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/llm_tutorial_optimization\", \"title\": \"Optimizing LLMs for Speed and Memory\", \"tokens\": 12767, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"hash\": \"56dcc3a11332a9bb16f33c53d76ee1a3be87b1ee0e070dcbe12b8928917d6602\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"1dfe62c1-9482-4ae1-9612-be8aeb08402f\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"81edcc7eb0791a113b33f41742762d92cfdabb0372dad5da735ab96b7ee72a8d\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 22594, \"end_char_idx\": 25689, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "3d4a5be0-96a4-4cae-bb80-ec65cee94a22", "doc_id": "3d4a5be0-96a4-4cae-bb80-ec65cee94a22", "ref_doc_id": "3d4a5be0-96a4-4cae-bb80-ec65cee94a22", "chroma:document": "The Starcoder models are a series of 15.5B parameter models trained on 80+ programming languages from The Stack (v1.2) (excluding opt-out requests).\nThe model uses Multi Query Attention, was trained using the Fill-in-the-Middle objective, and with 8,192 tokens context window for a trillion tokens of heavily deduplicated data.\n\n-----\n\nQuestion: Write a function that takes two lists and returns a list that has alternating elements from each input list.\n\nAnswer: Sure. Here is a function that does that.\n\ndef alternating(list1, list2):\n   results = []\n   for i in range(len(list1)):\n       results.append(list1[i])\n       results.append(list2[i])\n   return results\n\nQuestion: Can you write some test cases for this function?\n\nAnswer: Sure, here are some tests.\n\nassert alternating([10, 20, 30], [1, 2, 3]) == [10, 1, 20, 2, 30, 3]\nassert alternating([True, False], [4, 5]) == [True, 4, False, 5]\nassert alternating([], []) == []\n\nQuestion: Modify the function so that it returns all input elements when the lists have uneven length. The elements from the longer list should be at the end.\n\nAnswer: Here is the modified function.\n\ndef alternating(list1, list2):\n   results = []\n   for i in range(min(len(list1), len(list2))):\n       results.append(list1[i])\n       results.append(list2[i])\n   if len(list1) > len(list2):\n       results.extend(list1[i+1:])\n   else:\n       results.extend(list2[i+1:])\n   return results\n\n-----\n\"\"\"\n```\nFor demonstration purposes, we duplicate the system prompt by ten so that the input length is long enough to observe Flash Attention's memory savings.\nWe append the original text prompt `\"Question: Please write a function in Python that transforms bytes to Giga bytes.\\n\\nAnswer: Here\"`\n\n```python\nlong_prompt = 10 * system_prompt + prompt\n```\n\nWe instantiate our model again in bfloat16 precision.\n\n```python\nmodel = AutoModelForCausalLM.from_pretrained(\"bigcode/octocoder\", torch_dtype=torch.bfloat16, device_map=\"auto\")\ntokenizer = AutoTokenizer.from_pretrained(\"bigcode/octocoder\")\n\npipe = pipeline(\"text-generation\", model=model, tokenizer=tokenizer)\n```\n\nLet's now run the model just like before *without Flash Attention* and measure the peak GPU memory requirement and inference time.\n\n```python\nimport time\n\nstart_time = time.time()\nresult = pipe(long_prompt, max_new_tokens=60)[0][\"generated_text\"][len(long_prompt):]\n\nprint(f\"Generated in {time.time() - start_time} seconds.\")\nresult\n```\n\n**Output**:\n```\nGenerated in 10.96854019165039 seconds.\nSure. Here is a function that does that.\\n\\ndef bytes_to_giga(bytes):\\n   return bytes / 1024 / 1024 / 1024\\n\\nAnswer: Sure. Here is a function that does that.\\n\\ndef\n````\n\nWe're getting the same output as before, however this time, the model repeats the answer multiple times until it's 60 tokens cut-off. This is not surprising as we've repeated the system prompt ten times for demonstration purposes and thus cued the model to repeat itself.\n\n**Note** that the system prompt should not be repeated ten times in real-world applications - one time is enough!\n\nLet's measure the peak GPU memory requirement."}


created_at: 2024-08-26 20:30:03
topic: persistent://default/default/621deaf2-9359-4ac4-ada0-047176703e13
id: 1dfe62c1-9482-4ae1-9612-be8aeb08402f
encoding: FLOAT32
metadata:
{"url": "https://huggingface.co/docs/transformers/llm_tutorial_optimization", "title": "Optimizing LLMs for Speed and Memory", "tokens": 12767, "retrieve_doc": false, "source": "transformers", "_node_content": "{\"id_\": \"1dfe62c1-9482-4ae1-9612-be8aeb08402f\", \"embedding\": null, \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/llm_tutorial_optimization\", \"title\": \"Optimizing LLMs for Speed and Memory\", \"tokens\": 12767, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"3d4a5be0-96a4-4cae-bb80-ec65cee94a22\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/llm_tutorial_optimization\", \"title\": \"Optimizing LLMs for Speed and Memory\", \"tokens\": 12767, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"hash\": \"bb1f2b699b61342ca13b75611df36eb9e3379ec4485edf0807dfbeb683246cf4\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"a92e8777-bcd9-45ff-ac19-49360bca21b4\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/llm_tutorial_optimization\", \"title\": \"Optimizing LLMs for Speed and Memory\", \"tokens\": 12767, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"hash\": \"e2dc162f6c3175b6bbbea27979c64ac239b9d255c65e1609f8f63686d9e82cff\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"47937dea-7a4b-4dd2-b291-35bcee6a12a6\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"ae05df733e7b8251b12aca7853fb9d1b226908defa724bcdf9b88e95dcd21560\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 24178, \"end_char_idx\": 27345, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "3d4a5be0-96a4-4cae-bb80-ec65cee94a22", "doc_id": "3d4a5be0-96a4-4cae-bb80-ec65cee94a22", "ref_doc_id": "3d4a5be0-96a4-4cae-bb80-ec65cee94a22", "chroma:document": "We append the original text prompt `\"Question: Please write a function in Python that transforms bytes to Giga bytes.\\n\\nAnswer: Here\"`\n\n```python\nlong_prompt = 10 * system_prompt + prompt\n```\n\nWe instantiate our model again in bfloat16 precision.\n\n```python\nmodel = AutoModelForCausalLM.from_pretrained(\"bigcode/octocoder\", torch_dtype=torch.bfloat16, device_map=\"auto\")\ntokenizer = AutoTokenizer.from_pretrained(\"bigcode/octocoder\")\n\npipe = pipeline(\"text-generation\", model=model, tokenizer=tokenizer)\n```\n\nLet's now run the model just like before *without Flash Attention* and measure the peak GPU memory requirement and inference time.\n\n```python\nimport time\n\nstart_time = time.time()\nresult = pipe(long_prompt, max_new_tokens=60)[0][\"generated_text\"][len(long_prompt):]\n\nprint(f\"Generated in {time.time() - start_time} seconds.\")\nresult\n```\n\n**Output**:\n```\nGenerated in 10.96854019165039 seconds.\nSure. Here is a function that does that.\\n\\ndef bytes_to_giga(bytes):\\n   return bytes / 1024 / 1024 / 1024\\n\\nAnswer: Sure. Here is a function that does that.\\n\\ndef\n````\n\nWe're getting the same output as before, however this time, the model repeats the answer multiple times until it's 60 tokens cut-off. This is not surprising as we've repeated the system prompt ten times for demonstration purposes and thus cued the model to repeat itself.\n\n**Note** that the system prompt should not be repeated ten times in real-world applications - one time is enough!\n\nLet's measure the peak GPU memory requirement.\n\n```python\nbytes_to_giga_bytes(torch.cuda.max_memory_allocated())\n```\n\n**Output**:\n```bash\n37.668193340301514\n```\n\nAs we can see the peak GPU memory requirement is now significantly higher than in the beginning, which is largely due to the longer input sequence. Also the generation takes a little over a minute now.\n\nWe call `flush()` to free GPU memory for our next experiment.\n\n```python\nflush()\n```\n\nFor comparison, let's run the same function, but enable Flash Attention instead.\nTo do so, we convert the model to [BetterTransformer](https://huggingface.co/docs/optimum/bettertransformer/overview) and by doing so enabling PyTorch's [SDPA self-attention](https://pytorch.org/docs/master/generated/torch.nn.functional.scaled_dot_product_attention) which in turn is able to use Flash Attention.\n\n```python\nmodel.to_bettertransformer()\n```\n\nNow we run the exact same code snippet as before and under the hood Transformers will make use of Flash Attention.\n\n```py\nstart_time = time.time()\nwith torch.backends.cuda.sdp_kernel(enable_flash=True, enable_math=False, enable_mem_efficient=False):\n    result = pipe(long_prompt, max_new_tokens=60)[0][\"generated_text\"][len(long_prompt):]\n\nprint(f\"Generated in {time.time() - start_time} seconds.\")\nresult\n```\n\n**Output**:\n```\nGenerated in 3.0211617946624756 seconds.\n Sure. Here is a function that does that.\\n\\ndef bytes_to_giga(bytes):\\n   return bytes / 1024 / 1024 / 1024\\n\\nAnswer: Sure. Here is a function that does that.\\n\\ndef\n```\n\nWe're getting the exact same result as before, but can observe a very significant speed-up thanks to Flash Attention.\n\nLet's measure the memory consumption one last time."}


created_at: 2024-08-26 20:30:03
topic: persistent://default/default/621deaf2-9359-4ac4-ada0-047176703e13
id: 47937dea-7a4b-4dd2-b291-35bcee6a12a6
encoding: FLOAT32
metadata:
{"url": "https://huggingface.co/docs/transformers/llm_tutorial_optimization", "title": "Optimizing LLMs for Speed and Memory", "tokens": 12767, "retrieve_doc": false, "source": "transformers", "_node_content": "{\"id_\": \"47937dea-7a4b-4dd2-b291-35bcee6a12a6\", \"embedding\": null, \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/llm_tutorial_optimization\", \"title\": \"Optimizing LLMs for Speed and Memory\", \"tokens\": 12767, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"3d4a5be0-96a4-4cae-bb80-ec65cee94a22\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/llm_tutorial_optimization\", \"title\": \"Optimizing LLMs for Speed and Memory\", \"tokens\": 12767, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"hash\": \"bb1f2b699b61342ca13b75611df36eb9e3379ec4485edf0807dfbeb683246cf4\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"1dfe62c1-9482-4ae1-9612-be8aeb08402f\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/llm_tutorial_optimization\", \"title\": \"Optimizing LLMs for Speed and Memory\", \"tokens\": 12767, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"hash\": \"516dcb65e982cb09387d7fec9e080d13c16955a625b857c20fe5dbdbcbe0943c\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"da94834b-58a3-4012-9e3c-4c0bc27a124b\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"b174175882ca439a6bb2ab7a212e4785ef187849050afcede8f6e684397ef1f9\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 25691, \"end_char_idx\": 28965, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "3d4a5be0-96a4-4cae-bb80-ec65cee94a22", "doc_id": "3d4a5be0-96a4-4cae-bb80-ec65cee94a22", "ref_doc_id": "3d4a5be0-96a4-4cae-bb80-ec65cee94a22", "chroma:document": "```python\nbytes_to_giga_bytes(torch.cuda.max_memory_allocated())\n```\n\n**Output**:\n```bash\n37.668193340301514\n```\n\nAs we can see the peak GPU memory requirement is now significantly higher than in the beginning, which is largely due to the longer input sequence. Also the generation takes a little over a minute now.\n\nWe call `flush()` to free GPU memory for our next experiment.\n\n```python\nflush()\n```\n\nFor comparison, let's run the same function, but enable Flash Attention instead.\nTo do so, we convert the model to [BetterTransformer](https://huggingface.co/docs/optimum/bettertransformer/overview) and by doing so enabling PyTorch's [SDPA self-attention](https://pytorch.org/docs/master/generated/torch.nn.functional.scaled_dot_product_attention) which in turn is able to use Flash Attention.\n\n```python\nmodel.to_bettertransformer()\n```\n\nNow we run the exact same code snippet as before and under the hood Transformers will make use of Flash Attention.\n\n```py\nstart_time = time.time()\nwith torch.backends.cuda.sdp_kernel(enable_flash=True, enable_math=False, enable_mem_efficient=False):\n    result = pipe(long_prompt, max_new_tokens=60)[0][\"generated_text\"][len(long_prompt):]\n\nprint(f\"Generated in {time.time() - start_time} seconds.\")\nresult\n```\n\n**Output**:\n```\nGenerated in 3.0211617946624756 seconds.\n Sure. Here is a function that does that.\\n\\ndef bytes_to_giga(bytes):\\n   return bytes / 1024 / 1024 / 1024\\n\\nAnswer: Sure. Here is a function that does that.\\n\\ndef\n```\n\nWe're getting the exact same result as before, but can observe a very significant speed-up thanks to Flash Attention.\n\nLet's measure the memory consumption one last time.\n\n```python\nbytes_to_giga_bytes(torch.cuda.max_memory_allocated())\n```\n\n**Output**:\n```\n32.617331981658936\n```\n\nAnd we're almost back to our original 29GB peak GPU memory from the beginning.\n\nWe can observe that we only use roughly 100MB more GPU memory when passing a very long input sequence with Flash Attention compared to passing a short input sequence as done in the beginning.\n\n```py\nflush()\n```\n\nFor more information on how to use Flash Attention, please have a look at [this doc page](https://huggingface.co/docs/transformers/en/perf_infer_gpu_one#flashattention-2).\n\n## 3. Architectural Innovations\n\nSo far we have looked into improving computational and memory efficiency by:\n\n-   Casting the weights to a lower precision format\n-   Replacing the self-attention algorithm with a more memory- and compute efficient version\n\nLet's now look into how we can change the architecture of an LLM so that it is most effective and efficient for task that require long text inputs, *e.g.*:\n-   Retrieval augmented Questions Answering,\n-   Summarization,\n-   Chat\n\nNote that *chat* not only requires the LLM to handle long text inputs, but it also necessitates that the LLM is able to efficiently handle the back-and-forth dialogue between user and assistant (such as ChatGPT).\n\nOnce trained, the fundamental LLM architecture is difficult to change, so it is important to make considerations about the LLM's tasks beforehand and accordingly optimize the model's architecture.\nThere are two important components of the model architecture that quickly become memory and/or performance bottlenecks for large input sequences."}


created_at: 2024-08-26 20:30:03
topic: persistent://default/default/621deaf2-9359-4ac4-ada0-047176703e13
id: da94834b-58a3-4012-9e3c-4c0bc27a124b
encoding: FLOAT32
metadata:
{"url": "https://huggingface.co/docs/transformers/llm_tutorial_optimization", "title": "Optimizing LLMs for Speed and Memory", "tokens": 12767, "retrieve_doc": false, "source": "transformers", "_node_content": "{\"id_\": \"da94834b-58a3-4012-9e3c-4c0bc27a124b\", \"embedding\": null, \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/llm_tutorial_optimization\", \"title\": \"Optimizing LLMs for Speed and Memory\", \"tokens\": 12767, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"3d4a5be0-96a4-4cae-bb80-ec65cee94a22\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/llm_tutorial_optimization\", \"title\": \"Optimizing LLMs for Speed and Memory\", \"tokens\": 12767, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"hash\": \"bb1f2b699b61342ca13b75611df36eb9e3379ec4485edf0807dfbeb683246cf4\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"47937dea-7a4b-4dd2-b291-35bcee6a12a6\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/llm_tutorial_optimization\", \"title\": \"Optimizing LLMs for Speed and Memory\", \"tokens\": 12767, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"hash\": \"982dbe0f6752637dfc883d12a69a94173c1fb9e7c95125dd31c52b0783e7d652\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"e28d1f2a-4d3f-4c6f-ac22-a64f858c157f\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"f477813cd5adf852190df5bb9c246dceac104b413cba1347853ab0228dc94175\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 27294, \"end_char_idx\": 30558, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "3d4a5be0-96a4-4cae-bb80-ec65cee94a22", "doc_id": "3d4a5be0-96a4-4cae-bb80-ec65cee94a22", "ref_doc_id": "3d4a5be0-96a4-4cae-bb80-ec65cee94a22", "chroma:document": "Let's measure the memory consumption one last time.\n\n```python\nbytes_to_giga_bytes(torch.cuda.max_memory_allocated())\n```\n\n**Output**:\n```\n32.617331981658936\n```\n\nAnd we're almost back to our original 29GB peak GPU memory from the beginning.\n\nWe can observe that we only use roughly 100MB more GPU memory when passing a very long input sequence with Flash Attention compared to passing a short input sequence as done in the beginning.\n\n```py\nflush()\n```\n\nFor more information on how to use Flash Attention, please have a look at [this doc page](https://huggingface.co/docs/transformers/en/perf_infer_gpu_one#flashattention-2).\n\n## 3. Architectural Innovations\n\nSo far we have looked into improving computational and memory efficiency by:\n\n-   Casting the weights to a lower precision format\n-   Replacing the self-attention algorithm with a more memory- and compute efficient version\n\nLet's now look into how we can change the architecture of an LLM so that it is most effective and efficient for task that require long text inputs, *e.g.*:\n-   Retrieval augmented Questions Answering,\n-   Summarization,\n-   Chat\n\nNote that *chat* not only requires the LLM to handle long text inputs, but it also necessitates that the LLM is able to efficiently handle the back-and-forth dialogue between user and assistant (such as ChatGPT).\n\nOnce trained, the fundamental LLM architecture is difficult to change, so it is important to make considerations about the LLM's tasks beforehand and accordingly optimize the model's architecture.\nThere are two important components of the model architecture that quickly become memory and/or performance bottlenecks for large input sequences.\n\n-   The positional embeddings\n-   The key-value cache\n\nLet's go over each component in more detail\n\n### 3.1 Improving positional embeddings of LLMs\n\nSelf-attention puts each token in relation to each other's tokens.\nAs an example, the \\\\( \\text{Softmax}(\\mathbf{QK}^T) \\\\) matrix of the text input sequence *\"Hello\", \"I\", \"love\", \"you\"* could look as follows:\n\n![](/blog/assets/163_optimize_llm/self_attn_tokens.png)\n\nEach word token is given a probability mass at which it attends all other word tokens and, therefore is put into relation with all other word tokens. E.g. the word *\"love\"* attends to the word *\"Hello\"* with 5%, to *\"I\"* with 30%, and to itself with 65%.\n\nA LLM based on self-attention, but without position embeddings would have great difficulties in understanding the positions of the text inputs to each other.\nThis is because the probability score computed by \\\\( \\mathbf{QK}^T \\\\) relates each word token to each other word token in \\\\( O(1) \\\\) computations regardless of their relative positional distance to each other.\nTherefore, for the LLM without position embeddings each token appears to have the same distance to all other tokens, *e.g.* differentiating between *\"Hello I love you\"* and *\"You love I hello\"* would be very challenging.\n\nFor the LLM to understand sentence order, an additional *cue* is needed and is usually applied in the form of *positional encodings* (or also called *positional embeddings*).\nPositional encodings, encode the position of each token into a numerical presentation that the LLM can leverage to better understand sentence order."}


created_at: 2024-08-26 20:30:03
topic: persistent://default/default/621deaf2-9359-4ac4-ada0-047176703e13
id: e28d1f2a-4d3f-4c6f-ac22-a64f858c157f
encoding: FLOAT32
metadata:
{"url": "https://huggingface.co/docs/transformers/llm_tutorial_optimization", "title": "Optimizing LLMs for Speed and Memory", "tokens": 12767, "retrieve_doc": false, "source": "transformers", "_node_content": "{\"id_\": \"e28d1f2a-4d3f-4c6f-ac22-a64f858c157f\", \"embedding\": null, \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/llm_tutorial_optimization\", \"title\": \"Optimizing LLMs for Speed and Memory\", \"tokens\": 12767, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"3d4a5be0-96a4-4cae-bb80-ec65cee94a22\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/llm_tutorial_optimization\", \"title\": \"Optimizing LLMs for Speed and Memory\", \"tokens\": 12767, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"hash\": \"bb1f2b699b61342ca13b75611df36eb9e3379ec4485edf0807dfbeb683246cf4\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"da94834b-58a3-4012-9e3c-4c0bc27a124b\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/llm_tutorial_optimization\", \"title\": \"Optimizing LLMs for Speed and Memory\", \"tokens\": 12767, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"hash\": \"4972cd960e5ee06ee1a1ee8b555a1f61d84f0c9f11b2116a91767b009f09f243\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"15b7e771-c820-4034-961b-972c3b0f5fbf\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"73f2fbbd3c80bae45682a4f88bd216b152d3d9ed185b7a7bf34dec9608ecbb3d\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 28820, \"end_char_idx\": 31803, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "3d4a5be0-96a4-4cae-bb80-ec65cee94a22", "doc_id": "3d4a5be0-96a4-4cae-bb80-ec65cee94a22", "ref_doc_id": "3d4a5be0-96a4-4cae-bb80-ec65cee94a22", "chroma:document": "There are two important components of the model architecture that quickly become memory and/or performance bottlenecks for large input sequences.\n\n-   The positional embeddings\n-   The key-value cache\n\nLet's go over each component in more detail\n\n### 3.1 Improving positional embeddings of LLMs\n\nSelf-attention puts each token in relation to each other's tokens.\nAs an example, the \\\\( \\text{Softmax}(\\mathbf{QK}^T) \\\\) matrix of the text input sequence *\"Hello\", \"I\", \"love\", \"you\"* could look as follows:\n\n![](/blog/assets/163_optimize_llm/self_attn_tokens.png)\n\nEach word token is given a probability mass at which it attends all other word tokens and, therefore is put into relation with all other word tokens. E.g. the word *\"love\"* attends to the word *\"Hello\"* with 5%, to *\"I\"* with 30%, and to itself with 65%.\n\nA LLM based on self-attention, but without position embeddings would have great difficulties in understanding the positions of the text inputs to each other.\nThis is because the probability score computed by \\\\( \\mathbf{QK}^T \\\\) relates each word token to each other word token in \\\\( O(1) \\\\) computations regardless of their relative positional distance to each other.\nTherefore, for the LLM without position embeddings each token appears to have the same distance to all other tokens, *e.g.* differentiating between *\"Hello I love you\"* and *\"You love I hello\"* would be very challenging.\n\nFor the LLM to understand sentence order, an additional *cue* is needed and is usually applied in the form of *positional encodings* (or also called *positional embeddings*).\nPositional encodings, encode the position of each token into a numerical presentation that the LLM can leverage to better understand sentence order.\n\nThe authors of the [*Attention Is All You Need*](https://arxiv.org/abs/1706.03762) paper introduced sinusoidal positional embeddings \\\\( \\mathbf{P} = \\mathbf{p}_1, \\ldots, \\mathbf{p}_N \\\\) .\nwhere each vector \\\\( \\mathbf{p}_i \\\\) is computed as a sinusoidal function of its position \\\\( i \\\\) .\nThe positional encodings are then simply added to the input sequence vectors \\\\( \\mathbf{\\hat{X}} = \\mathbf{\\hat{x}}_1, \\ldots, \\mathbf{\\hat{x}}_N \\\\) = \\\\( \\mathbf{x}_1 + \\mathbf{p}_1, \\ldots, \\mathbf{x}_N + \\mathbf{p}_N \\\\) thereby cueing the model to better learn sentence order.\n\nInstead of using fixed position embeddings, others (such as [Devlin et al.](https://arxiv.org/abs/1810.04805)) used learned positional encodings for which the positional embeddings\n\\\\( \\mathbf{P} \\\\) are learned during training.\n\nSinusoidal and learned position embeddings used to be the predominant methods to encode sentence order into LLMs, but a couple of problems related to these positional encodings were found:\n\n  1. Sinusoidal and learned position embeddings are both absolute positional embeddings, *i.e.* encoding a unique embedding for each position id: \\\\( 0, \\ldots, N \\\\) . As shown by [Huang et al.](https://arxiv.org/abs/2009.13658) and [Su et al."}


created_at: 2024-08-26 20:30:03
topic: persistent://default/default/621deaf2-9359-4ac4-ada0-047176703e13
id: 15b7e771-c820-4034-961b-972c3b0f5fbf
encoding: FLOAT32
metadata:
{"url": "https://huggingface.co/docs/transformers/llm_tutorial_optimization", "title": "Optimizing LLMs for Speed and Memory", "tokens": 12767, "retrieve_doc": false, "source": "transformers", "_node_content": "{\"id_\": \"15b7e771-c820-4034-961b-972c3b0f5fbf\", \"embedding\": null, \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/llm_tutorial_optimization\", \"title\": \"Optimizing LLMs for Speed and Memory\", \"tokens\": 12767, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"3d4a5be0-96a4-4cae-bb80-ec65cee94a22\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/llm_tutorial_optimization\", \"title\": \"Optimizing LLMs for Speed and Memory\", \"tokens\": 12767, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"hash\": \"bb1f2b699b61342ca13b75611df36eb9e3379ec4485edf0807dfbeb683246cf4\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"e28d1f2a-4d3f-4c6f-ac22-a64f858c157f\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/llm_tutorial_optimization\", \"title\": \"Optimizing LLMs for Speed and Memory\", \"tokens\": 12767, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"hash\": \"0bbb3af180c1b66140bc6401011fbd10e38d9188f025e3b229129462a2505e0a\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"7968093d-b602-4b6c-b50b-b6cef32d8f5c\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"3534575b8eb919461581803b041d68e76b87488bd34a642843ae49317445727d\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 30410, \"end_char_idx\": 33251, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "3d4a5be0-96a4-4cae-bb80-ec65cee94a22", "doc_id": "3d4a5be0-96a4-4cae-bb80-ec65cee94a22", "ref_doc_id": "3d4a5be0-96a4-4cae-bb80-ec65cee94a22", "chroma:document": "Positional encodings, encode the position of each token into a numerical presentation that the LLM can leverage to better understand sentence order.\n\nThe authors of the [*Attention Is All You Need*](https://arxiv.org/abs/1706.03762) paper introduced sinusoidal positional embeddings \\\\( \\mathbf{P} = \\mathbf{p}_1, \\ldots, \\mathbf{p}_N \\\\) .\nwhere each vector \\\\( \\mathbf{p}_i \\\\) is computed as a sinusoidal function of its position \\\\( i \\\\) .\nThe positional encodings are then simply added to the input sequence vectors \\\\( \\mathbf{\\hat{X}} = \\mathbf{\\hat{x}}_1, \\ldots, \\mathbf{\\hat{x}}_N \\\\) = \\\\( \\mathbf{x}_1 + \\mathbf{p}_1, \\ldots, \\mathbf{x}_N + \\mathbf{p}_N \\\\) thereby cueing the model to better learn sentence order.\n\nInstead of using fixed position embeddings, others (such as [Devlin et al.](https://arxiv.org/abs/1810.04805)) used learned positional encodings for which the positional embeddings\n\\\\( \\mathbf{P} \\\\) are learned during training.\n\nSinusoidal and learned position embeddings used to be the predominant methods to encode sentence order into LLMs, but a couple of problems related to these positional encodings were found:\n\n  1. Sinusoidal and learned position embeddings are both absolute positional embeddings, *i.e.* encoding a unique embedding for each position id: \\\\( 0, \\ldots, N \\\\) . As shown by [Huang et al.](https://arxiv.org/abs/2009.13658) and [Su et al.](https://arxiv.org/abs/2104.09864), absolute positional embeddings lead to poor LLM performance for long text inputs. For long text inputs, it is advantageous if the model learns the relative positional distance input tokens have to each other instead of their absolute position.\n  2. When using learned position embeddings, the LLM has to be trained on a fixed input length \\\\( N \\\\), which makes it difficult to extrapolate to an input length longer than what it was trained on.\n\nRecently, relative positional embeddings that can tackle the above mentioned problems have become more popular, most notably:\n\n-   [Rotary Position Embedding (RoPE)](https://arxiv.org/abs/2104.09864)\n-   [ALiBi](https://arxiv.org/abs/2108.12409)\n\nBoth *RoPE* and *ALiBi* argue that it's best to cue the LLM about sentence order directly in the self-attention algorithm as it's there that word tokens are put into relation with each other. More specifically, sentence order should be cued by modifying the \\\\( \\mathbf{QK}^T \\\\) computation.\n\nWithout going into too many details, *RoPE* notes that positional information can be encoded into query-key pairs, *e.g.* \\\\( \\mathbf{q}_i \\\\) and \\\\( \\mathbf{x}_j \\\\) by rotating each vector by an angle \\\\( \\theta * i \\\\) and \\\\( \\theta * j \\\\) respectively with \\\\( i, j \\\\) describing each vectors sentence position:\n\n$$ \\mathbf{\\hat{q}}_i^T \\mathbf{\\hat{x}}_j = \\mathbf{{q}}_i^T \\mathbf{R}_{\\theta, i -j} \\mathbf{{x}}_j."}


created_at: 2024-08-26 20:30:03
topic: persistent://default/default/621deaf2-9359-4ac4-ada0-047176703e13
id: 7968093d-b602-4b6c-b50b-b6cef32d8f5c
encoding: FLOAT32
metadata:
{"url": "https://huggingface.co/docs/transformers/llm_tutorial_optimization", "title": "Optimizing LLMs for Speed and Memory", "tokens": 12767, "retrieve_doc": false, "source": "transformers", "_node_content": "{\"id_\": \"7968093d-b602-4b6c-b50b-b6cef32d8f5c\", \"embedding\": null, \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/llm_tutorial_optimization\", \"title\": \"Optimizing LLMs for Speed and Memory\", \"tokens\": 12767, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"3d4a5be0-96a4-4cae-bb80-ec65cee94a22\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/llm_tutorial_optimization\", \"title\": \"Optimizing LLMs for Speed and Memory\", \"tokens\": 12767, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"hash\": \"bb1f2b699b61342ca13b75611df36eb9e3379ec4485edf0807dfbeb683246cf4\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"15b7e771-c820-4034-961b-972c3b0f5fbf\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/llm_tutorial_optimization\", \"title\": \"Optimizing LLMs for Speed and Memory\", \"tokens\": 12767, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"hash\": \"4c0be1b0be39510ddcf4ebda86b3b0967ebcbfbdbded9fd8c4bd175cc349dc9e\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"fe84e6bb-664e-48ee-a3ee-197ba5633947\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"746622e56f12dd42c4e15c33214f92ccb751c5c3fde74580d9681e1527b3f1f7\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 31803, \"end_char_idx\": 34520, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "3d4a5be0-96a4-4cae-bb80-ec65cee94a22", "doc_id": "3d4a5be0-96a4-4cae-bb80-ec65cee94a22", "ref_doc_id": "3d4a5be0-96a4-4cae-bb80-ec65cee94a22", "chroma:document": "](https://arxiv.org/abs/2104.09864), absolute positional embeddings lead to poor LLM performance for long text inputs. For long text inputs, it is advantageous if the model learns the relative positional distance input tokens have to each other instead of their absolute position.\n  2. When using learned position embeddings, the LLM has to be trained on a fixed input length \\\\( N \\\\), which makes it difficult to extrapolate to an input length longer than what it was trained on.\n\nRecently, relative positional embeddings that can tackle the above mentioned problems have become more popular, most notably:\n\n-   [Rotary Position Embedding (RoPE)](https://arxiv.org/abs/2104.09864)\n-   [ALiBi](https://arxiv.org/abs/2108.12409)\n\nBoth *RoPE* and *ALiBi* argue that it's best to cue the LLM about sentence order directly in the self-attention algorithm as it's there that word tokens are put into relation with each other. More specifically, sentence order should be cued by modifying the \\\\( \\mathbf{QK}^T \\\\) computation.\n\nWithout going into too many details, *RoPE* notes that positional information can be encoded into query-key pairs, *e.g.* \\\\( \\mathbf{q}_i \\\\) and \\\\( \\mathbf{x}_j \\\\) by rotating each vector by an angle \\\\( \\theta * i \\\\) and \\\\( \\theta * j \\\\) respectively with \\\\( i, j \\\\) describing each vectors sentence position:\n\n$$ \\mathbf{\\hat{q}}_i^T \\mathbf{\\hat{x}}_j = \\mathbf{{q}}_i^T \\mathbf{R}_{\\theta, i -j} \\mathbf{{x}}_j. $$\n\n\\\\( \\mathbf{R}_{\\theta, i - j} \\\\) thereby represents a rotational matrix. \\\\( \\theta \\\\) is *not* learned during training, but instead set to a pre-defined value that depends on the maximum input sequence length during training.\n\n> By doing so, the propability score between \\\\( \\mathbf{q}_i \\\\) and \\\\( \\mathbf{q}_j \\\\) is only affected if \\\\( i \\ne j \\\\) and solely depends on the relative distance \\\\( i - j \\\\) regardless of each vector's specific positions \\\\( i \\\\) and \\\\( j \\\\) .\n\n*RoPE* is used in multiple of today's most important LLMs, such as:\n\n-   [**Falcon**](https://huggingface.co/tiiuae/falcon-40b)\n-   [**Llama**](https://arxiv.org/abs/2302.13971)\n-   [**PaLM**](https://arxiv.org/abs/2204.02311)\n\nAs an alternative, *ALiBi* proposes a much simpler relative position encoding scheme. The relative distance that input tokens have to each other is added as a negative integer scaled by a pre-defined value `m` to each query-key entry of the \\\\( \\mathbf{QK}^T \\\\) matrix right before the softmax computation.\n\n![](/blog/assets/163_optimize_llm/alibi.png)\n\nAs shown in the [ALiBi](https://arxiv.org/abs/2108.12409) paper, this simple relative positional encoding allows the model to retain a high performance even at very long text input sequences."}


created_at: 2024-08-26 20:30:03
topic: persistent://default/default/621deaf2-9359-4ac4-ada0-047176703e13
id: fe84e6bb-664e-48ee-a3ee-197ba5633947
encoding: FLOAT32
metadata:
{"url": "https://huggingface.co/docs/transformers/llm_tutorial_optimization", "title": "Optimizing LLMs for Speed and Memory", "tokens": 12767, "retrieve_doc": false, "source": "transformers", "_node_content": "{\"id_\": \"fe84e6bb-664e-48ee-a3ee-197ba5633947\", \"embedding\": null, \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/llm_tutorial_optimization\", \"title\": \"Optimizing LLMs for Speed and Memory\", \"tokens\": 12767, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"3d4a5be0-96a4-4cae-bb80-ec65cee94a22\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/llm_tutorial_optimization\", \"title\": \"Optimizing LLMs for Speed and Memory\", \"tokens\": 12767, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"hash\": \"bb1f2b699b61342ca13b75611df36eb9e3379ec4485edf0807dfbeb683246cf4\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"7968093d-b602-4b6c-b50b-b6cef32d8f5c\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/llm_tutorial_optimization\", \"title\": \"Optimizing LLMs for Speed and Memory\", \"tokens\": 12767, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"hash\": \"8c4ccb196e159e1ae787a982818e9084a673e8bfb8fd44b1bbfa8192f7473351\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"57150321-dfaa-4fe3-a076-ae59685a4468\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"952fb74b52be8619a9ba89b8c64a0e4e109a868436509abc357a1b1466675bc8\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 33252, \"end_char_idx\": 36207, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "3d4a5be0-96a4-4cae-bb80-ec65cee94a22", "doc_id": "3d4a5be0-96a4-4cae-bb80-ec65cee94a22", "ref_doc_id": "3d4a5be0-96a4-4cae-bb80-ec65cee94a22", "chroma:document": "$$\n\n\\\\( \\mathbf{R}_{\\theta, i - j} \\\\) thereby represents a rotational matrix. \\\\( \\theta \\\\) is *not* learned during training, but instead set to a pre-defined value that depends on the maximum input sequence length during training.\n\n> By doing so, the propability score between \\\\( \\mathbf{q}_i \\\\) and \\\\( \\mathbf{q}_j \\\\) is only affected if \\\\( i \\ne j \\\\) and solely depends on the relative distance \\\\( i - j \\\\) regardless of each vector's specific positions \\\\( i \\\\) and \\\\( j \\\\) .\n\n*RoPE* is used in multiple of today's most important LLMs, such as:\n\n-   [**Falcon**](https://huggingface.co/tiiuae/falcon-40b)\n-   [**Llama**](https://arxiv.org/abs/2302.13971)\n-   [**PaLM**](https://arxiv.org/abs/2204.02311)\n\nAs an alternative, *ALiBi* proposes a much simpler relative position encoding scheme. The relative distance that input tokens have to each other is added as a negative integer scaled by a pre-defined value `m` to each query-key entry of the \\\\( \\mathbf{QK}^T \\\\) matrix right before the softmax computation.\n\n![](/blog/assets/163_optimize_llm/alibi.png)\n\nAs shown in the [ALiBi](https://arxiv.org/abs/2108.12409) paper, this simple relative positional encoding allows the model to retain a high performance even at very long text input sequences.\n\n*ALiBi* is used in multiple of today's most important LLMs, such as:\n\n-   [**MPT**](https://huggingface.co/mosaicml/mpt-30b)\n-   [**BLOOM**](https://huggingface.co/bigscience/bloom)\n\nBoth *RoPE* and *ALiBi* position encodings can extrapolate to input lengths not seen during training whereas it has been shown that extrapolation works much better out-of-the-box for *ALiBi* as compared to *RoPE*.\nFor ALiBi, one simply increases the values of the lower triangular position matrix to match the length of the input sequence.\nFor *RoPE*, keeping the same \\\\( \\theta \\\\) that was used during training leads to poor results when passing text inputs much longer than those seen during training, *c.f* [Press et al.](https://arxiv.org/abs/2108.12409). However, the community has found a couple of effective tricks that adapt \\\\( \\theta \\\\), thereby allowing *RoPE* position embeddings to work well for extrapolated text input sequences (see [here](https://github.com/huggingface/transformers/pull/24653)).\n\n> Both RoPE and ALiBi are relative positional embeddings that are *not* learned during training, but instead are based on the following intuitions:\n -   Positional cues about the text inputs should be given directly to the \\\\( QK^T \\\\) matrix of the self-attention layer\n -   The LLM should be incentivized to learn a constant *relative* distance positional encodings have to each other\n -   The further text input tokens are from each other, the lower the probability of their query-value probability. Both RoPE and ALiBi lower the query-key probability of tokens far away from each other. RoPE by decreasing their vector product by increasing the angle between the query-key vectors."}


created_at: 2024-08-26 20:30:03
topic: persistent://default/default/621deaf2-9359-4ac4-ada0-047176703e13
id: 57150321-dfaa-4fe3-a076-ae59685a4468
encoding: FLOAT32
metadata:
{"url": "https://huggingface.co/docs/transformers/llm_tutorial_optimization", "title": "Optimizing LLMs for Speed and Memory", "tokens": 12767, "retrieve_doc": false, "source": "transformers", "_node_content": "{\"id_\": \"57150321-dfaa-4fe3-a076-ae59685a4468\", \"embedding\": null, \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/llm_tutorial_optimization\", \"title\": \"Optimizing LLMs for Speed and Memory\", \"tokens\": 12767, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"3d4a5be0-96a4-4cae-bb80-ec65cee94a22\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/llm_tutorial_optimization\", \"title\": \"Optimizing LLMs for Speed and Memory\", \"tokens\": 12767, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"hash\": \"bb1f2b699b61342ca13b75611df36eb9e3379ec4485edf0807dfbeb683246cf4\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"fe84e6bb-664e-48ee-a3ee-197ba5633947\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/llm_tutorial_optimization\", \"title\": \"Optimizing LLMs for Speed and Memory\", \"tokens\": 12767, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"hash\": \"be2dbae258c9cdadc18ebcbc10075e5365ece61122b351f4dab0bff429a0e5da\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"d4e0cca1-e525-4759-b8ad-bf2a82c5dec1\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"24846d182f5654940a979efdbf2dff9f3fe461faabaf22c36dcce381893c0799\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 34919, \"end_char_idx\": 38101, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "3d4a5be0-96a4-4cae-bb80-ec65cee94a22", "doc_id": "3d4a5be0-96a4-4cae-bb80-ec65cee94a22", "ref_doc_id": "3d4a5be0-96a4-4cae-bb80-ec65cee94a22", "chroma:document": "For ALiBi, one simply increases the values of the lower triangular position matrix to match the length of the input sequence.\nFor *RoPE*, keeping the same \\\\( \\theta \\\\) that was used during training leads to poor results when passing text inputs much longer than those seen during training, *c.f* [Press et al.](https://arxiv.org/abs/2108.12409). However, the community has found a couple of effective tricks that adapt \\\\( \\theta \\\\), thereby allowing *RoPE* position embeddings to work well for extrapolated text input sequences (see [here](https://github.com/huggingface/transformers/pull/24653)).\n\n> Both RoPE and ALiBi are relative positional embeddings that are *not* learned during training, but instead are based on the following intuitions:\n -   Positional cues about the text inputs should be given directly to the \\\\( QK^T \\\\) matrix of the self-attention layer\n -   The LLM should be incentivized to learn a constant *relative* distance positional encodings have to each other\n -   The further text input tokens are from each other, the lower the probability of their query-value probability. Both RoPE and ALiBi lower the query-key probability of tokens far away from each other. RoPE by decreasing their vector product by increasing the angle between the query-key vectors. ALiBi by adding large negative numbers to the vector product\n\nIn conclusion, LLMs that are intended to be deployed in tasks that require handling large text inputs are better trained with relative positional embeddings, such as RoPE and ALiBi. Also note that even if an LLM with RoPE and ALiBi has been trained only on a fixed length of say \\\\( N_1 = 2048 \\\\) it can still be used in practice with text inputs much larger than \\\\( N_1 \\\\), like \\\\( N_2 = 8192 > N_1 \\\\) by extrapolating the positional embeddings.\n\n### 3.2 The key-value cache\n\nAuto-regressive text generation with LLMs works by iteratively putting in an input sequence, sampling the next token, appending the next token to the input sequence, and continuing to do so until the LLM produces a token that signifies that the generation has finished.\n\nPlease have a look at [Transformer's Generate Text Tutorial](https://huggingface.co/docs/transformers/llm_tutorial#generate-text) to get a more visual explanation of how auto-regressive generation works.\n\nLet's run a quick code snippet to show how auto-regressive works in practice. We will simply take the most likely next token via `torch.argmax`.\n\n```python\ninput_ids = tokenizer(prompt, return_tensors=\"pt\")[\"input_ids\"].to(\"cuda\")\n\nfor _ in range(5):\n  next_logits = model(input_ids)[\"logits\"][:, -1:]\n  next_token_id = torch.argmax(next_logits,dim=-1)\n\n  input_ids = torch.cat([input_ids, next_token_id], dim=-1)\n  print(\"shape of input_ids\", input_ids.shape)\n\ngenerated_text = tokenizer.batch_decode(input_ids[:, -5:])\ngenerated_text\n```\n\n**Output**:\n```\nshape of input_ids torch.Size([1, 21])\nshape of input_ids torch.Size([1, 22])\nshape of input_ids torch.Size([1, 23])\nshape of input_ids torch.Size([1, 24])\nshape of input_ids torch.Size([1, 25])\n[' Here is a Python function']\n```\n\nAs we can see every time we increase the text input tokens by the just sampled token."}


created_at: 2024-08-26 20:30:03
topic: persistent://default/default/621deaf2-9359-4ac4-ada0-047176703e13
id: d4e0cca1-e525-4759-b8ad-bf2a82c5dec1
encoding: FLOAT32
metadata:
{"url": "https://huggingface.co/docs/transformers/llm_tutorial_optimization", "title": "Optimizing LLMs for Speed and Memory", "tokens": 12767, "retrieve_doc": false, "source": "transformers", "_node_content": "{\"id_\": \"d4e0cca1-e525-4759-b8ad-bf2a82c5dec1\", \"embedding\": null, \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/llm_tutorial_optimization\", \"title\": \"Optimizing LLMs for Speed and Memory\", \"tokens\": 12767, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"3d4a5be0-96a4-4cae-bb80-ec65cee94a22\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/llm_tutorial_optimization\", \"title\": \"Optimizing LLMs for Speed and Memory\", \"tokens\": 12767, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"hash\": \"bb1f2b699b61342ca13b75611df36eb9e3379ec4485edf0807dfbeb683246cf4\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"57150321-dfaa-4fe3-a076-ae59685a4468\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/llm_tutorial_optimization\", \"title\": \"Optimizing LLMs for Speed and Memory\", \"tokens\": 12767, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"hash\": \"ae2231674f74efb1e249a6dc1f8e569d06c3c1fa35218e94b0d73dad2668c6c8\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"17b258bf-820c-47fe-a6b9-1f60fdea0a48\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"38ddc65233b05630bb4c2bb673684fdd350e4e603434d83be896bcdb52d438d9\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 36723, \"end_char_idx\": 39430, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "3d4a5be0-96a4-4cae-bb80-ec65cee94a22", "doc_id": "3d4a5be0-96a4-4cae-bb80-ec65cee94a22", "ref_doc_id": "3d4a5be0-96a4-4cae-bb80-ec65cee94a22", "chroma:document": "### 3.2 The key-value cache\n\nAuto-regressive text generation with LLMs works by iteratively putting in an input sequence, sampling the next token, appending the next token to the input sequence, and continuing to do so until the LLM produces a token that signifies that the generation has finished.\n\nPlease have a look at [Transformer's Generate Text Tutorial](https://huggingface.co/docs/transformers/llm_tutorial#generate-text) to get a more visual explanation of how auto-regressive generation works.\n\nLet's run a quick code snippet to show how auto-regressive works in practice. We will simply take the most likely next token via `torch.argmax`.\n\n```python\ninput_ids = tokenizer(prompt, return_tensors=\"pt\")[\"input_ids\"].to(\"cuda\")\n\nfor _ in range(5):\n  next_logits = model(input_ids)[\"logits\"][:, -1:]\n  next_token_id = torch.argmax(next_logits,dim=-1)\n\n  input_ids = torch.cat([input_ids, next_token_id], dim=-1)\n  print(\"shape of input_ids\", input_ids.shape)\n\ngenerated_text = tokenizer.batch_decode(input_ids[:, -5:])\ngenerated_text\n```\n\n**Output**:\n```\nshape of input_ids torch.Size([1, 21])\nshape of input_ids torch.Size([1, 22])\nshape of input_ids torch.Size([1, 23])\nshape of input_ids torch.Size([1, 24])\nshape of input_ids torch.Size([1, 25])\n[' Here is a Python function']\n```\n\nAs we can see every time we increase the text input tokens by the just sampled token.\n\nWith very few exceptions, LLMs are trained using the [causal language modeling objective](https://huggingface.co/docs/transformers/tasks/language_modeling#causal-language-modeling) and therefore mask the upper triangle matrix of the attention score - this is why in the two diagrams above the attention scores are left blank (*a.k.a* have 0 probability). For a quick recap on causal language modeling you can refer to the [*Illustrated Self Attention blog*](https://jalammar.github.io/illustrated-gpt2/#part-2-illustrated-self-attention).\n\nAs a consequence, tokens *never* depend on previous tokens, more specifically the \\\\( \\mathbf{q}_i \\\\) vector is never put in relation with any key, values vectors \\\\( \\mathbf{k}_j, \\mathbf{v}_j \\\\) if \\\\( j > i \\\\) . Instead \\\\( \\mathbf{q}_i \\\\) only attends to previous key-value vectors \\\\( \\mathbf{k}_{m < i}, \\mathbf{v}_{m < i} \\text{ , for } m \\in \\{0, \\ldots i - 1\\} \\\\). In order to reduce unnecessary computation, one can therefore cache each layer's key-value vectors for all previous timesteps.\n\nIn the following, we will tell the LLM to make use of the key-value cache by retrieving and forwarding it for each forward pass.\nIn Transformers, we can retrieve the key-value cache by passing the `use_cache` flag to the `forward` call and can then pass it with the current token."}


created_at: 2024-08-26 20:30:03
topic: persistent://default/default/621deaf2-9359-4ac4-ada0-047176703e13
id: 17b258bf-820c-47fe-a6b9-1f60fdea0a48
encoding: FLOAT32
metadata:
{"url": "https://huggingface.co/docs/transformers/llm_tutorial_optimization", "title": "Optimizing LLMs for Speed and Memory", "tokens": 12767, "retrieve_doc": false, "source": "transformers", "_node_content": "{\"id_\": \"17b258bf-820c-47fe-a6b9-1f60fdea0a48\", \"embedding\": null, \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/llm_tutorial_optimization\", \"title\": \"Optimizing LLMs for Speed and Memory\", \"tokens\": 12767, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"3d4a5be0-96a4-4cae-bb80-ec65cee94a22\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/llm_tutorial_optimization\", \"title\": \"Optimizing LLMs for Speed and Memory\", \"tokens\": 12767, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"hash\": \"bb1f2b699b61342ca13b75611df36eb9e3379ec4485edf0807dfbeb683246cf4\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"d4e0cca1-e525-4759-b8ad-bf2a82c5dec1\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/llm_tutorial_optimization\", \"title\": \"Optimizing LLMs for Speed and Memory\", \"tokens\": 12767, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"hash\": \"e7070317de8c42cd1197a1f6ca5960c44f07fcf98e46ecc808a3ab01d0023fdf\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"4e892dc1-6f80-440e-b629-d1b982778b5e\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"c9cb2e02b42fc7b6d9c54967d96a5fedc624321fcba4b2a0494b55668d4ef2a9\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 38103, \"end_char_idx\": 41062, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "3d4a5be0-96a4-4cae-bb80-ec65cee94a22", "doc_id": "3d4a5be0-96a4-4cae-bb80-ec65cee94a22", "ref_doc_id": "3d4a5be0-96a4-4cae-bb80-ec65cee94a22", "chroma:document": "With very few exceptions, LLMs are trained using the [causal language modeling objective](https://huggingface.co/docs/transformers/tasks/language_modeling#causal-language-modeling) and therefore mask the upper triangle matrix of the attention score - this is why in the two diagrams above the attention scores are left blank (*a.k.a* have 0 probability). For a quick recap on causal language modeling you can refer to the [*Illustrated Self Attention blog*](https://jalammar.github.io/illustrated-gpt2/#part-2-illustrated-self-attention).\n\nAs a consequence, tokens *never* depend on previous tokens, more specifically the \\\\( \\mathbf{q}_i \\\\) vector is never put in relation with any key, values vectors \\\\( \\mathbf{k}_j, \\mathbf{v}_j \\\\) if \\\\( j > i \\\\) . Instead \\\\( \\mathbf{q}_i \\\\) only attends to previous key-value vectors \\\\( \\mathbf{k}_{m < i}, \\mathbf{v}_{m < i} \\text{ , for } m \\in \\{0, \\ldots i - 1\\} \\\\). In order to reduce unnecessary computation, one can therefore cache each layer's key-value vectors for all previous timesteps.\n\nIn the following, we will tell the LLM to make use of the key-value cache by retrieving and forwarding it for each forward pass.\nIn Transformers, we can retrieve the key-value cache by passing the `use_cache` flag to the `forward` call and can then pass it with the current token.\n\n```python\npast_key_values = None # past_key_values is the key-value cache\ngenerated_tokens = []\nnext_token_id = tokenizer(prompt, return_tensors=\"pt\")[\"input_ids\"].to(\"cuda\")\n\nfor _ in range(5):\n  next_logits, past_key_values = model(next_token_id, past_key_values=past_key_values, use_cache=True).to_tuple()\n  next_logits = next_logits[:, -1:]\n  next_token_id = torch.argmax(next_logits, dim=-1)\n\n  print(\"shape of input_ids\", next_token_id.shape)\n  print(\"length of key-value cache\", len(past_key_values[0][0]))  # past_key_values are of shape [num_layers, 0 for k, 1 for v, batch_size, length, hidden_dim]\n  generated_tokens.append(next_token_id.item())\n\ngenerated_text = tokenizer.batch_decode(generated_tokens)\ngenerated_text\n```\n\n**Output**:\n```\nshape of input_ids torch.Size([1, 1])\nlength of key-value cache 20\nshape of input_ids torch.Size([1, 1])\nlength of key-value cache 21\nshape of input_ids torch.Size([1, 1])\nlength of key-value cache 22\nshape of input_ids torch.Size([1, 1])\nlength of key-value cache 23\nshape of input_ids torch.Size([1, 1])\nlength of key-value cache 24\n[' Here', ' is', ' a', ' Python', ' function']\n```\n\nAs one can see, when using the key-value cache the text input tokens are *not* increased in length, but remain a single input vector. The length of the key-value cache on the other hand is increased by one at every decoding step.\n\n> Making use of the key-value cache means that the \\\\( \\mathbf{QK}^T \\\\) is essentially reduced to \\\\( \\mathbf{q}_c\\mathbf{K}^T \\\\) with \\\\( \\mathbf{q}_c \\\\) being the query projection of the currently passed input token which is *always* just a single vector."}


created_at: 2024-08-26 20:30:03
topic: persistent://default/default/621deaf2-9359-4ac4-ada0-047176703e13
id: 4e892dc1-6f80-440e-b629-d1b982778b5e
encoding: FLOAT32
metadata:
{"url": "https://huggingface.co/docs/transformers/llm_tutorial_optimization", "title": "Optimizing LLMs for Speed and Memory", "tokens": 12767, "retrieve_doc": false, "source": "transformers", "_node_content": "{\"id_\": \"4e892dc1-6f80-440e-b629-d1b982778b5e\", \"embedding\": null, \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/llm_tutorial_optimization\", \"title\": \"Optimizing LLMs for Speed and Memory\", \"tokens\": 12767, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"3d4a5be0-96a4-4cae-bb80-ec65cee94a22\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/llm_tutorial_optimization\", \"title\": \"Optimizing LLMs for Speed and Memory\", \"tokens\": 12767, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"hash\": \"bb1f2b699b61342ca13b75611df36eb9e3379ec4485edf0807dfbeb683246cf4\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"17b258bf-820c-47fe-a6b9-1f60fdea0a48\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/llm_tutorial_optimization\", \"title\": \"Optimizing LLMs for Speed and Memory\", \"tokens\": 12767, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"hash\": \"8ff82756446e934344f8c369afa75167858611f14496a80b6b90afb23121a0eb\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"72e72914-2272-4d9f-8e9e-3d3417fa3d6c\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"c832afa7bcef6ea2ae20d8655703169ec0723f3edd6dab0de438c5a0c675a7a9\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 40705, \"end_char_idx\": 44120, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "3d4a5be0-96a4-4cae-bb80-ec65cee94a22", "doc_id": "3d4a5be0-96a4-4cae-bb80-ec65cee94a22", "ref_doc_id": "3d4a5be0-96a4-4cae-bb80-ec65cee94a22", "chroma:document": "The length of the key-value cache on the other hand is increased by one at every decoding step.\n\n> Making use of the key-value cache means that the \\\\( \\mathbf{QK}^T \\\\) is essentially reduced to \\\\( \\mathbf{q}_c\\mathbf{K}^T \\\\) with \\\\( \\mathbf{q}_c \\\\) being the query projection of the currently passed input token which is *always* just a single vector.\n\nUsing the key-value cache has two advantages:\n-   Significant increase in computational efficiency as less computations are performed compared to computing the full \\\\( \\mathbf{QK}^T \\\\) matrix. This leads to an increase in inference speed\n-   The maximum required memory is not increased quadratically with the number of generated tokens, but only increases linearly.\n\n> One should *always* make use of the key-value cache as it leads to identical results and a significant speed-up for longer input sequences. Transformers has the key-value cache enabled by default when making use of the text pipeline or the [`generate` method](https://huggingface.co/docs/transformers/main_classes/text_generation).\n\n<Tip warning={true}>\n\nNote that, despite our advice to use key-value caches, your LLM output may be slightly different when you use them. This is a property of the matrix multiplication kernels themselves -- you can read more about it [here](https://github.com/huggingface/transformers/issues/25420#issuecomment-1775317535).\n\n</Tip>\n\n#### 3.2.1 Multi-round conversation\n\nThe key-value cache is especially useful for applications such as chat where multiple passes of auto-regressive decoding are required. Let's look at an example.\n\n```\nUser: How many people live in France?\nAssistant: Roughly 75 million people live in France\nUser: And how many are in Germany?\nAssistant: Germany has ca. 81 million inhabitants\n```\n\nIn this chat, the LLM runs auto-regressive decoding twice:\n  1. The first time, the key-value cache is empty and the input prompt is `\"User: How many people live in France?\"` and the model auto-regressively generates the text `\"Roughly 75 million people live in France\"` while increasing the key-value cache at every decoding step.\n  2. The second time the input prompt is `\"User: How many people live in France? \\n Assistant: Roughly 75 million people live in France \\n User: And how many in Germany?\"`. Thanks to the cache, all key-value vectors for the first two sentences are already computed. Therefore the input prompt only consists of `\"User: And how many in Germany?\"`. While processing the shortened input prompt, its computed key-value vectors are concatenated to the key-value cache of the first decoding. The second Assistant's answer `\"Germany has ca. 81 million inhabitants\"` is then auto-regressively generated with the key-value cache consisting of encoded key-value vectors of `\"User: How many people live in France? \\n Assistant: Roughly 75 million people live in France \\n User: And how many are in Germany?\"`.\n\nTwo things should be noted here:\n  1. Keeping all the context is crucial for LLMs deployed in chat so that the LLM understands all the previous context of the conversation. E.g. for the example above the LLM needs to understand that the user refers to the population when asking `\"And how many are in Germany\"`.\n  2. The key-value cache is extremely useful for chat as it allows us to continuously grow the encoded chat history instead of having to re-encode the chat history again from scratch (as e.g."}


created_at: 2024-08-26 20:30:03
topic: persistent://default/default/621deaf2-9359-4ac4-ada0-047176703e13
id: 72e72914-2272-4d9f-8e9e-3d3417fa3d6c
encoding: FLOAT32
metadata:
{"url": "https://huggingface.co/docs/transformers/llm_tutorial_optimization", "title": "Optimizing LLMs for Speed and Memory", "tokens": 12767, "retrieve_doc": false, "source": "transformers", "_node_content": "{\"id_\": \"72e72914-2272-4d9f-8e9e-3d3417fa3d6c\", \"embedding\": null, \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/llm_tutorial_optimization\", \"title\": \"Optimizing LLMs for Speed and Memory\", \"tokens\": 12767, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"3d4a5be0-96a4-4cae-bb80-ec65cee94a22\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/llm_tutorial_optimization\", \"title\": \"Optimizing LLMs for Speed and Memory\", \"tokens\": 12767, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"hash\": \"bb1f2b699b61342ca13b75611df36eb9e3379ec4485edf0807dfbeb683246cf4\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"4e892dc1-6f80-440e-b629-d1b982778b5e\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/llm_tutorial_optimization\", \"title\": \"Optimizing LLMs for Speed and Memory\", \"tokens\": 12767, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"hash\": \"8c9a8999caaeca3a1567cab8d7d0b9f1920bb677fa357b0b1c0b626a04de010f\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"ac613e7e-f1c8-40e1-a601-600b2b493e5a\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"e6a25a528f08e3d1fa9da16f79acd34fba42d3e739ac537ec1924e877d695fd9\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 42431, \"end_char_idx\": 45856, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "3d4a5be0-96a4-4cae-bb80-ec65cee94a22", "doc_id": "3d4a5be0-96a4-4cae-bb80-ec65cee94a22", "ref_doc_id": "3d4a5be0-96a4-4cae-bb80-ec65cee94a22", "chroma:document": "Assistant: Germany has ca. 81 million inhabitants\n```\n\nIn this chat, the LLM runs auto-regressive decoding twice:\n  1. The first time, the key-value cache is empty and the input prompt is `\"User: How many people live in France?\"` and the model auto-regressively generates the text `\"Roughly 75 million people live in France\"` while increasing the key-value cache at every decoding step.\n  2. The second time the input prompt is `\"User: How many people live in France? \\n Assistant: Roughly 75 million people live in France \\n User: And how many in Germany?\"`. Thanks to the cache, all key-value vectors for the first two sentences are already computed. Therefore the input prompt only consists of `\"User: And how many in Germany?\"`. While processing the shortened input prompt, its computed key-value vectors are concatenated to the key-value cache of the first decoding. The second Assistant's answer `\"Germany has ca. 81 million inhabitants\"` is then auto-regressively generated with the key-value cache consisting of encoded key-value vectors of `\"User: How many people live in France? \\n Assistant: Roughly 75 million people live in France \\n User: And how many are in Germany?\"`.\n\nTwo things should be noted here:\n  1. Keeping all the context is crucial for LLMs deployed in chat so that the LLM understands all the previous context of the conversation. E.g. for the example above the LLM needs to understand that the user refers to the population when asking `\"And how many are in Germany\"`.\n  2. The key-value cache is extremely useful for chat as it allows us to continuously grow the encoded chat history instead of having to re-encode the chat history again from scratch (as e.g. would be the case when using an encoder-decoder architecture).\n\nIn `transformers`, a `generate` call will return `past_key_values` when `return_dict_in_generate=True` is passed, in addition to the default `use_cache=True`. Note that it is not yet available through the `pipeline` interface.\n\n```python\n# Generation as usual\nprompt = system_prompt + \"Question: Please write a function in Python that transforms bytes to Giga bytes.\\n\\nAnswer: Here\"\nmodel_inputs = tokenizer(prompt, return_tensors='pt')\ngeneration_output = model.generate(**model_inputs, max_new_tokens=60, return_dict_in_generate=True)\ndecoded_output = tokenizer.batch_decode(generation_output.sequences)[0]\n\n# Piping the returned `past_key_values` to speed up the next conversation round\nprompt = decoded_output + \"\\nQuestion: How can I modify the function above to return Mega bytes instead?\\n\\nAnswer: Here\"\nmodel_inputs = tokenizer(prompt, return_tensors='pt')\ngeneration_output = model.generate(\n  **model_inputs,\n  past_key_values=generation_output.past_key_values,\n  max_new_tokens=60,\n  return_dict_in_generate=True\n)\ntokenizer.batch_decode(generation_output.sequences)[0][len(prompt):]\n```\n\n**Output**:\n```\n is a modified version of the function that returns Mega bytes instead.\n\ndef bytes_to_megabytes(bytes):\n   return bytes / 1024 / 1024\n\nAnswer: The function takes a number of bytes as input and returns the number of\n```\n\nGreat, no additional time is spent recomputing the same key and values for the attention layer! There is however one catch. While the required peak memory for the \\\\( \\mathbf{QK}^T \\\\) matrix is significantly reduced, holding the key-value cache in memory can become very memory expensive for long input sequences or multi-turn chat."}


created_at: 2024-08-26 20:30:03
topic: persistent://default/default/621deaf2-9359-4ac4-ada0-047176703e13
id: ac613e7e-f1c8-40e1-a601-600b2b493e5a
encoding: FLOAT32
metadata:
{"url": "https://huggingface.co/docs/transformers/llm_tutorial_optimization", "title": "Optimizing LLMs for Speed and Memory", "tokens": 12767, "retrieve_doc": false, "source": "transformers", "_node_content": "{\"id_\": \"ac613e7e-f1c8-40e1-a601-600b2b493e5a\", \"embedding\": null, \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/llm_tutorial_optimization\", \"title\": \"Optimizing LLMs for Speed and Memory\", \"tokens\": 12767, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"3d4a5be0-96a4-4cae-bb80-ec65cee94a22\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/llm_tutorial_optimization\", \"title\": \"Optimizing LLMs for Speed and Memory\", \"tokens\": 12767, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"hash\": \"bb1f2b699b61342ca13b75611df36eb9e3379ec4485edf0807dfbeb683246cf4\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"72e72914-2272-4d9f-8e9e-3d3417fa3d6c\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/llm_tutorial_optimization\", \"title\": \"Optimizing LLMs for Speed and Memory\", \"tokens\": 12767, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"hash\": \"af7fe762ab2d1d788a352dcae8d67faae696c12653c1c469d1646b379dbc93d3\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"a1885591-e8d5-4a91-964d-62ab4155ece6\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"524d0e520cea28535feab9b2014e35857168fe5d735eca875ea09c947aa6f6bb\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 44121, \"end_char_idx\": 47413, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "3d4a5be0-96a4-4cae-bb80-ec65cee94a22", "doc_id": "3d4a5be0-96a4-4cae-bb80-ec65cee94a22", "ref_doc_id": "3d4a5be0-96a4-4cae-bb80-ec65cee94a22", "chroma:document": "would be the case when using an encoder-decoder architecture).\n\nIn `transformers`, a `generate` call will return `past_key_values` when `return_dict_in_generate=True` is passed, in addition to the default `use_cache=True`. Note that it is not yet available through the `pipeline` interface.\n\n```python\n# Generation as usual\nprompt = system_prompt + \"Question: Please write a function in Python that transforms bytes to Giga bytes.\\n\\nAnswer: Here\"\nmodel_inputs = tokenizer(prompt, return_tensors='pt')\ngeneration_output = model.generate(**model_inputs, max_new_tokens=60, return_dict_in_generate=True)\ndecoded_output = tokenizer.batch_decode(generation_output.sequences)[0]\n\n# Piping the returned `past_key_values` to speed up the next conversation round\nprompt = decoded_output + \"\\nQuestion: How can I modify the function above to return Mega bytes instead?\\n\\nAnswer: Here\"\nmodel_inputs = tokenizer(prompt, return_tensors='pt')\ngeneration_output = model.generate(\n  **model_inputs,\n  past_key_values=generation_output.past_key_values,\n  max_new_tokens=60,\n  return_dict_in_generate=True\n)\ntokenizer.batch_decode(generation_output.sequences)[0][len(prompt):]\n```\n\n**Output**:\n```\n is a modified version of the function that returns Mega bytes instead.\n\ndef bytes_to_megabytes(bytes):\n   return bytes / 1024 / 1024\n\nAnswer: The function takes a number of bytes as input and returns the number of\n```\n\nGreat, no additional time is spent recomputing the same key and values for the attention layer! There is however one catch. While the required peak memory for the \\\\( \\mathbf{QK}^T \\\\) matrix is significantly reduced, holding the key-value cache in memory can become very memory expensive for long input sequences or multi-turn chat. Remember that the key-value cache needs to store the key-value vectors for all previous input vectors \\\\( \\mathbf{x}_i \\text{, for } i \\in \\{1, \\ldots, c - 1\\} \\\\) for all self-attention layers and for all attention heads.\n\nLet's compute the number of float values that need to be stored in the key-value cache for the LLM `bigcode/octocoder` that we used before.\nThe number of float values amounts to two times the sequence length times the number of attention heads times the attention head dimension and times the number of layers.\nComputing this for our LLM at a hypothetical input sequence length of 16000 gives:\n\n```python\nconfig = model.config\n2 * 16_000 * config.n_layer * config.n_head * config.n_embd // config.n_head\n```\n\n**Output**:\n```\n7864320000\n```\n\nRoughly 8 billion float values! Storing 8 billion float values in `float16` precision requires around 15 GB of RAM which is circa half as much as the model weights themselves!\nResearchers have proposed two methods that allow to significantly reduce the memory cost of storing the key-value cache, which are explored in the next subsections.\n\n#### 3.2.2 Multi-Query-Attention (MQA)\n\n[Multi-Query-Attention](https://arxiv.org/abs/1911.02150) was proposed in Noam Shazeer's *Fast Transformer Decoding: One Write-Head is All You Need* paper. As the title says, Noam found out that instead of using `n_head` key-value projections weights, one can use a single head-value projection weight pair that is shared across all attention heads without that the model's performance significantly degrades."}


created_at: 2024-08-26 20:30:03
topic: persistent://default/default/621deaf2-9359-4ac4-ada0-047176703e13
id: a1885591-e8d5-4a91-964d-62ab4155ece6
encoding: FLOAT32
metadata:
{"url": "https://huggingface.co/docs/transformers/llm_tutorial_optimization", "title": "Optimizing LLMs for Speed and Memory", "tokens": 12767, "retrieve_doc": false, "source": "transformers", "_node_content": "{\"id_\": \"a1885591-e8d5-4a91-964d-62ab4155ece6\", \"embedding\": null, \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/llm_tutorial_optimization\", \"title\": \"Optimizing LLMs for Speed and Memory\", \"tokens\": 12767, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"3d4a5be0-96a4-4cae-bb80-ec65cee94a22\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/llm_tutorial_optimization\", \"title\": \"Optimizing LLMs for Speed and Memory\", \"tokens\": 12767, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"hash\": \"bb1f2b699b61342ca13b75611df36eb9e3379ec4485edf0807dfbeb683246cf4\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"ac613e7e-f1c8-40e1-a601-600b2b493e5a\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/llm_tutorial_optimization\", \"title\": \"Optimizing LLMs for Speed and Memory\", \"tokens\": 12767, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"hash\": \"082abd1d6d8c9875ceaab67e38f08cc0924f043ff666c9ce3b7e1cc860d81116\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"34ba7d81-b813-49f3-9b34-8fac8267a8ab\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"2f9aef044376b19a83561c3b824f0b12907f2a65f86634c6467705a331caf24c\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 45857, \"end_char_idx\": 49033, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "3d4a5be0-96a4-4cae-bb80-ec65cee94a22", "doc_id": "3d4a5be0-96a4-4cae-bb80-ec65cee94a22", "ref_doc_id": "3d4a5be0-96a4-4cae-bb80-ec65cee94a22", "chroma:document": "Remember that the key-value cache needs to store the key-value vectors for all previous input vectors \\\\( \\mathbf{x}_i \\text{, for } i \\in \\{1, \\ldots, c - 1\\} \\\\) for all self-attention layers and for all attention heads.\n\nLet's compute the number of float values that need to be stored in the key-value cache for the LLM `bigcode/octocoder` that we used before.\nThe number of float values amounts to two times the sequence length times the number of attention heads times the attention head dimension and times the number of layers.\nComputing this for our LLM at a hypothetical input sequence length of 16000 gives:\n\n```python\nconfig = model.config\n2 * 16_000 * config.n_layer * config.n_head * config.n_embd // config.n_head\n```\n\n**Output**:\n```\n7864320000\n```\n\nRoughly 8 billion float values! Storing 8 billion float values in `float16` precision requires around 15 GB of RAM which is circa half as much as the model weights themselves!\nResearchers have proposed two methods that allow to significantly reduce the memory cost of storing the key-value cache, which are explored in the next subsections.\n\n#### 3.2.2 Multi-Query-Attention (MQA)\n\n[Multi-Query-Attention](https://arxiv.org/abs/1911.02150) was proposed in Noam Shazeer's *Fast Transformer Decoding: One Write-Head is All You Need* paper. As the title says, Noam found out that instead of using `n_head` key-value projections weights, one can use a single head-value projection weight pair that is shared across all attention heads without that the model's performance significantly degrades.\n\n> By using a single head-value projection weight pair, the key value vectors \\\\( \\mathbf{k}_i, \\mathbf{v}_i \\\\) have to be identical across all attention heads which in turn means that we only need to store 1 key-value projection pair in the cache instead of `n_head` ones.\n\nAs most LLMs use between 20 and 100 attention heads, MQA significantly reduces the memory consumption of the key-value cache. For the LLM used in this notebook we could therefore reduce the required memory consumption from 15 GB to less than 400 MB at an input sequence length of 16000.\n\nIn addition to memory savings, MQA also leads to improved computational efficiency as explained in the following.\nIn auto-regressive decoding, large key-value vectors need to be reloaded, concatenated with the current key-value vector pair to be then fed into the \\\\( \\mathbf{q}_c\\mathbf{K}^T \\\\) computation at every step. For auto-regressive decoding, the required memory bandwidth for the constant reloading can become a serious time bottleneck. By reducing the size of the key-value vectors less memory needs to be accessed, thus reducing the memory bandwidth bottleneck. For more detail, please have a look at [Noam's paper](https://arxiv.org/abs/1911.02150).\n\nThe important part to understand here is that reducing the number of key-value attention heads to 1 only makes sense if a key-value cache is used. The peak memory consumption of the model for a single forward pass without key-value cache stays unchanged as every attention head still has a unique query vector so that each attention head still has a different \\\\( \\mathbf{QK}^T \\\\) matrix."}


created_at: 2024-08-26 20:30:03
topic: persistent://default/default/621deaf2-9359-4ac4-ada0-047176703e13
id: 34ba7d81-b813-49f3-9b34-8fac8267a8ab
encoding: FLOAT32
metadata:
{"url": "https://huggingface.co/docs/transformers/llm_tutorial_optimization", "title": "Optimizing LLMs for Speed and Memory", "tokens": 12767, "retrieve_doc": false, "source": "transformers", "_node_content": "{\"id_\": \"34ba7d81-b813-49f3-9b34-8fac8267a8ab\", \"embedding\": null, \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/llm_tutorial_optimization\", \"title\": \"Optimizing LLMs for Speed and Memory\", \"tokens\": 12767, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"3d4a5be0-96a4-4cae-bb80-ec65cee94a22\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/llm_tutorial_optimization\", \"title\": \"Optimizing LLMs for Speed and Memory\", \"tokens\": 12767, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"hash\": \"bb1f2b699b61342ca13b75611df36eb9e3379ec4485edf0807dfbeb683246cf4\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"a1885591-e8d5-4a91-964d-62ab4155ece6\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/llm_tutorial_optimization\", \"title\": \"Optimizing LLMs for Speed and Memory\", \"tokens\": 12767, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"hash\": \"a7ba4463be8a9e8144506008bd4f51057f1c8c4ed497910b5898f6e965fbf885\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"4d04a4c8-5a86-4de3-b42d-a00ff764cc8a\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"4d0c12a767cc74b6f797ad5b803029e6b60621621d01de4b0e5e8c187795d1d1\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 47415, \"end_char_idx\": 50613, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "3d4a5be0-96a4-4cae-bb80-ec65cee94a22", "doc_id": "3d4a5be0-96a4-4cae-bb80-ec65cee94a22", "ref_doc_id": "3d4a5be0-96a4-4cae-bb80-ec65cee94a22", "chroma:document": "> By using a single head-value projection weight pair, the key value vectors \\\\( \\mathbf{k}_i, \\mathbf{v}_i \\\\) have to be identical across all attention heads which in turn means that we only need to store 1 key-value projection pair in the cache instead of `n_head` ones.\n\nAs most LLMs use between 20 and 100 attention heads, MQA significantly reduces the memory consumption of the key-value cache. For the LLM used in this notebook we could therefore reduce the required memory consumption from 15 GB to less than 400 MB at an input sequence length of 16000.\n\nIn addition to memory savings, MQA also leads to improved computational efficiency as explained in the following.\nIn auto-regressive decoding, large key-value vectors need to be reloaded, concatenated with the current key-value vector pair to be then fed into the \\\\( \\mathbf{q}_c\\mathbf{K}^T \\\\) computation at every step. For auto-regressive decoding, the required memory bandwidth for the constant reloading can become a serious time bottleneck. By reducing the size of the key-value vectors less memory needs to be accessed, thus reducing the memory bandwidth bottleneck. For more detail, please have a look at [Noam's paper](https://arxiv.org/abs/1911.02150).\n\nThe important part to understand here is that reducing the number of key-value attention heads to 1 only makes sense if a key-value cache is used. The peak memory consumption of the model for a single forward pass without key-value cache stays unchanged as every attention head still has a unique query vector so that each attention head still has a different \\\\( \\mathbf{QK}^T \\\\) matrix.\n\nMQA has seen wide adoption by the community and is now used by many of the most popular LLMs:\n\n-   [**Falcon**](https://huggingface.co/tiiuae/falcon-40b)\n-   [**PaLM**](https://arxiv.org/abs/2204.02311)\n-   [**MPT**](https://huggingface.co/mosaicml/mpt-30b)\n-   [**BLOOM**](https://huggingface.co/bigscience/bloom)\n\nAlso, the checkpoint used in this notebook - `bigcode/octocoder` - makes use of MQA.\n\n#### 3.2.3 Grouped-Query-Attention (GQA)\n\n[Grouped-Query-Attention](https://arxiv.org/abs/2305.13245), as proposed by Ainslie et al. from Google, found that using MQA can often lead to quality degradation compared to using vanilla multi-key-value head projections. The paper argues that more model performance can be kept by less drastically reducing the number of query head projection weights. Instead of using just a single key-value projection weight, `n < n_head` key-value projection weights should be used. By choosing `n` to a significantly smaller value than `n_head`, such as 2,4 or 8 almost all of the memory and speed gains from MQA can be kept while sacrificing less model capacity and thus arguably less performance.\n\nMoreover, the authors of GQA found out that existing model checkpoints can be *uptrained* to have a GQA architecture with as little as 5% of the original pre-training compute. While 5% of the original pre-training compute can still be a massive amount, GQA *uptraining* allows existing checkpoints to be useful for longer input sequences.\n\nGQA was only recently proposed which is why there is less adoption at the time of writing this notebook."}


created_at: 2024-08-26 20:30:03
topic: persistent://default/default/621deaf2-9359-4ac4-ada0-047176703e13
id: 4d04a4c8-5a86-4de3-b42d-a00ff764cc8a
encoding: FLOAT32
metadata:
{"url": "https://huggingface.co/docs/transformers/llm_tutorial_optimization", "title": "Optimizing LLMs for Speed and Memory", "tokens": 12767, "retrieve_doc": false, "source": "transformers", "_node_content": "{\"id_\": \"4d04a4c8-5a86-4de3-b42d-a00ff764cc8a\", \"embedding\": null, \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/llm_tutorial_optimization\", \"title\": \"Optimizing LLMs for Speed and Memory\", \"tokens\": 12767, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"3d4a5be0-96a4-4cae-bb80-ec65cee94a22\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/llm_tutorial_optimization\", \"title\": \"Optimizing LLMs for Speed and Memory\", \"tokens\": 12767, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"hash\": \"bb1f2b699b61342ca13b75611df36eb9e3379ec4485edf0807dfbeb683246cf4\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"34ba7d81-b813-49f3-9b34-8fac8267a8ab\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/llm_tutorial_optimization\", \"title\": \"Optimizing LLMs for Speed and Memory\", \"tokens\": 12767, \"retrieve_doc\": false, \"source\": \"transformers\"}, \"hash\": \"047ee3ed3362d8f7782526a3533928ba32db8119546628ffc11db6adbcd4cb92\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 49035, \"end_char_idx\": 51979, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "3d4a5be0-96a4-4cae-bb80-ec65cee94a22", "doc_id": "3d4a5be0-96a4-4cae-bb80-ec65cee94a22", "ref_doc_id": "3d4a5be0-96a4-4cae-bb80-ec65cee94a22", "chroma:document": "MQA has seen wide adoption by the community and is now used by many of the most popular LLMs:\n\n-   [**Falcon**](https://huggingface.co/tiiuae/falcon-40b)\n-   [**PaLM**](https://arxiv.org/abs/2204.02311)\n-   [**MPT**](https://huggingface.co/mosaicml/mpt-30b)\n-   [**BLOOM**](https://huggingface.co/bigscience/bloom)\n\nAlso, the checkpoint used in this notebook - `bigcode/octocoder` - makes use of MQA.\n\n#### 3.2.3 Grouped-Query-Attention (GQA)\n\n[Grouped-Query-Attention](https://arxiv.org/abs/2305.13245), as proposed by Ainslie et al. from Google, found that using MQA can often lead to quality degradation compared to using vanilla multi-key-value head projections. The paper argues that more model performance can be kept by less drastically reducing the number of query head projection weights. Instead of using just a single key-value projection weight, `n < n_head` key-value projection weights should be used. By choosing `n` to a significantly smaller value than `n_head`, such as 2,4 or 8 almost all of the memory and speed gains from MQA can be kept while sacrificing less model capacity and thus arguably less performance.\n\nMoreover, the authors of GQA found out that existing model checkpoints can be *uptrained* to have a GQA architecture with as little as 5% of the original pre-training compute. While 5% of the original pre-training compute can still be a massive amount, GQA *uptraining* allows existing checkpoints to be useful for longer input sequences.\n\nGQA was only recently proposed which is why there is less adoption at the time of writing this notebook.\nThe most notable application of GQA is [Llama-v2](https://huggingface.co/meta-llama/Llama-2-70b-hf).\n\n> As a conclusion, it is strongly recommended to make use of either GQA or MQA if the LLM is deployed with auto-regressive decoding and is required to handle large input sequences as is the case for example for chat.\n\n\n## Conclusion\n\nThe research community is constantly coming up with new, nifty ways to speed up inference time for ever-larger LLMs. As an example, one such promising research direction is [speculative decoding](https://arxiv.org/abs/2211.17192) where \"easy tokens\" are generated by smaller, faster language models and only \"hard tokens\" are generated by the LLM itself. Going into more detail is out of the scope of this notebook, but can be read upon in this [nice blog post](https://huggingface.co/blog/assisted-generation).\n\nThe reason massive LLMs such as GPT3/4, Llama-2-70b, Claude, PaLM can run so quickly in chat-interfaces such as [Hugging Face Chat](https://huggingface.co/chat/) or ChatGPT is to a big part thanks to the above-mentioned improvements in precision, algorithms, and architecture.\nGoing forward, accelerators such as GPUs, TPUs, etc... will only get faster and allow for more memory, but one should nevertheless always make sure to use the best available algorithms and architectures to get the most bang for your buck \ud83e\udd17"}


created_at: 2024-08-26 20:30:03
topic: persistent://default/default/621deaf2-9359-4ac4-ada0-047176703e13
id: 6e830ee2-45d7-4f42-a525-ae6d227a7a2c
encoding: FLOAT32
metadata:
{"url": "https://huggingface.co/docs/transformers/pipeline_tutorial", "title": "Pipelines for inference", "tokens": 4098, "retrieve_doc": true, "source": "transformers", "_node_content": "{\"id_\": \"6e830ee2-45d7-4f42-a525-ae6d227a7a2c\", \"embedding\": null, \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/pipeline_tutorial\", \"title\": \"Pipelines for inference\", \"tokens\": 4098, \"retrieve_doc\": true, \"source\": \"transformers\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"df04425c-3160-4924-84ae-3cad2eeea3a4\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/pipeline_tutorial\", \"title\": \"Pipelines for inference\", \"tokens\": 4098, \"retrieve_doc\": true, \"source\": \"transformers\"}, \"hash\": \"ae7a9817190d68adf284158e10204a65f5200468b94ed3ad1fe61941b821c65d\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"adcf4d47-ab0f-4778-b748-0de94b9b1c0f\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"1dd704adb7cbb386befb315b98420340a3f40715eaa79926dfda42f89f20dffc\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 0, \"end_char_idx\": 3081, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "df04425c-3160-4924-84ae-3cad2eeea3a4", "doc_id": "df04425c-3160-4924-84ae-3cad2eeea3a4", "ref_doc_id": "df04425c-3160-4924-84ae-3cad2eeea3a4", "chroma:document": "# Pipelines for inference\n\nThe [`pipeline`] makes it simple to use any model from the [Hub](https://huggingface.co/models) for inference on any language, computer vision, speech, and multimodal tasks. Even if you don't have experience with a specific modality or aren't familiar with the underlying code behind the models, you can still use them for inference with the [`pipeline`]! This tutorial will teach you to:\n\n* Use a [`pipeline`] for inference.\n* Use a specific tokenizer or model.\n* Use a [`pipeline`] for audio, vision, and multimodal tasks.\n\n<Tip>\n\nTake a look at the [`pipeline`] documentation for a complete list of supported tasks and available parameters.\n\n</Tip>\n\n## Pipeline usage\n\nWhile each task has an associated [`pipeline`], it is simpler to use the general [`pipeline`] abstraction which contains \nall the task-specific pipelines. The [`pipeline`] automatically loads a default model and a preprocessing class capable \nof inference for your task. Let's take the example of using the [`pipeline`] for automatic speech recognition (ASR), or\nspeech-to-text.\n\n\n1. Start by creating a [`pipeline`] and specify the inference task:\n\n```py\n>>> from transformers import pipeline\n\n>>> transcriber = pipeline(task=\"automatic-speech-recognition\")\n```\n\n2. Pass your input to the [`pipeline`]. In the case of speech recognition, this is an audio input file:\n\n```py\n>>> transcriber(\"https://huggingface.co/datasets/Narsil/asr_dummy/resolve/main/mlk.flac\")\n{'text': 'I HAVE A DREAM BUT ONE DAY THIS NATION WILL RISE UP LIVE UP THE TRUE MEANING OF ITS TREES'}\n```\n\nNot the result you had in mind? Check out some of the [most downloaded automatic speech recognition models](https://huggingface.co/models?pipeline_tag=automatic-speech-recognition&sort=trending) \non the Hub to see if you can get a better transcription.\n\nLet's try the [Whisper large-v2](https://huggingface.co/openai/whisper-large-v2) model from OpenAI. Whisper was released \n2 years later than Wav2Vec2, and was trained on close to 10x more data. As such, it beats Wav2Vec2 on most downstream \nbenchmarks. It also has the added benefit of predicting punctuation and casing, neither of which are possible with  \nWav2Vec2.\n\nLet's give it a try here to see how it performs:\n\n```py\n>>> transcriber = pipeline(model=\"openai/whisper-large-v2\")\n>>> transcriber(\"https://huggingface.co/datasets/Narsil/asr_dummy/resolve/main/mlk.flac\")\n{'text': ' I have a dream that one day this nation will rise up and live out the true meaning of its creed.'}\n```\n\nNow this result looks more accurate! For a deep-dive comparison on Wav2Vec2 vs Whisper, refer to the [Audio Transformers Course](https://huggingface.co/learn/audio-course/chapter5/asr_models).\nWe really encourage you to check out the Hub for models in different languages, models specialized in your field, and more.\nYou can check out and compare model results directly from your browser on the Hub to see if it fits or \nhandles corner cases better than other ones.\nAnd if you don't find a model for your use case, you can always start [training](training) your own!"}


created_at: 2024-08-26 20:30:03
topic: persistent://default/default/621deaf2-9359-4ac4-ada0-047176703e13
id: adcf4d47-ab0f-4778-b748-0de94b9b1c0f
encoding: FLOAT32
metadata:
{"url": "https://huggingface.co/docs/transformers/pipeline_tutorial", "title": "Pipelines for inference", "tokens": 4098, "retrieve_doc": true, "source": "transformers", "_node_content": "{\"id_\": \"adcf4d47-ab0f-4778-b748-0de94b9b1c0f\", \"embedding\": null, \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/pipeline_tutorial\", \"title\": \"Pipelines for inference\", \"tokens\": 4098, \"retrieve_doc\": true, \"source\": \"transformers\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"df04425c-3160-4924-84ae-3cad2eeea3a4\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/pipeline_tutorial\", \"title\": \"Pipelines for inference\", \"tokens\": 4098, \"retrieve_doc\": true, \"source\": \"transformers\"}, \"hash\": \"ae7a9817190d68adf284158e10204a65f5200468b94ed3ad1fe61941b821c65d\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"6e830ee2-45d7-4f42-a525-ae6d227a7a2c\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/pipeline_tutorial\", \"title\": \"Pipelines for inference\", \"tokens\": 4098, \"retrieve_doc\": true, \"source\": \"transformers\"}, \"hash\": \"4ec6f3d7098825a81da7be16293d164eb2817b4eace54d47eed284f784f9603d\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"37d9ec9d-a8ab-46ff-89d2-bbd7a5887342\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"35006ca7c198b75ee86aa5ac99db349e52adabda3fb962b33bd29f1e7792996d\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 1603, \"end_char_idx\": 4779, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "df04425c-3160-4924-84ae-3cad2eeea3a4", "doc_id": "df04425c-3160-4924-84ae-3cad2eeea3a4", "ref_doc_id": "df04425c-3160-4924-84ae-3cad2eeea3a4", "chroma:document": "Check out some of the [most downloaded automatic speech recognition models](https://huggingface.co/models?pipeline_tag=automatic-speech-recognition&sort=trending) \non the Hub to see if you can get a better transcription.\n\nLet's try the [Whisper large-v2](https://huggingface.co/openai/whisper-large-v2) model from OpenAI. Whisper was released \n2 years later than Wav2Vec2, and was trained on close to 10x more data. As such, it beats Wav2Vec2 on most downstream \nbenchmarks. It also has the added benefit of predicting punctuation and casing, neither of which are possible with  \nWav2Vec2.\n\nLet's give it a try here to see how it performs:\n\n```py\n>>> transcriber = pipeline(model=\"openai/whisper-large-v2\")\n>>> transcriber(\"https://huggingface.co/datasets/Narsil/asr_dummy/resolve/main/mlk.flac\")\n{'text': ' I have a dream that one day this nation will rise up and live out the true meaning of its creed.'}\n```\n\nNow this result looks more accurate! For a deep-dive comparison on Wav2Vec2 vs Whisper, refer to the [Audio Transformers Course](https://huggingface.co/learn/audio-course/chapter5/asr_models).\nWe really encourage you to check out the Hub for models in different languages, models specialized in your field, and more.\nYou can check out and compare model results directly from your browser on the Hub to see if it fits or \nhandles corner cases better than other ones.\nAnd if you don't find a model for your use case, you can always start [training](training) your own!\n\nIf you have several inputs, you can pass your input as a list:\n\n```py\ntranscriber(\n    [\n        \"https://huggingface.co/datasets/Narsil/asr_dummy/resolve/main/mlk.flac\",\n        \"https://huggingface.co/datasets/Narsil/asr_dummy/resolve/main/1.flac\",\n    ]\n)\n```\n\nPipelines are great for experimentation as switching from one model to another is trivial; however, there are some ways to optimize them for larger workloads than experimentation. See the following guides that dive into iterating over whole datasets or using pipelines in a webserver:\nof the docs:\n* [Using pipelines on a dataset](#using-pipelines-on-a-dataset)\n* [Using pipelines for a webserver](./pipeline_webserver)\n\n## Parameters\n\n[`pipeline`] supports many parameters; some are task specific, and some are general to all pipelines.\nIn general, you can specify parameters anywhere you want:\n\n```py\ntranscriber = pipeline(model=\"openai/whisper-large-v2\", my_parameter=1)\n\nout = transcriber(...)  # This will use `my_parameter=1`.\nout = transcriber(..., my_parameter=2)  # This will override and use `my_parameter=2`.\nout = transcriber(...)  # This will go back to using `my_parameter=1`.\n```\n\nLet's check out 3 important ones:\n\n### Device\n\nIf you use `device=n`, the pipeline automatically puts the model on the specified device.\nThis will work regardless of whether you are using PyTorch or Tensorflow.\n\n```py\ntranscriber = pipeline(model=\"openai/whisper-large-v2\", device=0)\n```\n\nIf the model is too large for a single GPU and you are using PyTorch, you can set `torch_dtype='float16'` to enable FP16 precision inference. Usually this would not cause significant performance drops but make sure you evaluate it on your models!"}


created_at: 2024-08-26 20:30:03
topic: persistent://default/default/621deaf2-9359-4ac4-ada0-047176703e13
id: 37d9ec9d-a8ab-46ff-89d2-bbd7a5887342
encoding: FLOAT32
metadata:
{"url": "https://huggingface.co/docs/transformers/pipeline_tutorial", "title": "Pipelines for inference", "tokens": 4098, "retrieve_doc": true, "source": "transformers", "_node_content": "{\"id_\": \"37d9ec9d-a8ab-46ff-89d2-bbd7a5887342\", \"embedding\": null, \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/pipeline_tutorial\", \"title\": \"Pipelines for inference\", \"tokens\": 4098, \"retrieve_doc\": true, \"source\": \"transformers\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"df04425c-3160-4924-84ae-3cad2eeea3a4\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/pipeline_tutorial\", \"title\": \"Pipelines for inference\", \"tokens\": 4098, \"retrieve_doc\": true, \"source\": \"transformers\"}, \"hash\": \"ae7a9817190d68adf284158e10204a65f5200468b94ed3ad1fe61941b821c65d\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"adcf4d47-ab0f-4778-b748-0de94b9b1c0f\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/pipeline_tutorial\", \"title\": \"Pipelines for inference\", \"tokens\": 4098, \"retrieve_doc\": true, \"source\": \"transformers\"}, \"hash\": \"c73b8751cf83108b607ed8d46f6ca45323903abd11f23d46bc6f5d8e7901ece3\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"01b0d65a-34b8-4a64-8592-d984d346b49d\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"f5a60559e3778ed0ebe7c7c7bc00cf888d81660b2dbc26f23d14217a76e8e30d\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 3527, \"end_char_idx\": 6805, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "df04425c-3160-4924-84ae-3cad2eeea3a4", "doc_id": "df04425c-3160-4924-84ae-3cad2eeea3a4", "ref_doc_id": "df04425c-3160-4924-84ae-3cad2eeea3a4", "chroma:document": "See the following guides that dive into iterating over whole datasets or using pipelines in a webserver:\nof the docs:\n* [Using pipelines on a dataset](#using-pipelines-on-a-dataset)\n* [Using pipelines for a webserver](./pipeline_webserver)\n\n## Parameters\n\n[`pipeline`] supports many parameters; some are task specific, and some are general to all pipelines.\nIn general, you can specify parameters anywhere you want:\n\n```py\ntranscriber = pipeline(model=\"openai/whisper-large-v2\", my_parameter=1)\n\nout = transcriber(...)  # This will use `my_parameter=1`.\nout = transcriber(..., my_parameter=2)  # This will override and use `my_parameter=2`.\nout = transcriber(...)  # This will go back to using `my_parameter=1`.\n```\n\nLet's check out 3 important ones:\n\n### Device\n\nIf you use `device=n`, the pipeline automatically puts the model on the specified device.\nThis will work regardless of whether you are using PyTorch or Tensorflow.\n\n```py\ntranscriber = pipeline(model=\"openai/whisper-large-v2\", device=0)\n```\n\nIf the model is too large for a single GPU and you are using PyTorch, you can set `torch_dtype='float16'` to enable FP16 precision inference. Usually this would not cause significant performance drops but make sure you evaluate it on your models!\n\nAlternatively, you can set `device_map=\"auto\"` to automatically \ndetermine how to load and store the model weights. Using the `device_map` argument requires the \ud83e\udd17 [Accelerate](https://huggingface.co/docs/accelerate)\npackage:\n\n```bash\npip install --upgrade accelerate\n```\n\nThe following code automatically loads and stores model weights across devices:\n\n```py\ntranscriber = pipeline(model=\"openai/whisper-large-v2\", device_map=\"auto\")\n```\n\nNote that if  `device_map=\"auto\"` is passed, there is no need to add the argument `device=device` when instantiating your `pipeline` as you may encounter some unexpected behavior!\n\n### Batch size\n\nBy default, pipelines will not batch inference for reasons explained in detail [here](https://huggingface.co/docs/transformers/main_classes/pipelines#pipeline-batching). The reason is that batching is not necessarily faster, and can actually be quite slower in some cases.\n\nBut if it works in your use case, you can use:\n\n```py\ntranscriber = pipeline(model=\"openai/whisper-large-v2\", device=0, batch_size=2)\naudio_filenames = [f\"https://huggingface.co/datasets/Narsil/asr_dummy/resolve/main/{i}.flac\" for i in range(1, 5)]\ntexts = transcriber(audio_filenames)\n```\n\nThis runs the pipeline on the 4 provided audio files, but it will pass them in batches of 2\nto the model (which is on a GPU, where batching is more likely to help) without requiring any further code from you. \nThe output should always match what you would have received without batching. It is only meant as a way to help you get more speed out of a pipeline.\n\nPipelines can also alleviate some of the complexities of batching because, for some pipelines, a single item (like a long audio file) needs to be chunked into multiple parts to be processed by a model. The pipeline performs this [*chunk batching*](./main_classes/pipelines#pipeline-chunk-batching) for you.\n\n### Task specific parameters\n\nAll tasks provide task specific parameters which allow for additional flexibility and options to help you get your job done."}


created_at: 2024-08-26 20:30:03
topic: persistent://default/default/621deaf2-9359-4ac4-ada0-047176703e13
id: 01b0d65a-34b8-4a64-8592-d984d346b49d
encoding: FLOAT32
metadata:
{"url": "https://huggingface.co/docs/transformers/pipeline_tutorial", "title": "Pipelines for inference", "tokens": 4098, "retrieve_doc": true, "source": "transformers", "_node_content": "{\"id_\": \"01b0d65a-34b8-4a64-8592-d984d346b49d\", \"embedding\": null, \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/pipeline_tutorial\", \"title\": \"Pipelines for inference\", \"tokens\": 4098, \"retrieve_doc\": true, \"source\": \"transformers\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"df04425c-3160-4924-84ae-3cad2eeea3a4\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/pipeline_tutorial\", \"title\": \"Pipelines for inference\", \"tokens\": 4098, \"retrieve_doc\": true, \"source\": \"transformers\"}, \"hash\": \"ae7a9817190d68adf284158e10204a65f5200468b94ed3ad1fe61941b821c65d\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"37d9ec9d-a8ab-46ff-89d2-bbd7a5887342\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/pipeline_tutorial\", \"title\": \"Pipelines for inference\", \"tokens\": 4098, \"retrieve_doc\": true, \"source\": \"transformers\"}, \"hash\": \"e779da1fe50b0f6f63e23a78889fdf63e5f3863577cd23a64a96f4270d5ffd05\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"fb028a24-75d7-4389-9e29-b7d07e855cf9\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"906238569b9c1ee944b4c069e3d73b3a9ef5c120b52bc819d609487d93d9aef4\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 5401, \"end_char_idx\": 6973, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "df04425c-3160-4924-84ae-3cad2eeea3a4", "doc_id": "df04425c-3160-4924-84ae-3cad2eeea3a4", "ref_doc_id": "df04425c-3160-4924-84ae-3cad2eeea3a4", "chroma:document": "### Batch size\n\nBy default, pipelines will not batch inference for reasons explained in detail [here](https://huggingface.co/docs/transformers/main_classes/pipelines#pipeline-batching). The reason is that batching is not necessarily faster, and can actually be quite slower in some cases.\n\nBut if it works in your use case, you can use:\n\n```py\ntranscriber = pipeline(model=\"openai/whisper-large-v2\", device=0, batch_size=2)\naudio_filenames = [f\"https://huggingface.co/datasets/Narsil/asr_dummy/resolve/main/{i}.flac\" for i in range(1, 5)]\ntexts = transcriber(audio_filenames)\n```\n\nThis runs the pipeline on the 4 provided audio files, but it will pass them in batches of 2\nto the model (which is on a GPU, where batching is more likely to help) without requiring any further code from you. \nThe output should always match what you would have received without batching. It is only meant as a way to help you get more speed out of a pipeline.\n\nPipelines can also alleviate some of the complexities of batching because, for some pipelines, a single item (like a long audio file) needs to be chunked into multiple parts to be processed by a model. The pipeline performs this [*chunk batching*](./main_classes/pipelines#pipeline-chunk-batching) for you.\n\n### Task specific parameters\n\nAll tasks provide task specific parameters which allow for additional flexibility and options to help you get your job done.\nFor instance, the [`transformers.AutomaticSpeechRecognitionPipeline.__call__`] method has a `return_timestamps` parameter which sounds promising for subtitling videos:"}


created_at: 2024-08-26 20:30:03
topic: persistent://default/default/621deaf2-9359-4ac4-ada0-047176703e13
id: fb028a24-75d7-4389-9e29-b7d07e855cf9
encoding: FLOAT32
metadata:
{"url": "https://huggingface.co/docs/transformers/pipeline_tutorial", "title": "Pipelines for inference", "tokens": 4098, "retrieve_doc": true, "source": "transformers", "_node_content": "{\"id_\": \"fb028a24-75d7-4389-9e29-b7d07e855cf9\", \"embedding\": null, \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/pipeline_tutorial\", \"title\": \"Pipelines for inference\", \"tokens\": 4098, \"retrieve_doc\": true, \"source\": \"transformers\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"df04425c-3160-4924-84ae-3cad2eeea3a4\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/pipeline_tutorial\", \"title\": \"Pipelines for inference\", \"tokens\": 4098, \"retrieve_doc\": true, \"source\": \"transformers\"}, \"hash\": \"ae7a9817190d68adf284158e10204a65f5200468b94ed3ad1fe61941b821c65d\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"01b0d65a-34b8-4a64-8592-d984d346b49d\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/pipeline_tutorial\", \"title\": \"Pipelines for inference\", \"tokens\": 4098, \"retrieve_doc\": true, \"source\": \"transformers\"}, \"hash\": \"b847fd1974b7b86f20b7e9957ba8c31a8125764f56381398b384b5b71c451696\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"f37fcd01-45fe-4f8e-9c9d-a9484a435c72\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"53974a720c7e1847322692775b013696d472f1ba6408014dd1f948dc0f5fc0d3\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 5401, \"end_char_idx\": 9283, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "df04425c-3160-4924-84ae-3cad2eeea3a4", "doc_id": "df04425c-3160-4924-84ae-3cad2eeea3a4", "ref_doc_id": "df04425c-3160-4924-84ae-3cad2eeea3a4", "chroma:document": "### Batch size\n\nBy default, pipelines will not batch inference for reasons explained in detail [here](https://huggingface.co/docs/transformers/main_classes/pipelines#pipeline-batching). The reason is that batching is not necessarily faster, and can actually be quite slower in some cases.\n\nBut if it works in your use case, you can use:\n\n```py\ntranscriber = pipeline(model=\"openai/whisper-large-v2\", device=0, batch_size=2)\naudio_filenames = [f\"https://huggingface.co/datasets/Narsil/asr_dummy/resolve/main/{i}.flac\" for i in range(1, 5)]\ntexts = transcriber(audio_filenames)\n```\n\nThis runs the pipeline on the 4 provided audio files, but it will pass them in batches of 2\nto the model (which is on a GPU, where batching is more likely to help) without requiring any further code from you. \nThe output should always match what you would have received without batching. It is only meant as a way to help you get more speed out of a pipeline.\n\nPipelines can also alleviate some of the complexities of batching because, for some pipelines, a single item (like a long audio file) needs to be chunked into multiple parts to be processed by a model. The pipeline performs this [*chunk batching*](./main_classes/pipelines#pipeline-chunk-batching) for you.\n\n### Task specific parameters\n\nAll tasks provide task specific parameters which allow for additional flexibility and options to help you get your job done.\nFor instance, the [`transformers.AutomaticSpeechRecognitionPipeline.__call__`] method has a `return_timestamps` parameter which sounds promising for subtitling videos:\n\n\n```py\n>>> transcriber = pipeline(model=\"openai/whisper-large-v2\", return_timestamps=True)\n>>> transcriber(\"https://huggingface.co/datasets/Narsil/asr_dummy/resolve/main/mlk.flac\")\n{'text': ' I have a dream that one day this nation will rise up and live out the true meaning of its creed.', 'chunks': [{'timestamp': (0.0, 11.88), 'text': ' I have a dream that one day this nation will rise up and live out the true meaning of its'}, {'timestamp': (11.88, 12.38), 'text': ' creed.'}]}\n```\n\nAs you can see, the model inferred the text and also outputted **when** the various sentences were pronounced.\n\nThere are many parameters available for each task, so check out each task's API reference to see what you can tinker with!\nFor instance, the [`~transformers.AutomaticSpeechRecognitionPipeline`] has a `chunk_length_s` parameter which is helpful \nfor working on really long audio files (for example, subtitling entire movies or hour-long videos) that a model typically \ncannot handle on its own:\n\n```python\n>>> transcriber = pipeline(model=\"openai/whisper-large-v2\", chunk_length_s=30)\n>>> transcriber(\"https://huggingface.co/datasets/reach-vb/random-audios/resolve/main/ted_60.wav\")\n{'text': \" So in college, I was a government major, which means I had to write a lot of papers. Now, when a normal student writes a paper, they might spread the work out a little like this. So, you know. You get started maybe a little slowly, but you get enough done in the first week that with some heavier days later on, everything gets done and things stay civil. And I would want to do that like that. That would be the plan. I would have it all ready to go, but then actually the paper would come along, and then I would kind of do this. And that would happen every single paper. But then came my 90-page senior thesis, a paper you're supposed to spend a year on. I knew for a paper like that, my normal workflow was not an option, it was way too big a project. So I planned things out and I decided I kind of had to go something like this. This is how the year would go. So I'd start off light and I'd bump it up\"}\n```\n\nIf you can't find a parameter that would really help you out, feel free to [request it](https://github.com/huggingface/transformers/issues/new?assignees=&labels=feature&template=feature-request.yml)!"}


created_at: 2024-08-26 20:30:03
topic: persistent://default/default/621deaf2-9359-4ac4-ada0-047176703e13
id: f37fcd01-45fe-4f8e-9c9d-a9484a435c72
encoding: FLOAT32
metadata:
{"url": "https://huggingface.co/docs/transformers/pipeline_tutorial", "title": "Pipelines for inference", "tokens": 4098, "retrieve_doc": true, "source": "transformers", "_node_content": "{\"id_\": \"f37fcd01-45fe-4f8e-9c9d-a9484a435c72\", \"embedding\": null, \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/pipeline_tutorial\", \"title\": \"Pipelines for inference\", \"tokens\": 4098, \"retrieve_doc\": true, \"source\": \"transformers\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"df04425c-3160-4924-84ae-3cad2eeea3a4\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/pipeline_tutorial\", \"title\": \"Pipelines for inference\", \"tokens\": 4098, \"retrieve_doc\": true, \"source\": \"transformers\"}, \"hash\": \"ae7a9817190d68adf284158e10204a65f5200468b94ed3ad1fe61941b821c65d\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"fb028a24-75d7-4389-9e29-b7d07e855cf9\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/pipeline_tutorial\", \"title\": \"Pipelines for inference\", \"tokens\": 4098, \"retrieve_doc\": true, \"source\": \"transformers\"}, \"hash\": \"489f43c116f47636b3619312b2958e4ce344e6625cc0af8db69e19eb7dfbc9d5\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"fb901ee4-d4bf-47c0-b242-7f9995c142f4\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"7cea01c2cb59d29bbddfcdf52061bcc88fc4723b90da085025312abfda05619c\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 9286, \"end_char_idx\": 12398, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "df04425c-3160-4924-84ae-3cad2eeea3a4", "doc_id": "df04425c-3160-4924-84ae-3cad2eeea3a4", "ref_doc_id": "df04425c-3160-4924-84ae-3cad2eeea3a4", "chroma:document": "## Using pipelines on a dataset\n\nThe pipeline can also run inference on a large dataset. The easiest way we recommend doing this is by using an iterator:\n\n```py\ndef data():\n    for i in range(1000):\n        yield f\"My example {i}\"\n\n\npipe = pipeline(model=\"openai-community/gpt2\", device=0)\ngenerated_characters = 0\nfor out in pipe(data()):\n    generated_characters += len(out[0][\"generated_text\"])\n```\n\nThe iterator `data()` yields each result, and the pipeline automatically\nrecognizes the input is iterable and will start fetching the data while\nit continues to process it on the GPU (this uses [DataLoader](https://pytorch.org/docs/stable/data.html#torch.utils.data.DataLoader) under the hood).\nThis is important because you don't have to allocate memory for the whole dataset\nand you can feed the GPU as fast as possible.\n\nSince batching could speed things up, it may be useful to try tuning the `batch_size` parameter here.\n\nThe simplest way to iterate over a dataset is to just load one from \ud83e\udd17 [Datasets](https://github.com/huggingface/datasets/):\n\n```py\n# KeyDataset is a util that will just output the item we're interested in.\nfrom transformers.pipelines.pt_utils import KeyDataset\nfrom datasets import load_dataset\n\npipe = pipeline(model=\"hf-internal-testing/tiny-random-wav2vec2\", device=0)\ndataset = load_dataset(\"hf-internal-testing/librispeech_asr_dummy\", \"clean\", split=\"validation[:10]\")\n\nfor out in pipe(KeyDataset(dataset, \"audio\")):\n    print(out)\n```\n\n\n## Using pipelines for a webserver\n\n<Tip>\nCreating an inference engine is a complex topic which deserves it's own\npage.\n</Tip>\n\n[Link](./pipeline_webserver)\n\n## Vision pipeline\n\nUsing a [`pipeline`] for vision tasks is practically identical.\n\nSpecify your task and pass your image to the classifier. The image can be a link, a local path or a base64-encoded image. For example, what species of cat is shown below?\n\n![pipeline-cat-chonk](https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/pipeline-cat-chonk.jpeg)\n\n```py\n>>> from transformers import pipeline\n\n>>> vision_classifier = pipeline(model=\"google/vit-base-patch16-224\")\n>>> preds = vision_classifier(\n...     images=\"https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/pipeline-cat-chonk.jpeg\"\n... )\n>>> preds = [{\"score\": round(pred[\"score\"], 4), \"label\": pred[\"label\"]} for pred in preds]\n>>> preds\n[{'score': 0.4335, 'label': 'lynx, catamount'}, {'score': 0.0348, 'label': 'cougar, puma, catamount, mountain lion, painter, panther, Felis concolor'}, {'score': 0.0324, 'label': 'snow leopard, ounce, Panthera uncia'}, {'score': 0.0239, 'label': 'Egyptian cat'}, {'score': 0.0229, 'label': 'tiger cat'}]\n```\n\n## Text pipeline\n\nUsing a [`pipeline`] for NLP tasks is practically identical.\n\n```py\n>>> from transformers import pipeline\n\n>>> # This model is a `zero-shot-classification` model.\n>>> # It will classify text, except you are free to choose any label you might imagine\n>>> classifier = pipeline(model=\"facebook/bart-large-mnli\")\n>>> classifier(\n...     \"I have a problem with my iphone that needs to be resolved asap!!"}


created_at: 2024-08-26 20:30:03
topic: persistent://default/default/621deaf2-9359-4ac4-ada0-047176703e13
id: fb901ee4-d4bf-47c0-b242-7f9995c142f4
encoding: FLOAT32
metadata:
{"url": "https://huggingface.co/docs/transformers/pipeline_tutorial", "title": "Pipelines for inference", "tokens": 4098, "retrieve_doc": true, "source": "transformers", "_node_content": "{\"id_\": \"fb901ee4-d4bf-47c0-b242-7f9995c142f4\", \"embedding\": null, \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/pipeline_tutorial\", \"title\": \"Pipelines for inference\", \"tokens\": 4098, \"retrieve_doc\": true, \"source\": \"transformers\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"df04425c-3160-4924-84ae-3cad2eeea3a4\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/pipeline_tutorial\", \"title\": \"Pipelines for inference\", \"tokens\": 4098, \"retrieve_doc\": true, \"source\": \"transformers\"}, \"hash\": \"ae7a9817190d68adf284158e10204a65f5200468b94ed3ad1fe61941b821c65d\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"f37fcd01-45fe-4f8e-9c9d-a9484a435c72\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/pipeline_tutorial\", \"title\": \"Pipelines for inference\", \"tokens\": 4098, \"retrieve_doc\": true, \"source\": \"transformers\"}, \"hash\": \"4e73b9cfcf105c7b96eb66f6d9a49e40ba1c96e9622538e90d32322556328b84\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"40959296-4a0b-4ce6-a994-af977a56d2a6\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"8b5f8f5377006f5476f9ae07e945daedd608f1482e0a1386ebb00526aac605a6\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 10879, \"end_char_idx\": 13426, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "df04425c-3160-4924-84ae-3cad2eeea3a4", "doc_id": "df04425c-3160-4924-84ae-3cad2eeea3a4", "ref_doc_id": "df04425c-3160-4924-84ae-3cad2eeea3a4", "chroma:document": "</Tip>\n\n[Link](./pipeline_webserver)\n\n## Vision pipeline\n\nUsing a [`pipeline`] for vision tasks is practically identical.\n\nSpecify your task and pass your image to the classifier. The image can be a link, a local path or a base64-encoded image. For example, what species of cat is shown below?\n\n![pipeline-cat-chonk](https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/pipeline-cat-chonk.jpeg)\n\n```py\n>>> from transformers import pipeline\n\n>>> vision_classifier = pipeline(model=\"google/vit-base-patch16-224\")\n>>> preds = vision_classifier(\n...     images=\"https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/pipeline-cat-chonk.jpeg\"\n... )\n>>> preds = [{\"score\": round(pred[\"score\"], 4), \"label\": pred[\"label\"]} for pred in preds]\n>>> preds\n[{'score': 0.4335, 'label': 'lynx, catamount'}, {'score': 0.0348, 'label': 'cougar, puma, catamount, mountain lion, painter, panther, Felis concolor'}, {'score': 0.0324, 'label': 'snow leopard, ounce, Panthera uncia'}, {'score': 0.0239, 'label': 'Egyptian cat'}, {'score': 0.0229, 'label': 'tiger cat'}]\n```\n\n## Text pipeline\n\nUsing a [`pipeline`] for NLP tasks is practically identical.\n\n```py\n>>> from transformers import pipeline\n\n>>> # This model is a `zero-shot-classification` model.\n>>> # It will classify text, except you are free to choose any label you might imagine\n>>> classifier = pipeline(model=\"facebook/bart-large-mnli\")\n>>> classifier(\n...     \"I have a problem with my iphone that needs to be resolved asap!!\",\n...     candidate_labels=[\"urgent\", \"not urgent\", \"phone\", \"tablet\", \"computer\"],\n... )\n{'sequence': 'I have a problem with my iphone that needs to be resolved asap!!', 'labels': ['urgent', 'phone', 'computer', 'not urgent', 'tablet'], 'scores': [0.504, 0.479, 0.013, 0.003, 0.002]}\n```\n\n## Multimodal pipeline\n\nThe [`pipeline`] supports more than one modality. For example, a visual question answering (VQA) task combines text and image. Feel free to use any image link you like and a question you want to ask about the image. The image can be a URL or a local path to the image.\n\nFor example, if you use this [invoice image](https://huggingface.co/spaces/impira/docquery/resolve/2359223c1837a7587402bda0f2643382a6eefeab/invoice.png):\n\n```py\n>>> from transformers import pipeline\n\n>>> vqa = pipeline(model=\"impira/layoutlm-document-qa\")\n>>> output = vqa(\n...     image=\"https://huggingface.co/spaces/impira/docquery/resolve/2359223c1837a7587402bda0f2643382a6eefeab/invoice.png\",\n...     question=\"What is the invoice number?"}


created_at: 2024-08-26 20:30:03
topic: persistent://default/default/621deaf2-9359-4ac4-ada0-047176703e13
id: 40959296-4a0b-4ce6-a994-af977a56d2a6
encoding: FLOAT32
metadata:
{"url": "https://huggingface.co/docs/transformers/pipeline_tutorial", "title": "Pipelines for inference", "tokens": 4098, "retrieve_doc": true, "source": "transformers", "_node_content": "{\"id_\": \"40959296-4a0b-4ce6-a994-af977a56d2a6\", \"embedding\": null, \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/pipeline_tutorial\", \"title\": \"Pipelines for inference\", \"tokens\": 4098, \"retrieve_doc\": true, \"source\": \"transformers\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"df04425c-3160-4924-84ae-3cad2eeea3a4\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/pipeline_tutorial\", \"title\": \"Pipelines for inference\", \"tokens\": 4098, \"retrieve_doc\": true, \"source\": \"transformers\"}, \"hash\": \"ae7a9817190d68adf284158e10204a65f5200468b94ed3ad1fe61941b821c65d\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"fb901ee4-d4bf-47c0-b242-7f9995c142f4\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/pipeline_tutorial\", \"title\": \"Pipelines for inference\", \"tokens\": 4098, \"retrieve_doc\": true, \"source\": \"transformers\"}, \"hash\": \"5f8e122a41e5994baee64ff7cd134ff134ccd8a08156b1625d28ebaf46c71008\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"2b5b4165-e434-4cf7-a535-b1428fea3121\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"8a5e444a0d80a927a08f127c9e5887e33bb56c2284b9d07af673c14ca0ee40d2\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 12061, \"end_char_idx\": 14835, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "df04425c-3160-4924-84ae-3cad2eeea3a4", "doc_id": "df04425c-3160-4924-84ae-3cad2eeea3a4", "ref_doc_id": "df04425c-3160-4924-84ae-3cad2eeea3a4", "chroma:document": "```py\n>>> from transformers import pipeline\n\n>>> # This model is a `zero-shot-classification` model.\n>>> # It will classify text, except you are free to choose any label you might imagine\n>>> classifier = pipeline(model=\"facebook/bart-large-mnli\")\n>>> classifier(\n...     \"I have a problem with my iphone that needs to be resolved asap!!\",\n...     candidate_labels=[\"urgent\", \"not urgent\", \"phone\", \"tablet\", \"computer\"],\n... )\n{'sequence': 'I have a problem with my iphone that needs to be resolved asap!!', 'labels': ['urgent', 'phone', 'computer', 'not urgent', 'tablet'], 'scores': [0.504, 0.479, 0.013, 0.003, 0.002]}\n```\n\n## Multimodal pipeline\n\nThe [`pipeline`] supports more than one modality. For example, a visual question answering (VQA) task combines text and image. Feel free to use any image link you like and a question you want to ask about the image. The image can be a URL or a local path to the image.\n\nFor example, if you use this [invoice image](https://huggingface.co/spaces/impira/docquery/resolve/2359223c1837a7587402bda0f2643382a6eefeab/invoice.png):\n\n```py\n>>> from transformers import pipeline\n\n>>> vqa = pipeline(model=\"impira/layoutlm-document-qa\")\n>>> output = vqa(\n...     image=\"https://huggingface.co/spaces/impira/docquery/resolve/2359223c1837a7587402bda0f2643382a6eefeab/invoice.png\",\n...     question=\"What is the invoice number?\",\n... )\n>>> output[0][\"score\"] = round(output[0][\"score\"], 3)\n>>> output\n[{'score': 0.425, 'answer': 'us-001', 'start': 16, 'end': 16}]\n```\n\n<Tip>\n\nTo run the example above you need to have [`pytesseract`](https://pypi.org/project/pytesseract/) installed in addition to \ud83e\udd17 Transformers:\n\n```bash\nsudo apt install -y tesseract-ocr\npip install pytesseract\n```\n\n</Tip>\n\n## Using `pipeline` on large models with \ud83e\udd17 `accelerate`:\n\nYou can easily run `pipeline` on large models using \ud83e\udd17 `accelerate`! First make sure you have installed `accelerate` with `pip install accelerate`. \n\nFirst load your model using `device_map=\"auto\"`! We will use `facebook/opt-1.3b` for our example.\n\n```py\n# pip install accelerate\nimport torch\nfrom transformers import pipeline\n\npipe = pipeline(model=\"facebook/opt-1.3b\", torch_dtype=torch.bfloat16, device_map=\"auto\")\noutput = pipe(\"This is a cool example!\", do_sample=True, top_p=0.95)\n```\n\nYou can also pass 8-bit loaded models if you install `bitsandbytes` and add the argument `load_in_8bit=True`\n\n```py\n# pip install accelerate bitsandbytes\nimport torch\nfrom transformers import pipeline\n\npipe = pipeline(model=\"facebook/opt-1.3b\", device_map=\"auto\", model_kwargs={\"load_in_8bit\": True})\noutput = pipe(\"This is a cool example!\", do_sample=True, top_p=0.95)\n```\n\nNote that you can replace the checkpoint with any Hugging Face model that supports large model loading, such as BLOOM."}


created_at: 2024-08-26 20:30:03
topic: persistent://default/default/621deaf2-9359-4ac4-ada0-047176703e13
id: 2b5b4165-e434-4cf7-a535-b1428fea3121
encoding: FLOAT32
metadata:
{"url": "https://huggingface.co/docs/transformers/pipeline_tutorial", "title": "Pipelines for inference", "tokens": 4098, "retrieve_doc": true, "source": "transformers", "_node_content": "{\"id_\": \"2b5b4165-e434-4cf7-a535-b1428fea3121\", \"embedding\": null, \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/pipeline_tutorial\", \"title\": \"Pipelines for inference\", \"tokens\": 4098, \"retrieve_doc\": true, \"source\": \"transformers\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"df04425c-3160-4924-84ae-3cad2eeea3a4\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/pipeline_tutorial\", \"title\": \"Pipelines for inference\", \"tokens\": 4098, \"retrieve_doc\": true, \"source\": \"transformers\"}, \"hash\": \"ae7a9817190d68adf284158e10204a65f5200468b94ed3ad1fe61941b821c65d\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"40959296-4a0b-4ce6-a994-af977a56d2a6\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/pipeline_tutorial\", \"title\": \"Pipelines for inference\", \"tokens\": 4098, \"retrieve_doc\": true, \"source\": \"transformers\"}, \"hash\": \"a7d798c9ad0a2d66a34a485cd92855e860df282a1057440de9b9c60447215c2d\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 13426, \"end_char_idx\": 16068, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "df04425c-3160-4924-84ae-3cad2eeea3a4", "doc_id": "df04425c-3160-4924-84ae-3cad2eeea3a4", "ref_doc_id": "df04425c-3160-4924-84ae-3cad2eeea3a4", "chroma:document": "\",\n... )\n>>> output[0][\"score\"] = round(output[0][\"score\"], 3)\n>>> output\n[{'score': 0.425, 'answer': 'us-001', 'start': 16, 'end': 16}]\n```\n\n<Tip>\n\nTo run the example above you need to have [`pytesseract`](https://pypi.org/project/pytesseract/) installed in addition to \ud83e\udd17 Transformers:\n\n```bash\nsudo apt install -y tesseract-ocr\npip install pytesseract\n```\n\n</Tip>\n\n## Using `pipeline` on large models with \ud83e\udd17 `accelerate`:\n\nYou can easily run `pipeline` on large models using \ud83e\udd17 `accelerate`! First make sure you have installed `accelerate` with `pip install accelerate`. \n\nFirst load your model using `device_map=\"auto\"`! We will use `facebook/opt-1.3b` for our example.\n\n```py\n# pip install accelerate\nimport torch\nfrom transformers import pipeline\n\npipe = pipeline(model=\"facebook/opt-1.3b\", torch_dtype=torch.bfloat16, device_map=\"auto\")\noutput = pipe(\"This is a cool example!\", do_sample=True, top_p=0.95)\n```\n\nYou can also pass 8-bit loaded models if you install `bitsandbytes` and add the argument `load_in_8bit=True`\n\n```py\n# pip install accelerate bitsandbytes\nimport torch\nfrom transformers import pipeline\n\npipe = pipeline(model=\"facebook/opt-1.3b\", device_map=\"auto\", model_kwargs={\"load_in_8bit\": True})\noutput = pipe(\"This is a cool example!\", do_sample=True, top_p=0.95)\n```\n\nNote that you can replace the checkpoint with any Hugging Face model that supports large model loading, such as BLOOM.\n\n## Creating web demos from pipelines with `gradio`\n\nPipelines are automatically supported in [Gradio](https://github.com/gradio-app/gradio/), a library that makes creating beautiful and user-friendly machine learning apps on the web a breeze. First, make sure you have Gradio installed:\n\n```\npip install gradio\n```\n\nThen, you can create a web demo around an image classification pipeline (or any other pipeline) in a single line of code by calling Gradio's [`Interface.from_pipeline`](https://www.gradio.app/docs/interface#interface-from-pipeline) function to launch the pipeline. This creates an intuitive drag-and-drop interface in your browser:\n\n```py\nfrom transformers import pipeline\nimport gradio as gr\n\npipe = pipeline(\"image-classification\", model=\"google/vit-base-patch16-224\")\n\ngr.Interface.from_pipeline(pipe).launch()\n```\n\n\n![](https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/transformers/panda-classification.png)\n\nBy default, the web demo runs on a local server. If you'd like to share it with others, you can generate a temporary public\nlink by setting `share=True` in `launch()`. You can also host your demo on [Hugging Face Spaces](https://huggingface.co/spaces) for a permanent link."}


created_at: 2024-08-26 20:30:03
topic: persistent://default/default/621deaf2-9359-4ac4-ada0-047176703e13
id: 6e8eb2a1-22b3-455a-9b16-e62bd19f8c25
encoding: FLOAT32
metadata:
{"url": "https://huggingface.co/docs/transformers/fsdp", "title": "Fully Sharded Data Parallel", "tokens": 1846, "retrieve_doc": true, "source": "transformers", "_node_content": "{\"id_\": \"6e8eb2a1-22b3-455a-9b16-e62bd19f8c25\", \"embedding\": null, \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/fsdp\", \"title\": \"Fully Sharded Data Parallel\", \"tokens\": 1846, \"retrieve_doc\": true, \"source\": \"transformers\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"d6254beb-d9ba-4eae-bcf3-cf88000fa790\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/fsdp\", \"title\": \"Fully Sharded Data Parallel\", \"tokens\": 1846, \"retrieve_doc\": true, \"source\": \"transformers\"}, \"hash\": \"cb2207a9ae7a79718ccb6b00018b0acb9220d93bf7ed5ab0e1aa3e37b3035d8c\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"50eb465f-3887-4e3e-b2b4-5427992a29c3\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"b94c674cd476a3b4515be786a34ddac8e3d7086a8eb69d870d387871ae81e59d\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 0, \"end_char_idx\": 3391, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "d6254beb-d9ba-4eae-bcf3-cf88000fa790", "doc_id": "d6254beb-d9ba-4eae-bcf3-cf88000fa790", "ref_doc_id": "d6254beb-d9ba-4eae-bcf3-cf88000fa790", "chroma:document": "# Fully Sharded Data Parallel\n\n[Fully Sharded Data Parallel (FSDP)](https://pytorch.org/blog/introducing-pytorch-fully-sharded-data-parallel-api/) is a data parallel method that shards a model's parameters, gradients and optimizer states across the number of available GPUs (also called workers or *rank*). Unlike [DistributedDataParallel (DDP)](https://pytorch.org/docs/stable/generated/torch.nn.parallel.DistributedDataParallel.html), FSDP reduces memory-usage because a model is replicated on each GPU. This improves GPU memory-efficiency and allows you to train much larger models on fewer GPUs. FSDP is integrated with the Accelerate, a library for easily managing training in distributed environments, which means it is available for use from the [`Trainer`] class.\n\nBefore you start, make sure Accelerate is installed and at least PyTorch 2.1.0 or newer.\n\n```bash\npip install accelerate\n```\n\n## FSDP configuration\n\nTo start, run the [`accelerate config`](https://huggingface.co/docs/accelerate/package_reference/cli#accelerate-config) command to create a configuration file for your training environment. Accelerate uses this configuration file to automatically setup the correct training environment based on your selected training options in `accelerate config`.\n\n```bash\naccelerate config\n```\n\nWhen you run `accelerate config`, you'll be prompted with a series of options to configure your training environment. This section covers some of the most important FSDP options. To learn more about the other available FSDP options, take a look at the [fsdp_config](https://huggingface.co/docs/transformers/main_classes/trainer#transformers.TrainingArguments.fsdp_config) parameters.\n\n### Sharding strategy\n\nFSDP offers a number of sharding strategies to select from:\n\n* `FULL_SHARD` - shards model parameters, gradients and optimizer states across workers; select `1` for this option\n* `SHARD_GRAD_OP`- shard gradients and optimizer states across workers; select `2` for this option\n* `NO_SHARD` - don't shard anything (this is equivalent to DDP); select `3` for this option\n* `HYBRID_SHARD` - shard model parameters, gradients and optimizer states within each worker where each worker also has a full copy; select `4` for this option\n* `HYBRID_SHARD_ZERO2` - shard gradients and optimizer states within each worker where each worker also has a full copy; select `5` for this option\n\nThis is enabled by the `fsdp_sharding_strategy` flag.\n\n### CPU offload\n\nYou could also offload parameters and gradients when they are not in use to the CPU to save even more GPU memory and help you fit large models where even FSDP may not be sufficient. This is enabled by setting `fsdp_offload_params: true` when running `accelerate config`.\n\n### Wrapping policy\n\nFSDP is applied by wrapping each layer in the network. The wrapping is usually applied in a nested way where the full weights are discarded after each forward pass to save memory for use in the next layer. The *auto wrapping* policy is the simplest way to implement this and you don't need to change any code. You should select `fsdp_auto_wrap_policy: TRANSFORMER_BASED_WRAP` to wrap a Transformer layer and `fsdp_transformer_layer_cls_to_wrap` to specify which layer to wrap (for example `BertLayer`).\n\nOtherwise, you can choose a size-based wrapping policy where FSDP is applied to a layer if it exceeds a certain number of parameters."}


created_at: 2024-08-26 20:30:03
topic: persistent://default/default/621deaf2-9359-4ac4-ada0-047176703e13
id: 50eb465f-3887-4e3e-b2b4-5427992a29c3
encoding: FLOAT32
metadata:
{"url": "https://huggingface.co/docs/transformers/fsdp", "title": "Fully Sharded Data Parallel", "tokens": 1846, "retrieve_doc": true, "source": "transformers", "_node_content": "{\"id_\": \"50eb465f-3887-4e3e-b2b4-5427992a29c3\", \"embedding\": null, \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/fsdp\", \"title\": \"Fully Sharded Data Parallel\", \"tokens\": 1846, \"retrieve_doc\": true, \"source\": \"transformers\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"d6254beb-d9ba-4eae-bcf3-cf88000fa790\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/fsdp\", \"title\": \"Fully Sharded Data Parallel\", \"tokens\": 1846, \"retrieve_doc\": true, \"source\": \"transformers\"}, \"hash\": \"cb2207a9ae7a79718ccb6b00018b0acb9220d93bf7ed5ab0e1aa3e37b3035d8c\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"6e8eb2a1-22b3-455a-9b16-e62bd19f8c25\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/fsdp\", \"title\": \"Fully Sharded Data Parallel\", \"tokens\": 1846, \"retrieve_doc\": true, \"source\": \"transformers\"}, \"hash\": \"5358aa4846b4e4f0f88e61228f619d9194e5e6079802685015e8613be6da0a1a\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"34f2f2e5-8d60-44d2-97b6-4e44a489e4b0\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"995373af9bd5278874c2cbff77d98dbef8eac496d636076b8e576e48d19c86f6\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 1689, \"end_char_idx\": 4594, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "d6254beb-d9ba-4eae-bcf3-cf88000fa790", "doc_id": "d6254beb-d9ba-4eae-bcf3-cf88000fa790", "ref_doc_id": "d6254beb-d9ba-4eae-bcf3-cf88000fa790", "chroma:document": "### Sharding strategy\n\nFSDP offers a number of sharding strategies to select from:\n\n* `FULL_SHARD` - shards model parameters, gradients and optimizer states across workers; select `1` for this option\n* `SHARD_GRAD_OP`- shard gradients and optimizer states across workers; select `2` for this option\n* `NO_SHARD` - don't shard anything (this is equivalent to DDP); select `3` for this option\n* `HYBRID_SHARD` - shard model parameters, gradients and optimizer states within each worker where each worker also has a full copy; select `4` for this option\n* `HYBRID_SHARD_ZERO2` - shard gradients and optimizer states within each worker where each worker also has a full copy; select `5` for this option\n\nThis is enabled by the `fsdp_sharding_strategy` flag.\n\n### CPU offload\n\nYou could also offload parameters and gradients when they are not in use to the CPU to save even more GPU memory and help you fit large models where even FSDP may not be sufficient. This is enabled by setting `fsdp_offload_params: true` when running `accelerate config`.\n\n### Wrapping policy\n\nFSDP is applied by wrapping each layer in the network. The wrapping is usually applied in a nested way where the full weights are discarded after each forward pass to save memory for use in the next layer. The *auto wrapping* policy is the simplest way to implement this and you don't need to change any code. You should select `fsdp_auto_wrap_policy: TRANSFORMER_BASED_WRAP` to wrap a Transformer layer and `fsdp_transformer_layer_cls_to_wrap` to specify which layer to wrap (for example `BertLayer`).\n\nOtherwise, you can choose a size-based wrapping policy where FSDP is applied to a layer if it exceeds a certain number of parameters. This is enabled by setting `fsdp_wrap_policy: SIZE_BASED_WRAP` and `min_num_param` to the desired size threshold.\n\n### Checkpointing\n\nIntermediate checkpoints should be saved with `fsdp_state_dict_type: SHARDED_STATE_DICT` because saving the full state dict with CPU offloading on rank 0 takes a lot of time and often results in `NCCL Timeout` errors due to indefinite hanging during broadcasting. You can resume training with the sharded state dicts with the [`~accelerate.Accelerator.load_state`]` method.\n\n```py\n# directory containing checkpoints\naccelerator.load_state(\"ckpt\")\n```\n\nHowever, when training ends, you want to save the full state dict because sharded state dict is only compatible with FSDP.\n\n```py\nif trainer.is_fsdp_enabled:\n    trainer.accelerator.state.fsdp_plugin.set_state_dict_type(\"FULL_STATE_DICT\")\n\ntrainer.save_model(script_args.output_dir)\n```\n\n### TPU\n\n[PyTorch XLA](https://pytorch.org/xla/release/2.1/index.html) supports FSDP training for TPUs and it can be enabled by modifying the FSDP configuration file generated by `accelerate config`. In addition to the sharding strategies and wrapping options specified above, you can add the parameters shown below to the file."}


created_at: 2024-08-26 20:30:03
topic: persistent://default/default/621deaf2-9359-4ac4-ada0-047176703e13
id: 34f2f2e5-8d60-44d2-97b6-4e44a489e4b0
encoding: FLOAT32
metadata:
{"url": "https://huggingface.co/docs/transformers/fsdp", "title": "Fully Sharded Data Parallel", "tokens": 1846, "retrieve_doc": true, "source": "transformers", "_node_content": "{\"id_\": \"34f2f2e5-8d60-44d2-97b6-4e44a489e4b0\", \"embedding\": null, \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/fsdp\", \"title\": \"Fully Sharded Data Parallel\", \"tokens\": 1846, \"retrieve_doc\": true, \"source\": \"transformers\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"d6254beb-d9ba-4eae-bcf3-cf88000fa790\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/fsdp\", \"title\": \"Fully Sharded Data Parallel\", \"tokens\": 1846, \"retrieve_doc\": true, \"source\": \"transformers\"}, \"hash\": \"cb2207a9ae7a79718ccb6b00018b0acb9220d93bf7ed5ab0e1aa3e37b3035d8c\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"50eb465f-3887-4e3e-b2b4-5427992a29c3\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/fsdp\", \"title\": \"Fully Sharded Data Parallel\", \"tokens\": 1846, \"retrieve_doc\": true, \"source\": \"transformers\"}, \"hash\": \"f9c8bbf0169d5cc7e26d0d9378e0ebbf493768ea27f094ae17b33802b3ab0200\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"8623e95f-2902-4b67-8643-1ce99bb98438\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"68326477b8403a364c97ff227645ebda0035518ed2e529d191a0c2506fe097c7\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 2960, \"end_char_idx\": 6014, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "d6254beb-d9ba-4eae-bcf3-cf88000fa790", "doc_id": "d6254beb-d9ba-4eae-bcf3-cf88000fa790", "ref_doc_id": "d6254beb-d9ba-4eae-bcf3-cf88000fa790", "chroma:document": "The *auto wrapping* policy is the simplest way to implement this and you don't need to change any code. You should select `fsdp_auto_wrap_policy: TRANSFORMER_BASED_WRAP` to wrap a Transformer layer and `fsdp_transformer_layer_cls_to_wrap` to specify which layer to wrap (for example `BertLayer`).\n\nOtherwise, you can choose a size-based wrapping policy where FSDP is applied to a layer if it exceeds a certain number of parameters. This is enabled by setting `fsdp_wrap_policy: SIZE_BASED_WRAP` and `min_num_param` to the desired size threshold.\n\n### Checkpointing\n\nIntermediate checkpoints should be saved with `fsdp_state_dict_type: SHARDED_STATE_DICT` because saving the full state dict with CPU offloading on rank 0 takes a lot of time and often results in `NCCL Timeout` errors due to indefinite hanging during broadcasting. You can resume training with the sharded state dicts with the [`~accelerate.Accelerator.load_state`]` method.\n\n```py\n# directory containing checkpoints\naccelerator.load_state(\"ckpt\")\n```\n\nHowever, when training ends, you want to save the full state dict because sharded state dict is only compatible with FSDP.\n\n```py\nif trainer.is_fsdp_enabled:\n    trainer.accelerator.state.fsdp_plugin.set_state_dict_type(\"FULL_STATE_DICT\")\n\ntrainer.save_model(script_args.output_dir)\n```\n\n### TPU\n\n[PyTorch XLA](https://pytorch.org/xla/release/2.1/index.html) supports FSDP training for TPUs and it can be enabled by modifying the FSDP configuration file generated by `accelerate config`. In addition to the sharding strategies and wrapping options specified above, you can add the parameters shown below to the file.\n\n```yaml\nxla: True # must be set to True to enable PyTorch/XLA\nxla_fsdp_settings: # XLA-specific FSDP parameters\nxla_fsdp_grad_ckpt: True # use gradient checkpointing\n```\n\nThe [`xla_fsdp_settings`](https://github.com/pytorch/xla/blob/2e6e183e0724818f137c8135b34ef273dea33318/torch_xla/distributed/fsdp/xla_fully_sharded_data_parallel.py#L128) allow you to configure additional XLA-specific parameters for FSDP.\n\n## Launch training\n\nAn example FSDP configuration file may look like:\n\n```yaml\ncompute_environment: LOCAL_MACHINE\ndebug: false\ndistributed_type: FSDP\ndowncast_bf16: 'no'\nfsdp_config:\n  fsdp_auto_wrap_policy: TRANSFORMER_BASED_WRAP\n  fsdp_backward_prefetch_policy: BACKWARD_PRE\n  fsdp_cpu_ram_efficient_loading: true\n  fsdp_forward_prefetch: false\n  fsdp_offload_params: true\n  fsdp_sharding_strategy: 1\n  fsdp_state_dict_type: SHARDED_STATE_DICT\n  fsdp_sync_module_states: true\n  fsdp_transformer_layer_cls_to_wrap: BertLayer\n  fsdp_use_orig_params: true\nmachine_rank: 0\nmain_training_function: main\nmixed_precision: bf16\nnum_machines: 1\nnum_processes: 2\nrdzv_backend: static\nsame_network: true\ntpu_env: []\ntpu_use_cluster: false\ntpu_use_sudo: false\nuse_cpu: false\n```\n\nTo launch training, run the [`accelerate launch`](https://huggingface.co/docs/accelerate/package_reference/cli#accelerate-launch) command and it'll automatically use the configuration file you previously created with `accelerate config`."}


created_at: 2024-08-26 20:30:03
topic: persistent://default/default/621deaf2-9359-4ac4-ada0-047176703e13
id: 8623e95f-2902-4b67-8643-1ce99bb98438
encoding: FLOAT32
metadata:
{"url": "https://huggingface.co/docs/transformers/fsdp", "title": "Fully Sharded Data Parallel", "tokens": 1846, "retrieve_doc": true, "source": "transformers", "_node_content": "{\"id_\": \"8623e95f-2902-4b67-8643-1ce99bb98438\", \"embedding\": null, \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/fsdp\", \"title\": \"Fully Sharded Data Parallel\", \"tokens\": 1846, \"retrieve_doc\": true, \"source\": \"transformers\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"d6254beb-d9ba-4eae-bcf3-cf88000fa790\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/fsdp\", \"title\": \"Fully Sharded Data Parallel\", \"tokens\": 1846, \"retrieve_doc\": true, \"source\": \"transformers\"}, \"hash\": \"cb2207a9ae7a79718ccb6b00018b0acb9220d93bf7ed5ab0e1aa3e37b3035d8c\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"34f2f2e5-8d60-44d2-97b6-4e44a489e4b0\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/fsdp\", \"title\": \"Fully Sharded Data Parallel\", \"tokens\": 1846, \"retrieve_doc\": true, \"source\": \"transformers\"}, \"hash\": \"7e9bf19819b85d80811b833a295f4992d78fa07b70d92c374253c1bc0aa23f70\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 5007, \"end_char_idx\": 6981, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "d6254beb-d9ba-4eae-bcf3-cf88000fa790", "doc_id": "d6254beb-d9ba-4eae-bcf3-cf88000fa790", "ref_doc_id": "d6254beb-d9ba-4eae-bcf3-cf88000fa790", "chroma:document": "## Launch training\n\nAn example FSDP configuration file may look like:\n\n```yaml\ncompute_environment: LOCAL_MACHINE\ndebug: false\ndistributed_type: FSDP\ndowncast_bf16: 'no'\nfsdp_config:\n  fsdp_auto_wrap_policy: TRANSFORMER_BASED_WRAP\n  fsdp_backward_prefetch_policy: BACKWARD_PRE\n  fsdp_cpu_ram_efficient_loading: true\n  fsdp_forward_prefetch: false\n  fsdp_offload_params: true\n  fsdp_sharding_strategy: 1\n  fsdp_state_dict_type: SHARDED_STATE_DICT\n  fsdp_sync_module_states: true\n  fsdp_transformer_layer_cls_to_wrap: BertLayer\n  fsdp_use_orig_params: true\nmachine_rank: 0\nmain_training_function: main\nmixed_precision: bf16\nnum_machines: 1\nnum_processes: 2\nrdzv_backend: static\nsame_network: true\ntpu_env: []\ntpu_use_cluster: false\ntpu_use_sudo: false\nuse_cpu: false\n```\n\nTo launch training, run the [`accelerate launch`](https://huggingface.co/docs/accelerate/package_reference/cli#accelerate-launch) command and it'll automatically use the configuration file you previously created with `accelerate config`.\n\n```bash\naccelerate launch my-trainer-script.py\n```\n\n```bash\naccelerate launch --fsdp=\"full shard\" --fsdp_config=\"path/to/fsdp_config/ my-trainer-script.py\n```\n\n## Next steps\n\nFSDP can be a powerful tool for training really large models and you have access to more than one GPU or TPU. By sharding the model parameters, optimizer and gradient states, and even offloading them to the CPU when they're inactive, FSDP can reduce the high cost of large-scale training. If you're interested in learning more, the following may be helpful:\n\n* Follow along with the more in-depth Accelerate guide for [FSDP](https://huggingface.co/docs/accelerate/usage_guides/fsdp).\n* Read the [Introducing PyTorch Fully Sharded Data Parallel (FSDP) API](https://pytorch.org/blog/introducing-pytorch-fully-sharded-data-parallel-api/) blog post.\n* Read the [Scaling PyTorch models on Cloud TPUs with FSDP](https://pytorch.org/blog/scaling-pytorch-models-on-cloud-tpus-with-fsdp/) blog post."}


created_at: 2024-08-26 20:30:03
topic: persistent://default/default/621deaf2-9359-4ac4-ada0-047176703e13
id: 6d25324e-8dc1-48c0-a553-73b2a65f6dc0
encoding: FLOAT32
metadata:
{"url": "https://huggingface.co/docs/transformers/model_summary", "title": "The Transformer model family", "tokens": 4019, "retrieve_doc": true, "source": "transformers", "_node_content": "{\"id_\": \"6d25324e-8dc1-48c0-a553-73b2a65f6dc0\", \"embedding\": null, \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/model_summary\", \"title\": \"The Transformer model family\", \"tokens\": 4019, \"retrieve_doc\": true, \"source\": \"transformers\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"fd6ed4d3-f1ca-498d-9c74-7a5d84385e19\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/model_summary\", \"title\": \"The Transformer model family\", \"tokens\": 4019, \"retrieve_doc\": true, \"source\": \"transformers\"}, \"hash\": \"8cead54d1f52c4d818c9192529c1a4c2c648d344c5ad270063818d92463dd149\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"212cc8f8-8054-486a-a6fe-7465fe4fc367\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"510d17991dbb4867cfe0febee037598b0c6759fe2ee5bbfef62f54d206f7d9f2\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 0, \"end_char_idx\": 3129, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "fd6ed4d3-f1ca-498d-9c74-7a5d84385e19", "doc_id": "fd6ed4d3-f1ca-498d-9c74-7a5d84385e19", "ref_doc_id": "fd6ed4d3-f1ca-498d-9c74-7a5d84385e19", "chroma:document": "# The Transformer model family\n\nSince its introduction in 2017, the [original Transformer](https://arxiv.org/abs/1706.03762) model (see the [Annotated Transformer](http://nlp.seas.harvard.edu/2018/04/03/attention.html) blog post for a gentle technical introduction) has inspired many new and exciting models that extend beyond natural language processing (NLP) tasks. There are models for [predicting the folded structure of proteins](https://huggingface.co/blog/deep-learning-with-proteins), [training a cheetah to run](https://huggingface.co/blog/train-decision-transformers), and [time series forecasting](https://huggingface.co/blog/time-series-transformers). With so many Transformer variants available, it can be easy to miss the bigger picture. What all these models have in common is they're based on the original Transformer architecture. Some models only use the encoder or decoder, while others use both. This provides a useful taxonomy to categorize and examine the high-level differences within models in the Transformer family, and it'll help you understand Transformers you haven't encountered before.\n\nIf you aren't familiar with the original Transformer model or need a refresher, check out the [How do Transformers work](https://huggingface.co/course/chapter1/4?fw=pt) chapter from the Hugging Face course.\n\n<div align=\"center\">\n    <iframe width=\"560\" height=\"315\" src=\"https://www.youtube.com/embed/H39Z_720T5s\" title=\"YouTube video player\"\n    frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope;\n    picture-in-picture\" allowfullscreen></iframe>\n</div>\n\n## Computer vision\n\n<iframe style=\"border: 1px solid rgba(0, 0, 0, 0.1);\" width=\"1000\" height=\"450\" src=\"https://www.figma.com/embed?embed_host=share&url=https%3A%2F%2Fwww.figma.com%2Ffile%2FacQBpeFBVvrDUlzFlkejoz%2FModelscape-timeline%3Fnode-id%3D0%253A1%26t%3Dm0zJ7m2BQ9oe0WtO-1\" allowfullscreen></iframe> \n\n### Convolutional network\n\nFor a long time, convolutional networks (CNNs) were the dominant paradigm for computer vision tasks until the [Vision Transformer](https://arxiv.org/abs/2010.11929) demonstrated its scalability and efficiency. Even then, some of a CNN's best qualities, like translation invariance, are so powerful (especially for certain tasks) that some Transformers incorporate convolutions in their architecture. [ConvNeXt](model_doc/convnext) flipped this exchange around and incorporated design choices from Transformers to modernize a CNN. For example, ConvNeXt uses non-overlapping sliding windows to patchify an image and a larger kernel to increase its global receptive field. ConvNeXt also makes several layer design choices to be more memory-efficient and improve performance, so it competes favorably with Transformers!\n\n### Encoder[[cv-encoder]]\n\nThe [Vision Transformer (ViT)](model_doc/vit) opened the door to computer vision tasks without convolutions. ViT uses a standard Transformer encoder, but its main breakthrough was how it treated an image. It splits an image into fixed-size patches and uses them to create an embedding, just like how a sentence is split into tokens."}


created_at: 2024-08-26 20:30:03
topic: persistent://default/default/621deaf2-9359-4ac4-ada0-047176703e13
id: 212cc8f8-8054-486a-a6fe-7465fe4fc367
encoding: FLOAT32
metadata:
{"url": "https://huggingface.co/docs/transformers/model_summary", "title": "The Transformer model family", "tokens": 4019, "retrieve_doc": true, "source": "transformers", "_node_content": "{\"id_\": \"212cc8f8-8054-486a-a6fe-7465fe4fc367\", \"embedding\": null, \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/model_summary\", \"title\": \"The Transformer model family\", \"tokens\": 4019, \"retrieve_doc\": true, \"source\": \"transformers\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"fd6ed4d3-f1ca-498d-9c74-7a5d84385e19\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/model_summary\", \"title\": \"The Transformer model family\", \"tokens\": 4019, \"retrieve_doc\": true, \"source\": \"transformers\"}, \"hash\": \"8cead54d1f52c4d818c9192529c1a4c2c648d344c5ad270063818d92463dd149\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"6d25324e-8dc1-48c0-a553-73b2a65f6dc0\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/model_summary\", \"title\": \"The Transformer model family\", \"tokens\": 4019, \"retrieve_doc\": true, \"source\": \"transformers\"}, \"hash\": \"0e5d6f759cdb5d41cda3b0f2cf9742049a1c02704908bb7610bfb75a42c6d29c\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"81c63364-e285-4150-80bc-8e628f013687\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"f9123e30781ced80dc6cd7e0a629ed3208b2e25e111da26e24d04c0c51a76d8e\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 2163, \"end_char_idx\": 5725, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "fd6ed4d3-f1ca-498d-9c74-7a5d84385e19", "doc_id": "fd6ed4d3-f1ca-498d-9c74-7a5d84385e19", "ref_doc_id": "fd6ed4d3-f1ca-498d-9c74-7a5d84385e19", "chroma:document": "Even then, some of a CNN's best qualities, like translation invariance, are so powerful (especially for certain tasks) that some Transformers incorporate convolutions in their architecture. [ConvNeXt](model_doc/convnext) flipped this exchange around and incorporated design choices from Transformers to modernize a CNN. For example, ConvNeXt uses non-overlapping sliding windows to patchify an image and a larger kernel to increase its global receptive field. ConvNeXt also makes several layer design choices to be more memory-efficient and improve performance, so it competes favorably with Transformers!\n\n### Encoder[[cv-encoder]]\n\nThe [Vision Transformer (ViT)](model_doc/vit) opened the door to computer vision tasks without convolutions. ViT uses a standard Transformer encoder, but its main breakthrough was how it treated an image. It splits an image into fixed-size patches and uses them to create an embedding, just like how a sentence is split into tokens. ViT capitalized on the Transformers' efficient architecture to demonstrate competitive results with the CNNs at the time while requiring fewer resources to train. ViT was soon followed by other vision models that could also handle dense vision tasks like segmentation as well as detection.\n\nOne of these models is the [Swin](model_doc/swin) Transformer. It builds hierarchical feature maps (like a CNN \ud83d\udc40 and unlike ViT) from smaller-sized patches and merges them with neighboring patches in deeper layers. Attention is only computed within a local window, and the window is shifted between attention layers to create connections to help the model learn better. Since the Swin Transformer can produce hierarchical feature maps, it is a good candidate for dense prediction tasks like segmentation and detection. The [SegFormer](model_doc/segformer) also uses a Transformer encoder to build hierarchical feature maps, but it adds a simple multilayer perceptron (MLP) decoder on top to combine all the feature maps and make a prediction.\n\nOther vision models, like BeIT and ViTMAE, drew inspiration from BERT's pretraining objective. [BeIT](model_doc/beit) is pretrained by *masked image modeling (MIM)*; the image patches are randomly masked, and the image is also tokenized into visual tokens. BeIT is trained to predict the visual tokens corresponding to the masked patches. [ViTMAE](model_doc/vitmae) has a similar pretraining objective, except it must predict the pixels instead of visual tokens. What's unusual is 75% of the image patches are masked! The decoder reconstructs the pixels from the masked tokens and encoded patches. After pretraining, the decoder is thrown away, and the encoder is ready to be used in downstream tasks.\n\n### Decoder[[cv-decoder]]\n\nDecoder-only vision models are rare because most vision models rely on an encoder to learn an image representation. But for use cases like image generation, the decoder is a natural fit, as we've seen from text generation models like GPT-2. [ImageGPT](model_doc/imagegpt) uses the same architecture as GPT-2, but instead of predicting the next token in a sequence, it predicts the next pixel in an image. In addition to image generation, ImageGPT could also be finetuned for image classification.\n\n### Encoder-decoder[[cv-encoder-decoder]]\n\nVision models commonly use an encoder (also known as a backbone) to extract important image features before passing them to a Transformer decoder. [DETR](model_doc/detr) has a pretrained backbone, but it also uses the complete Transformer encoder-decoder architecture for object detection."}


created_at: 2024-08-26 20:30:03
topic: persistent://default/default/621deaf2-9359-4ac4-ada0-047176703e13
id: 81c63364-e285-4150-80bc-8e628f013687
encoding: FLOAT32
metadata:
{"url": "https://huggingface.co/docs/transformers/model_summary", "title": "The Transformer model family", "tokens": 4019, "retrieve_doc": true, "source": "transformers", "_node_content": "{\"id_\": \"81c63364-e285-4150-80bc-8e628f013687\", \"embedding\": null, \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/model_summary\", \"title\": \"The Transformer model family\", \"tokens\": 4019, \"retrieve_doc\": true, \"source\": \"transformers\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"fd6ed4d3-f1ca-498d-9c74-7a5d84385e19\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/model_summary\", \"title\": \"The Transformer model family\", \"tokens\": 4019, \"retrieve_doc\": true, \"source\": \"transformers\"}, \"hash\": \"8cead54d1f52c4d818c9192529c1a4c2c648d344c5ad270063818d92463dd149\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"212cc8f8-8054-486a-a6fe-7465fe4fc367\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/model_summary\", \"title\": \"The Transformer model family\", \"tokens\": 4019, \"retrieve_doc\": true, \"source\": \"transformers\"}, \"hash\": \"b8dee52ed3e3ec41bf06b70405e356a2078f575120edf086cced6e79aa508a02\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"274244d5-1b30-4700-b341-92e1259f1a0a\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"8512f7945e4e45e353158f4d39346f978e6ee029df678571246aac19e2f64bf4\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 4165, \"end_char_idx\": 7305, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "fd6ed4d3-f1ca-498d-9c74-7a5d84385e19", "doc_id": "fd6ed4d3-f1ca-498d-9c74-7a5d84385e19", "ref_doc_id": "fd6ed4d3-f1ca-498d-9c74-7a5d84385e19", "chroma:document": "Other vision models, like BeIT and ViTMAE, drew inspiration from BERT's pretraining objective. [BeIT](model_doc/beit) is pretrained by *masked image modeling (MIM)*; the image patches are randomly masked, and the image is also tokenized into visual tokens. BeIT is trained to predict the visual tokens corresponding to the masked patches. [ViTMAE](model_doc/vitmae) has a similar pretraining objective, except it must predict the pixels instead of visual tokens. What's unusual is 75% of the image patches are masked! The decoder reconstructs the pixels from the masked tokens and encoded patches. After pretraining, the decoder is thrown away, and the encoder is ready to be used in downstream tasks.\n\n### Decoder[[cv-decoder]]\n\nDecoder-only vision models are rare because most vision models rely on an encoder to learn an image representation. But for use cases like image generation, the decoder is a natural fit, as we've seen from text generation models like GPT-2. [ImageGPT](model_doc/imagegpt) uses the same architecture as GPT-2, but instead of predicting the next token in a sequence, it predicts the next pixel in an image. In addition to image generation, ImageGPT could also be finetuned for image classification.\n\n### Encoder-decoder[[cv-encoder-decoder]]\n\nVision models commonly use an encoder (also known as a backbone) to extract important image features before passing them to a Transformer decoder. [DETR](model_doc/detr) has a pretrained backbone, but it also uses the complete Transformer encoder-decoder architecture for object detection. The encoder learns image representations and combines them with object queries (each object query is a learned embedding that focuses on a region or object in an image) in the decoder. DETR predicts the bounding box coordinates and class label for each object query.\n\n## Natural language processing\n\n<iframe style=\"border: 1px solid rgba(0, 0, 0, 0.1);\" width=\"1000\" height=\"450\" src=\"https://www.figma.com/embed?embed_host=share&url=https%3A%2F%2Fwww.figma.com%2Ffile%2FUhbQAZDlpYW5XEpdFy6GoG%2Fnlp-model-timeline%3Fnode-id%3D0%253A1%26t%3D4mZMr4r1vDEYGJ50-1\" allowfullscreen></iframe>\n\n### Encoder[[nlp-encoder]]\n\n[BERT](model_doc/bert) is an encoder-only Transformer that randomly masks certain tokens in the input to avoid seeing other tokens, which would allow it to \"cheat\". The pretraining objective is to predict the masked token based on the context. This allows BERT to fully use the left and right contexts to help it learn a deeper and richer representation of the inputs. However, there was still room for improvement in BERT's pretraining strategy. [RoBERTa](model_doc/roberta) improved upon this by introducing a new pretraining recipe that includes training for longer and on larger batches, randomly masking tokens at each epoch instead of just once during preprocessing, and removing the next-sentence prediction objective. \n\nThe dominant strategy to improve performance is to increase the model size. But training large models is computationally expensive. One way to reduce computational costs is using a smaller model like [DistilBERT](model_doc/distilbert)."}


created_at: 2024-08-26 20:30:03
topic: persistent://default/default/621deaf2-9359-4ac4-ada0-047176703e13
id: 274244d5-1b30-4700-b341-92e1259f1a0a
encoding: FLOAT32
metadata:
{"url": "https://huggingface.co/docs/transformers/model_summary", "title": "The Transformer model family", "tokens": 4019, "retrieve_doc": true, "source": "transformers", "_node_content": "{\"id_\": \"274244d5-1b30-4700-b341-92e1259f1a0a\", \"embedding\": null, \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/model_summary\", \"title\": \"The Transformer model family\", \"tokens\": 4019, \"retrieve_doc\": true, \"source\": \"transformers\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"fd6ed4d3-f1ca-498d-9c74-7a5d84385e19\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/model_summary\", \"title\": \"The Transformer model family\", \"tokens\": 4019, \"retrieve_doc\": true, \"source\": \"transformers\"}, \"hash\": \"8cead54d1f52c4d818c9192529c1a4c2c648d344c5ad270063818d92463dd149\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"81c63364-e285-4150-80bc-8e628f013687\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/model_summary\", \"title\": \"The Transformer model family\", \"tokens\": 4019, \"retrieve_doc\": true, \"source\": \"transformers\"}, \"hash\": \"ab735995d323c697e5672fb632249e1c5223f364933c32628fd2f291ccc27802\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"262865c1-c6bb-4168-b7f5-bbc7d422e62c\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"0cf213ec57003fb8c06fbbaffd4409237761532a45b660940005affc1a7a6a23\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 5726, \"end_char_idx\": 9017, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "fd6ed4d3-f1ca-498d-9c74-7a5d84385e19", "doc_id": "fd6ed4d3-f1ca-498d-9c74-7a5d84385e19", "ref_doc_id": "fd6ed4d3-f1ca-498d-9c74-7a5d84385e19", "chroma:document": "The encoder learns image representations and combines them with object queries (each object query is a learned embedding that focuses on a region or object in an image) in the decoder. DETR predicts the bounding box coordinates and class label for each object query.\n\n## Natural language processing\n\n<iframe style=\"border: 1px solid rgba(0, 0, 0, 0.1);\" width=\"1000\" height=\"450\" src=\"https://www.figma.com/embed?embed_host=share&url=https%3A%2F%2Fwww.figma.com%2Ffile%2FUhbQAZDlpYW5XEpdFy6GoG%2Fnlp-model-timeline%3Fnode-id%3D0%253A1%26t%3D4mZMr4r1vDEYGJ50-1\" allowfullscreen></iframe>\n\n### Encoder[[nlp-encoder]]\n\n[BERT](model_doc/bert) is an encoder-only Transformer that randomly masks certain tokens in the input to avoid seeing other tokens, which would allow it to \"cheat\". The pretraining objective is to predict the masked token based on the context. This allows BERT to fully use the left and right contexts to help it learn a deeper and richer representation of the inputs. However, there was still room for improvement in BERT's pretraining strategy. [RoBERTa](model_doc/roberta) improved upon this by introducing a new pretraining recipe that includes training for longer and on larger batches, randomly masking tokens at each epoch instead of just once during preprocessing, and removing the next-sentence prediction objective. \n\nThe dominant strategy to improve performance is to increase the model size. But training large models is computationally expensive. One way to reduce computational costs is using a smaller model like [DistilBERT](model_doc/distilbert). DistilBERT uses [knowledge distillation](https://arxiv.org/abs/1503.02531) - a compression technique - to create a smaller version of BERT while keeping nearly all of its language understanding capabilities. \n\nHowever, most Transformer models continued to trend towards more parameters, leading to new models focused on improving training efficiency. [ALBERT](model_doc/albert) reduces memory consumption by lowering the number of parameters in two ways: separating the larger vocabulary embedding into two smaller matrices and allowing layers to share parameters. [DeBERTa](model_doc/deberta) added a disentangled attention mechanism where the word and its position are separately encoded in two vectors. The attention is computed from these separate vectors instead of a single vector containing the word and position embeddings. [Longformer](model_doc/longformer) also focused on making attention more efficient, especially for processing documents with longer sequence lengths. It uses a combination of local windowed attention (attention only calculated from fixed window size around each token) and global attention (only for specific task tokens like `[CLS]` for classification) to create a sparse attention matrix instead of a full attention matrix.\n\n### Decoder[[nlp-decoder]]\n\n[GPT-2](model_doc/gpt2) is a decoder-only Transformer that predicts the next word in the sequence. It masks tokens to the right so the model can't \"cheat\" by looking ahead. By pretraining on a massive body of text, GPT-2 became really good at generating text, even if the text is only sometimes accurate or true. But GPT-2 lacked the bidirectional context from BERT's pretraining, which made it unsuitable for certain tasks."}


created_at: 2024-08-26 20:30:03
topic: persistent://default/default/621deaf2-9359-4ac4-ada0-047176703e13
id: 262865c1-c6bb-4168-b7f5-bbc7d422e62c
encoding: FLOAT32
metadata:
{"url": "https://huggingface.co/docs/transformers/model_summary", "title": "The Transformer model family", "tokens": 4019, "retrieve_doc": true, "source": "transformers", "_node_content": "{\"id_\": \"262865c1-c6bb-4168-b7f5-bbc7d422e62c\", \"embedding\": null, \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/model_summary\", \"title\": \"The Transformer model family\", \"tokens\": 4019, \"retrieve_doc\": true, \"source\": \"transformers\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"fd6ed4d3-f1ca-498d-9c74-7a5d84385e19\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/model_summary\", \"title\": \"The Transformer model family\", \"tokens\": 4019, \"retrieve_doc\": true, \"source\": \"transformers\"}, \"hash\": \"8cead54d1f52c4d818c9192529c1a4c2c648d344c5ad270063818d92463dd149\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"274244d5-1b30-4700-b341-92e1259f1a0a\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://huggingface.co/docs/transformers/model_summary\", \"title\": \"The Transformer model family\", \"tokens\": 4019, \"retrieve_doc\": true, \"source\": \"transformers\"}, \"hash\": \"b3b068642bf42be0a7f344b4fd8a1de96c7e1d960a1237a30eab9916c1226ea7\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"3183ce95-d2af-4515-9058-db07e6e677f2\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"ddc653538932ca46bf8cc1f16c62fec654434af80223eb7dda3b9e2db715350b\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 7146, \"end_char_idx\": 10667, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "fd6ed4d3-f1ca-498d-9c74-7a5d84385e19", "doc_id": "fd6ed4d3-f1ca-498d-9c74-7a5d84385e19", "ref_doc_id": "fd6ed4d3-f1ca-498d-9c74-7a5d84385e19", "chroma:document": "But training large models is computationally expensive. One way to reduce computational costs is using a smaller model like [DistilBERT](model_doc/distilbert). DistilBERT uses [knowledge distillation](https://arxiv.org/abs/1503.02531) - a compression technique - to create a smaller version of BERT while keeping nearly all of its language understanding capabilities. \n\nHowever, most Transformer models continued to trend towards more parameters, leading to new models focused on improving training efficiency. [ALBERT](model_doc/albert) reduces memory consumption by lowering the number of parameters in two ways: separating the larger vocabulary embedding into two smaller matrices and allowing layers to share parameters. [DeBERTa](model_doc/deberta) added a disentangled attention mechanism where the word and its position are separately encoded in two vectors. The attention is computed from these separate vectors instead of a single vector containing the word and position embeddings. [Longformer](model_doc/longformer) also focused on making attention more efficient, especially for processing documents with longer sequence lengths. It uses a combination of local windowed attention (attention only calculated from fixed window size around each token) and global attention (only for specific task tokens like `[CLS]` for classification) to create a sparse attention matrix instead of a full attention matrix.\n\n### Decoder[[nlp-decoder]]\n\n[GPT-2](model_doc/gpt2) is a decoder-only Transformer that predicts the next word in the sequence. It masks tokens to the right so the model can't \"cheat\" by looking ahead. By pretraining on a massive body of text, GPT-2 became really good at generating text, even if the text is only sometimes accurate or true. But GPT-2 lacked the bidirectional context from BERT's pretraining, which made it unsuitable for certain tasks. [XLNET](model_doc/xlnet) combines the best of both BERT and GPT-2's pretraining objectives by using a permutation language modeling objective (PLM) that allows it to learn bidirectionally.\n\nAfter GPT-2, language models grew even bigger and are now known as *large language models (LLMs)*. LLMs demonstrate few- or even zero-shot learning if pretrained on a large enough dataset. [GPT-J](model_doc/gptj) is an LLM with 6B parameters and trained on 400B tokens. GPT-J was followed by [OPT](model_doc/opt), a family of decoder-only models, the largest of which is 175B and trained on 180B tokens. [BLOOM](model_doc/bloom) was released around the same time, and the largest model in the family has 176B parameters and is trained on 366B tokens in 46 languages and 13 programming languages.\n\n### Encoder-decoder[[nlp-encoder-decoder]]\n\n[BART](model_doc/bart) keeps the original Transformer architecture, but it modifies the pretraining objective with *text infilling* corruption, where some text spans are replaced with a single `mask` token. The decoder predicts the uncorrupted tokens (future tokens are masked) and uses the encoder's hidden states to help it. [Pegasus](model_doc/pegasus) is similar to BART, but Pegasus masks entire sentences instead of text spans. In addition to masked language modeling, Pegasus is pretrained by gap sentence generation (GSG). The GSG objective masks whole sentences important to a document, replacing them with a `mask` token. The decoder must generate the output from the remaining sentences. [T5](model_doc/t5) is a more unique model that casts all NLP tasks into a text-to-text problem using specific prefixes."}


