[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["難以理解","hardToUnderstand","thumb-down"],["資訊或程式碼範例有誤","incorrectInformationOrSampleCode","thumb-down"],["缺少我需要的資訊/範例","missingTheInformationSamplesINeed","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間:2025-09-04 (世界標準時間)。"],[],[],null,["# Prepare text training data for entity extraction\n\n| Starting on September 15, 2024, you can only customize classification, entity extraction, and sentiment analysis objectives by moving to Vertex AI Gemini prompts and tuning. Training or updating models for Vertex AI AutoML for Text classification, entity extraction, and sentiment analysis objectives will no longer be available. You can continue using existing Vertex AI AutoML Text models until June 15, 2025. For a comparison of AutoML text and Gemini, see [Gemini for AutoML text users](/vertex-ai/docs/start/automl-gemini-comparison). For more information about how Gemini offers enhanced user experience through improved prompting capabilities, see [Introduction to tuning](/vertex-ai/generative-ai/docs/models/tune-gemini-overview). To get started with tuning, see [Model tuning for Gemini text models](/vertex-ai/generative-ai/docs/models/tune_gemini/tune-gemini-learn)\n\nThis page describes how to prepare text data for use in a Vertex AI\ndataset to train a entity extraction model.\n\nEntity extraction training data consists of documents that are annotated with\nthe labels that identify the types of entities that you want your model to\nidentify. For example, you might create an entity extraction model to identify\nspecialized terminology in legal documents or patents. Annotations specify\nthe locations of the entities that you're labeling and the labels themselves.\n\nIf you're annotating structured or semi-structure documents for a dataset used\nto train AutoML models, such as invoices or contracts,\nVertex AI can consider an annotation's\nposition on the page as a factor contributing to its proper label. For\nexample, a real estate contract has both an acceptance date and a closing\ndate. Vertex AI can learn to distinguish between the entities\nbased on the spatial position of the annotation.\n\nData requirements\n-----------------\n\n- You must supply at least 50, and no more than 100,000, training documents.\n- You must supply at least 1, and no more than 100, unique labels to annotate entities that you want to extract.\n- You can use a label to annotate between 1 and 10 words.\n- Label names can be between 2 and 30 characters.\n- You can include annotations in your JSON Lines files, or you can add annotations later by using the Google Cloud console after uploading documents.\n- You can include documents inline or reference TXT files that are in Cloud Storage buckets.\n\nBest practices for text data used to train AutoML models\n--------------------------------------------------------\n\nThe following recommendations apply to datasets used to train\nAutoML models.\n\n- Use each label at least 200 times in your training dataset.\n- Annotate every occurrence of entities that you want your model to identify.\n\nInput files\n-----------\n\nInput file types for entity extraction must be JSON Lines. The format, field\nnames, and value types for JSON Lines files are determined by a schema file,\nwhich\nare publicly accessible YAML files.\n\nYou can download the schema file for entity extraction from the following\nCloud Storage location: \n\n[gs://google-cloud-aiplatform/schema/dataset/ioformat/text_extraction_io_format_1.0.0.yaml](https://storage.cloud.google.com/google-cloud-aiplatform/schema/dataset/ioformat/text_extraction_io_format_1.0.0.yaml).\n\nThe following example shows how you might use the schema to create your\nown JSON Lines file. The example includes line breaks for readability. In your\nJSON files, include line breaks only after each document. The\n`dataItemResourceLabels` field specifies, for example, [ml_use](/vertex-ai/docs/general/ml-use) and is\noptional. \n\n```\n{\n \"textSegmentAnnotations\": [\n {\n \"startOffset\":number,\n \"endOffset\":number,\n \"displayName\": \"label\"\n },\n ...\n ],\n \"textContent\": \"inline_text\",\n \"dataItemResourceLabels\": {\n \"aiplatform.googleapis.com/ml_use\": \"training|test|validation\"\n }\n}\n{\n \"textSegmentAnnotations\": [\n {\n \"startOffset\":number,\n \"endOffset\":number,\n \"displayName\": \"label\"\n },\n ...\n ],\n \"textGcsUri\": \"gcs_uri_to_file\",\n \"dataItemResourceLabels\": {\n \"aiplatform.googleapis.com/ml_use\": \"training|test|validation\"\n }\n}\n```\n\nYou can also annotate documents by using the Google Cloud console. Create a\nJSON Lines file with content only (without the `textSegmentAnnotations` field);\ndocuments are uploaded to Vertex AI without any annotations."]]