{
"url": "https://arxiv.org/abs/1706.03762",
"resolvedUrl": "https://arxiv.org/pdf/1706.03762",
"ok": true,
"error": null,
"pageCount": 15,
"pagesExtracted": 3,
"title": null,
"author": null,
"subject": null,
"keywords": null,
"creator": "LaTeX with hyperref",
"producer": "pdfTeX-1.40.25",
"createdAt": "2024-04-10T21:11:43.000Z",
"modifiedAt": "2024-04-10T21:11:43.000Z",
"charCount": 8942,
"wordCount": 1310,
"truncated": false,
"text": "Provided proper attribution is provided, Google hereby grants permission to\nreproduce the tables and figures in this paper solely for use in journalistic or\nscholarly works.\nAttention Is All You Need\nAshish Vaswani∗\nGoogle Brain\[email protected]\nNoam Shazeer∗\nGoogle Brain\[email protected]\nNiki Parmar∗\nGoogle Research\[email protected]\nJakob Uszkoreit∗\nGoogle Research\[email protected]\nLlion Jones∗\nGoogle Research\[email protected]\nAidan N. Gomez∗ †\nUniversity of Toronto\[email protected]\nŁukasz Kaiser∗\nGoogle Brain\[email protected]\nIllia Polosukhin∗ ‡\[email protected]\nAbstract\nThe dominant sequence transduction models are based on complex recurrent or\nconvolutional neural networks that include an encoder and a decoder. The best\nperforming models also connect the encoder and decoder through an attention\nmechanism. We propose a new simple network architecture, the Transformer,\nbased solely on attention mechanisms, dispensing with recurrence and convolutions\nentirely. Experiments on two machine translation tasks show these models to\nbe superior in quality while being more parallelizable and requiring significantly\nless time to train. Our model achieves 28.4 BLEU on the WMT 2014 English-\nto-German translation task, improving over the existing best results, including\nensembles, by over 2 BLEU. On the WMT 2014 English-to-French translation task,\nour model establishes a new single-model state-of-the-art BLEU score of 41.8 after\ntraining for 3.5 days on eight GPUs, a small fraction of the training costs of the\nbest models from the literature. We show that the Transformer generalizes well to\nother tasks by applying it successfully to English constituency parsing both with\nlarge and limited training data.\n∗Equal contribution. Listing order is random. Jakob proposed replacing RNNs with self-attention and started\nthe effort to evaluate this idea. Ashish, with Illia, designed and implemented the first Transformer models and\nhas been crucially involved in every aspect of this work. Noam proposed scaled dot-product attention, multi-head\nattention and the parameter-free position representation and became the other person involved in nearly every\ndetail. Niki designed, implemented, tuned and evaluated countless model variants in our original codebase and\ntensor2tensor. Llion also experimented with novel model variants, was responsible for our initial codebase, and\nefficient inference and visualizations. Lukasz and Aidan spent countless long days designing various parts of and\nimplementing tensor2tensor, replacing our earlier codebase, greatly improving results and massively accelerating\nour research.\n†Work performed while at Google Brain.\n‡Work performed while at Google Research.\n31st Conference on Neural Information Processing Systems (NIPS 2017), Long Beach, CA, USA.\narXiv:1706.03762v7 [cs.CL] 2 Aug 2023\n\n1 Introduction\nRecurrent neural networks, long short-term memory [13] and gated recurrent [7] neural networks\nin particular, have been firmly established as state of the art approaches in sequence modeling and\ntransduction problems such as language modeling and machine translation [35, 2, 5]. Numerous\nefforts have since continued to push the boundaries of recurrent language models and encoder-decoder\narchitectures [38, 24, 15].\nRecurrent models typically factor computation along the symbol positions of the input and output\nsequences. Aligning the positions to steps in computation time, they generate a sequence of hidden\nstates ht, as a function of the previous hidden state ht−1 and the input for position t. This inherently\nsequential nature precludes parallelization within training examples, which becomes critical at longer\nsequence lengths, as memory constraints limit batching across examples. Recent work has achieved\nsignificant improvements in computational efficiency through factorization tricks [21] and conditional\ncomputation [32], while also improving model performance in case of the latter. The fundamental\nconstraint of sequential computation, however, remains.\nAttention mechanisms have become an integral part of compelling sequence modeling and transduc-\ntion models in various tasks, allowing modeling of dependencies without regard to their distance in\nthe input or output sequences [2, 19]. In all but a few cases [27], however, such attention mechanisms\nare used in conjunction with a recurrent network.\nIn this work we propose the Transformer, a model architecture eschewing recurrence and instead\nrelying entirely on an attention mechanism to draw global dependencies between input and output.\nThe Transformer allows for significantly more parallelization and can reach a new state of the art in\ntranslation quality after being trained for as little as twelve hours on eight P100 GPUs.\n2 Background\nThe goal of reducing sequential computation also forms the foundation of the Extended Neural GPU\n[16], ByteNet [18] and ConvS2S [9], all of which use convolutional neural networks as basic building\nblock, computing hidden representations in parallel for all input and output positions. In these models,\nthe number of operations required to relate signals from two arbitrary input or output positions grows\nin the distance between positions, linearly for ConvS2S and logarithmically for ByteNet. This makes\nit more difficult to learn dependencies between distant positions [12]. In the Transformer this is\nreduced to a constant number of operations, albeit at the cost of reduced effective resolution due\nto averaging attention-weighted positions, an effect we counteract with Multi-Head Attention as\ndescribed in section 3.2.\nSelf-attention, sometimes called intra-attention is an attention mechanism relating different positions\nof a single sequence in order to compute a representation of the sequence. Self-attention has been\nused successfully in a variety of tasks including reading comprehension, abstractive summarization,\ntextual entailment and learning task-independent sentence representations [4, 27, 28, 22].\nEnd-to-end memory networks are based on a recurrent attention mechanism instead of sequence-\naligned recurrence and have been shown to perform well on simple-language question answering and\nlanguage modeling tasks [34].\nTo the best of our knowledge, however, the Transformer is the first transduction model relying\nentirely on self-attention to compute representations of its input and output without using sequence-\naligned RNNs or convolution. In the following sections, we will describe the Transformer, motivate\nself-attention and discuss its advantages over models such as [17, 18] and [9].\n3 Model Architecture\nMost competitive neural sequence transduction models have an encoder-decoder structure [5, 2, 35].\nHere, the encoder maps an input sequence of symbol representations (x1, ..., xn) to a sequence\nof continuous representations z = (z1, ..., zn). Given z, the decoder then generates an output\nsequence (y1, ..., ym) of symbols one element at a time. At each step the model is auto-regressive\n[10], consuming the previously generated symbols as additional input when generating the next.\n2\n\nFigure 1: The Transformer - model architecture.\nThe Transformer follows this overall architecture using stacked self-attention and point-wise, fully\nconnected layers for both the encoder and decoder, shown in the left and right halves of Figure 1,\nrespectively.\n3.1 Encoder and Decoder Stacks\nEncoder: The encoder is composed of a stack of N = 6 identical layers. Each layer has two\nsub-layers. The first is a multi-head self-attention mechanism, and the second is a simple, position-\nwise fully connected feed-forward network. We employ a residual connection [11] around each of\nthe two sub-layers, followed by layer normalization [1]. That is, the output of each sub-layer is\nLayerNorm(x + Sublayer(x)), where Sublayer(x) is the function implemented by the sub-layer\nitself. To facilitate these residual connections, all sub-layers in the model, as well as the embedding\nlayers, produce outputs of dimension dmodel = 512.\nDecoder: The decoder is also composed of a stack of N = 6 identical layers. In addition to the two\nsub-layers in each encoder layer, the decoder inserts a third sub-layer, which performs multi-head\nattention over the output of the encoder stack. Similar to the encoder, we employ residual connections\naround each of the sub-layers, followed by layer normalization. We also modify the self-attention\nsub-layer in the decoder stack to prevent positions from attending to subsequent positions. This\nmasking, combined with fact that the output embeddings are offset by one position, ensures that the\npredictions for position i can depend only on the known outputs at positions less than i.\n3.2 Attention\nAn attention function can be described as mapping a query and a set of key-value pairs to an output,\nwhere the query, keys, values, and output are all vectors. The output is computed as a weighted sum\n3",
"fileSizeBytes": 2215244,
"pageLimit": 50,
"pagesRequested": "1-3",
"pageLimitApplied": false
}
curl --location --request GET 'https://zylalabs.com/api/16016/document+to+text+and+markdown+api+-+pdf+office+html/45115/extract+text+from+a+pdf+by+url?url=https://arxiv.org/abs/1706.03762&pages=1-3&maxChars=200000' --header 'Authorization: Bearer YOUR_API_KEY'
{
"url": "https://arxiv.org/abs/1706.03762",
"resolvedUrl": "https://arxiv.org/pdf/1706.03762",
"ok": true,
"error": null,
"pageCount": 15,
"pagesExtracted": 2,
"title": null,
"author": null,
"subject": null,
"keywords": null,
"creator": "LaTeX with hyperref",
"producer": "pdfTeX-1.40.25",
"createdAt": "2024-04-10T21:11:43.000Z",
"modifiedAt": "2024-04-10T21:11:43.000Z",
"charCount": 7114,
"wordCount": 1018,
"truncated": false,
"text": "Provided proper attribution is provided, Google hereby grants permission to\nreproduce the tables and figures in this paper solely for use in journalistic or\nscholarly works.\nAttention Is All You Need\nAshish Vaswani∗\nGoogle Brain\[email protected]\nNoam Shazeer∗\nGoogle Brain\[email protected]\nNiki Parmar∗\nGoogle Research\[email protected]\nJakob Uszkoreit∗\nGoogle Research\[email protected]\nLlion Jones∗\nGoogle Research\[email protected]\nAidan N. Gomez∗ †\nUniversity of Toronto\[email protected]\nŁukasz Kaiser∗\nGoogle Brain\[email protected]\nIllia Polosukhin∗ ‡\[email protected]\nAbstract\nThe dominant sequence transduction models are based on complex recurrent or\nconvolutional neural networks that include an encoder and a decoder. The best\nperforming models also connect the encoder and decoder through an attention\nmechanism. We propose a new simple network architecture, the Transformer,\nbased solely on attention mechanisms, dispensing with recurrence and convolutions\nentirely. Experiments on two machine translation tasks show these models to\nbe superior in quality while being more parallelizable and requiring significantly\nless time to train. Our model achieves 28.4 BLEU on the WMT 2014 English-\nto-German translation task, improving over the existing best results, including\nensembles, by over 2 BLEU. On the WMT 2014 English-to-French translation task,\nour model establishes a new single-model state-of-the-art BLEU score of 41.8 after\ntraining for 3.5 days on eight GPUs, a small fraction of the training costs of the\nbest models from the literature. We show that the Transformer generalizes well to\nother tasks by applying it successfully to English constituency parsing both with\nlarge and limited training data.\n∗Equal contribution. Listing order is random. Jakob proposed replacing RNNs with self-attention and started\nthe effort to evaluate this idea. Ashish, with Illia, designed and implemented the first Transformer models and\nhas been crucially involved in every aspect of this work. Noam proposed scaled dot-product attention, multi-head\nattention and the parameter-free position representation and became the other person involved in nearly every\ndetail. Niki designed, implemented, tuned and evaluated countless model variants in our original codebase and\ntensor2tensor. Llion also experimented with novel model variants, was responsible for our initial codebase, and\nefficient inference and visualizations. Lukasz and Aidan spent countless long days designing various parts of and\nimplementing tensor2tensor, replacing our earlier codebase, greatly improving results and massively accelerating\nour research.\n†Work performed while at Google Brain.\n‡Work performed while at Google Research.\n31st Conference on Neural Information Processing Systems (NIPS 2017), Long Beach, CA, USA.\narXiv:1706.03762v7 [cs.CL] 2 Aug 2023\n\n1 Introduction\nRecurrent neural networks, long short-term memory [13] and gated recurrent [7] neural networks\nin particular, have been firmly established as state of the art approaches in sequence modeling and\ntransduction problems such as language modeling and machine translation [35, 2, 5]. Numerous\nefforts have since continued to push the boundaries of recurrent language models and encoder-decoder\narchitectures [38, 24, 15].\nRecurrent models typically factor computation along the symbol positions of the input and output\nsequences. Aligning the positions to steps in computation time, they generate a sequence of hidden\nstates ht, as a function of the previous hidden state ht−1 and the input for position t. This inherently\nsequential nature precludes parallelization within training examples, which becomes critical at longer\nsequence lengths, as memory constraints limit batching across examples. Recent work has achieved\nsignificant improvements in computational efficiency through factorization tricks [21] and conditional\ncomputation [32], while also improving model performance in case of the latter. The fundamental\nconstraint of sequential computation, however, remains.\nAttention mechanisms have become an integral part of compelling sequence modeling and transduc-\ntion models in various tasks, allowing modeling of dependencies without regard to their distance in\nthe input or output sequences [2, 19]. In all but a few cases [27], however, such attention mechanisms\nare used in conjunction with a recurrent network.\nIn this work we propose the Transformer, a model architecture eschewing recurrence and instead\nrelying entirely on an attention mechanism to draw global dependencies between input and output.\nThe Transformer allows for significantly more parallelization and can reach a new state of the art in\ntranslation quality after being trained for as little as twelve hours on eight P100 GPUs.\n2 Background\nThe goal of reducing sequential computation also forms the foundation of the Extended Neural GPU\n[16], ByteNet [18] and ConvS2S [9], all of which use convolutional neural networks as basic building\nblock, computing hidden representations in parallel for all input and output positions. In these models,\nthe number of operations required to relate signals from two arbitrary input or output positions grows\nin the distance between positions, linearly for ConvS2S and logarithmically for ByteNet. This makes\nit more difficult to learn dependencies between distant positions [12]. In the Transformer this is\nreduced to a constant number of operations, albeit at the cost of reduced effective resolution due\nto averaging attention-weighted positions, an effect we counteract with Multi-Head Attention as\ndescribed in section 3.2.\nSelf-attention, sometimes called intra-attention is an attention mechanism relating different positions\nof a single sequence in order to compute a representation of the sequence. Self-attention has been\nused successfully in a variety of tasks including reading comprehension, abstractive summarization,\ntextual entailment and learning task-independent sentence representations [4, 27, 28, 22].\nEnd-to-end memory networks are based on a recurrent attention mechanism instead of sequence-\naligned recurrence and have been shown to perform well on simple-language question answering and\nlanguage modeling tasks [34].\nTo the best of our knowledge, however, the Transformer is the first transduction model relying\nentirely on self-attention to compute representations of its input and output without using sequence-\naligned RNNs or convolution. In the following sections, we will describe the Transformer, motivate\nself-attention and discuss its advantages over models such as [17, 18] and [9].\n3 Model Architecture\nMost competitive neural sequence transduction models have an encoder-decoder structure [5, 2, 35].\nHere, the encoder maps an input sequence of symbol representations (x1, ..., xn) to a sequence\nof continuous representations z = (z1, ..., zn). Given z, the decoder then generates an output\nsequence (y1, ..., ym) of symbols one element at a time. At each step the model is auto-regressive\n[10], consuming the previously generated symbols as additional input when generating the next.\n2",
"fileSizeBytes": 2215244,
"pageLimit": 50,
"pagesRequested": "1-2",
"pageLimitApplied": false
}
curl --location --request POST 'https://zylalabs.com/api/16016/document+to+text+and+markdown+api+-+pdf+office+html/45116/extract+text+from+an+uploaded+pdf?pages=1-3' --header 'Authorization: Bearer YOUR_API_KEY' --header 'Content-Type: application/json'
--data-raw '{"url":"https://arxiv.org/abs/1706.03762","pages":"1-2"}'
{
"url": "https://raw.githubusercontent.com/apache/poi/trunk/test-data/document/SampleDoc.docx",
"ok": true,
"error": null,
"format": "docx",
"fileName": "SampleDoc.docx",
"fileSizeBytes": 11611,
"slides": null,
"sheets": null,
"charCount": 140,
"wordCount": 31,
"truncated": false,
"markdown": "I am a test document\n\nThis is page 1\n\nI am Calibri (Body) in font size 11\n\nThis is page two\n\nIt’s Arial Black in 16 point\n\nIt’s also in blue",
"text": null
}
curl --location --request GET 'https://zylalabs.com/api/16016/document+to+text+and+markdown+api+-+pdf+office+html/45117/convert+an+office+document+by+url?url=https://raw.githubusercontent.com/apache/poi/trunk/test-data/document/SampleDoc.docx&outputFormat=markdown&includeNotes=1&maxRowsPerSheet=1000&maxChars=200000&chunkSize=OptionalchunkOverlap=Optional' --header 'Authorization: Bearer YOUR_API_KEY'
{
"url": "https://raw.githubusercontent.com/apache/poi/trunk/test-data/slideshow/SampleShow.pptx",
"ok": true,
"error": null,
"format": "pptx",
"fileName": "SampleShow.pptx",
"fileSizeBytes": 39083,
"slides": 2,
"sheets": null,
"charCount": 355,
"wordCount": 73,
"truncated": false,
"markdown": "## Slide 1: Title of the first slide\n\n- Subtitle of the first slide\n- This bit is in italic green\n\n> Notes: I am the notes of the first slide\n\n## Slide 2: This is the second slide\n\n- It has bullet points on it\n- They’re fun, aren’t they?\n- Especially in a different font like Arial Black at 16 point!\n\n> Notes: These are the notes of the 2nd slide THIS LINE IS BOLD",
"text": null
}
curl --location --request POST 'https://zylalabs.com/api/16016/document+to+text+and+markdown+api+-+pdf+office+html/45118/convert+an+office+file+from+a+json+body?outputFormat=markdown' --header 'Authorization: Bearer YOUR_API_KEY' --header 'Content-Type: application/json'
--data-raw '{"url":"https://raw.githubusercontent.com/apache/poi/trunk/test-data/slideshow/SampleShow.pptx"}'
{
"url": "https://en.wikipedia.org/wiki/Markdown",
"finalUrl": "https://en.wikipedia.org/wiki/Markdown",
"ok": true,
"error": null,
"httpStatus": 200,
"title": "Markdown - Wikipedia",
"description": null,
"language": "en",
"canonicalUrl": "https://en.wikipedia.org/wiki/Markdown",
"author": "Contributors to Wikimedia projects",
"publishedAt": "2005-08-09T19:56:00Z",
"siteName": "Wikimedia Foundation, Inc.",
"mode": "article",
"charCount": 39590,
"wordCount": 3238,
"tableCount": 3,
"linkCount": 258,
"truncated": false,
"_note": "Response truncated for documentation purposes"
}
curl --location --request GET 'https://zylalabs.com/api/16016/document+to+text+and+markdown+api+-+pdf+office+html/45119/convert+a+web+page+or+html+to+markdown?url=https://en.wikipedia.org/wiki/Markdown&mode=article&outputFormat=markdown&keepLinks=1&maxChars=200000&chunkSize=OptionalchunkOverlap=Optional' --header 'Authorization: Bearer YOUR_API_KEY'
{
"url": null,
"finalUrl": null,
"ok": true,
"error": null,
"httpStatus": null,
"title": "Sample page",
"description": null,
"language": null,
"canonicalUrl": null,
"author": null,
"publishedAt": null,
"siteName": null,
"mode": "full",
"charCount": 171,
"wordCount": 27,
"tableCount": 0,
"linkCount": 1,
"truncated": false,
"markdown": "# Pricing guide\n\nThis is a short sample article with enough text to be converted. It has a [link](https://example.com) and a list:\n\n- First item\n- Second item\n- Third item",
"text": null
}
curl --location --request POST 'https://zylalabs.com/api/16016/document+to+text+and+markdown+api+-+pdf+office+html/45120/convert+html+from+a+json+body+to+markdown?outputFormat=markdown' --header 'Authorization: Bearer YOUR_API_KEY' --header 'Content-Type: application/json'
--data-raw '{"html":"Sample page Pricing guide
This is a short sample article with enough text to be converted. It has a link and a list:
- First item
- Second item
- Third item
","outputFormat":"markdown"}'
注册后,每个开发者都会被分配一个个人 API 访问密钥,这是一个唯一的字母和数字组合,用于访问我们的 API 端点。要使用 文档转文本和 Markdown API - PDF Office HTML API 进行身份验证,只需在 Authorization 标头中包含您的 bearer token。
| 标头 | 描述 |
|---|---|
授权
|
必需
应为 Bearer access_key. 订阅后,请查看上方的"您的 API 访问密钥"。
|
它会返回提取的文本以及 PDF 元数据和处理详情,包括页数、已提取页数、标题、作者、创建和修改日期、字符数、词数以及是否被截断。PDF 中无法获取的元数据可能为 null
使用任一 PDF 端点上的可选页面范围参数来请求特定页面,而非整个文档。响应会报告文档的总页数 pageCount 以及实际提取的页数 pagesExtracted 乐彩
检查 ok 以确定提取是否成功;如果有错误,error 会提供失败详情。truncated 表示返回的文本是否被截断。使用 charCount 和 wordCount 评估提取内容的数量。
该 API 支持 Word、PowerPoint、Excel 和 OpenDocument 格式:DOCX、PPTX、XLSX、ODT、ODP 和 ODS。响应会标明检测到的格式,并可能在适用时包含幻灯片或工作表数量。
JSON 正文 Office 端点接受 outputFormat 参数以请求 Markdown、纯文本或两者兼有。响应使用 markdown 和 text 字段;未请求的格式可能为 null。Markdown 可以保留文档结构,例如表格、幻灯片标题和演讲者备注
这些字段报告演示文稿中的幻灯片数量或电子表格中的工作表数量(如适用)对于不适用的格式,另一个字段可能为 null 响应还包括 fileName、format、fileSizeBytes 和文本长度统计信息
响应可以包含页面标题、描述、语言、规范网址、作者、发布日期、网站名称、HTTP 状态以及表格数量和链接数量等内容计数。如果来源未提供相关信息,字段可能为 null
模式表示转换方式,例如以文章为重点或转换完整页面内容。URL 端点可以选择保留链接和图片,并将长页面拆分为多个块。对于以 JSON 提交的 HTML,响应可以在 Markdown 中包含绝对链接