mirror of
https://github.com/DS4SD/docling.git
synced 2025-12-08 20:58:11 +00:00
Update MongoDB RAG Example
This commit is contained in:
18
docs/examples/rag_mongodb.ipynb
vendored
18
docs/examples/rag_mongodb.ipynb
vendored
@@ -208,7 +208,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 131,
|
"execution_count": 137,
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"id": "L17ju9xibuIo"
|
"id": "L17ju9xibuIo"
|
||||||
},
|
},
|
||||||
@@ -225,10 +225,20 @@
|
|||||||
" 'Llion Jones ∗ Google Research llion@google.com',\n",
|
" 'Llion Jones ∗ Google Research llion@google.com',\n",
|
||||||
" 'Aidan N. Gomez ∗ † University of Toronto aidan@cs.toronto.edu',\n",
|
" 'Aidan N. Gomez ∗ † University of Toronto aidan@cs.toronto.edu',\n",
|
||||||
" 'Łukasz Kaiser ∗ Google Brain lukaszkaiser@google.com',\n",
|
" 'Łukasz Kaiser ∗ Google Brain lukaszkaiser@google.com',\n",
|
||||||
" 'Illia Polosukhin ∗ ‡']"
|
" 'Illia Polosukhin ∗ ‡',\n",
|
||||||
|
" 'illia.polosukhin@gmail.com',\n",
|
||||||
|
" 'The dominant sequence transduction models are based on complex recurrent or convolutional neural networks that include an encoder and a decoder. The best performing models also connect the encoder and decoder through an attention mechanism. We propose a new simple network architecture, the Transformer, based solely on attention mechanisms, dispensing with recurrence and convolutions entirely. Experiments on two machine translation tasks show these models to be superior in quality while being more parallelizable and requiring significantly less time to train. Our model achieves 28.4 BLEU on the WMT 2014 Englishto-German translation task, improving over the existing best results, including ensembles, by over 2 BLEU. On the WMT 2014 English-to-French translation task, our model establishes a new single-model state-of-the-art BLEU score of 41.8 after training for 3.5 days on eight GPUs, a small fraction of the training costs of the best models from the literature. We show that the Transformer generalizes well to other tasks by applying it successfully to English constituency parsing both with large and limited training data.',\n",
|
||||||
|
" '$^{∗}$Equal contribution. Listing order is random. Jakob proposed replacing RNNs with self-attention and started the effort to evaluate this idea. Ashish, with Illia, designed and implemented the first Transformer models and has been crucially involved in every aspect of this work. Noam proposed scaled dot-product attention, multi-head attention and the parameter-free position representation and became the other person involved in nearly every detail. Niki designed, implemented, tuned and evaluated countless model variants in our original codebase and tensor2tensor. Llion also experimented with novel model variants, was responsible for our initial codebase, and efficient inference and visualizations. Lukasz and Aidan spent countless long days designing various parts of and implementing tensor2tensor, replacing our earlier codebase, greatly improving results and massively accelerating our research.',\n",
|
||||||
|
" '$^{†}$Work performed while at Google Brain.',\n",
|
||||||
|
" '$^{‡}$Work performed while at Google Research.',\n",
|
||||||
|
" '31st Conference on Neural Information Processing Systems (NIPS 2017), Long Beach, CA, USA.',\n",
|
||||||
|
" 'Recurrent neural networks, long short-term memory [13] and gated recurrent [7] neural networks in particular, have been firmly established as state of the art approaches in sequence modeling and transduction problems such as language modeling and machine translation [35, 2, 5]. Numerous efforts have since continued to push the boundaries of recurrent language models and encoder-decoder architectures [38, 24, 15].',\n",
|
||||||
|
" 'Recurrent models typically factor computation along the symbol positions of the input and output sequences. Aligning the positions to steps in computation time, they generate a sequence of hidden states h$_{t}$ , as a function of the previous hidden state h$_{t}$$_{-}$$_{1}$ and the input for position t . This inherently sequential nature precludes parallelization within training examples, which becomes critical at longer sequence lengths, as memory constraints limit batching across examples. Recent work has achieved significant improvements in computational efficiency through factorization tricks [21] and conditional computation [32], while also improving model performance in case of the latter. The fundamental constraint of sequential computation, however, remains.',\n",
|
||||||
|
" 'Attention mechanisms have become an integral part of compelling sequence modeling and transduction models in various tasks, allowing modeling of dependencies without regard to their distance in the input or output sequences [2, 19]. In all but a few cases [27], however, such attention mechanisms are used in conjunction with a recurrent network.',\n",
|
||||||
|
" 'In this work we propose the Transformer, a model architecture eschewing recurrence and instead relying entirely on an attention mechanism to draw global dependencies between input and output. The Transformer allows for significantly more parallelization and can reach a new state of the art in translation quality after being trained for as little as twelve hours on eight P100 GPUs.']"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"execution_count": 131,
|
"execution_count": 137,
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"output_type": "execute_result"
|
"output_type": "execute_result"
|
||||||
}
|
}
|
||||||
@@ -242,7 +252,7 @@
|
|||||||
"# Perform hierarchical chunking on the converted document and get text from chunks\n",
|
"# Perform hierarchical chunking on the converted document and get text from chunks\n",
|
||||||
"chunks = list(chunker.chunk(converted_doc))\n",
|
"chunks = list(chunker.chunk(converted_doc))\n",
|
||||||
"chunk_texts = [chunk.text for chunk in chunks]\n",
|
"chunk_texts = [chunk.text for chunk in chunks]\n",
|
||||||
"chunk_texts[:10] # Display first 3 chunk texts"
|
"chunk_texts[:20] # Display a few chunk texts"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user