Menyiapkan data pelatihan teks untuk ekstraksi entity
Tetap teratur dengan koleksi
Simpan dan kategorikan konten berdasarkan preferensi Anda.
Halaman ini menjelaskan cara menyiapkan data teks yang akan digunakan dalam set data Vertex AI
untuk melatih model ekstraksi entity.
Data pelatihan ekstraksi entity terdiri dari dokumen yang dianotasi dengan
label yang mengidentifikasi jenis entity yang ingin diidentifikasi oleh
model Anda. Misalnya, Anda dapat membuat model ekstraksi entity untuk mengidentifikasi
terminologi khusus dalam dokumen hukum atau paten. Anotasi menentukan
lokasi entity yang Anda berikan label dan label itu sendiri.
Jika Anda membuat anotasi dokumen terstruktur atau semi-terstruktur untuk set data yang digunakan
untuk melatih model AutoML, seperti invoice atau kontrak,
Vertex AI dapat mempertimbangkan posisi
anotasi di halaman sebagai faktor yang berkontribusi pada label yang tepat. Misalnya, kontrak properti memiliki tanggal persetujuan dan tanggal
penutupan. Vertex AI dapat belajar membedakan berbagai entity
berdasarkan posisi spasial anotasi.
Persyaratan data
Anda harus menyediakan minimal 50, dan tidak lebih dari 100.000, dokumen pelatihan.
Anda harus menyediakan minimal 1, dan tidak lebih dari 100, label unik untuk menganotasi
entity yang ingin Anda ekstrak.
Anda dapat menggunakan label untuk memberikan anotasi antara 1 dan 10 kata.
Nama label dapat berisi 2 hingga 30 karakter.
Anda dapat menyertakan anotasi dalam file JSON Lines, atau Anda dapat menambahkan
anotasi
nanti, menggunakan konsol Google Cloud setelah mengupload dokumen.
Anda dapat menyertakan dokumen secara inline atau mereferensikan file TXT yang ada di bucket Cloud Storage.
Praktik terbaik untuk data teks yang digunakan untuk melatih model AutoML
Rekomendasi berikut berlaku untuk set data yang digunakan dalam melatih model AutoML.
Gunakan setiap label minimal 200 kali dalam set data pelatihan Anda.
Anotasikan setiap kemunculan entity yang akan diidentifikasi oleh model Anda.
File input
Jenis file input untuk ekstraksi entity harus berupa JSON Lines. Format, nama kolom,
dan jenis nilai untuk file JSON Lines ditentukan oleh file skema,
yang merupakan
file YAML yang dapat diakses secara publik.
Contoh berikut menunjukkan cara menggunakan skema untuk membuat
file JSON Lines Anda sendiri. Contoh ini menyertakan baris baru agar lebih mudah dibaca. Dalam
file JSON, sertakan jeda baris hanya setelah setiap dokumen. Kolom
dataItemResourceLabels menentukan, misalnya, ml_use dan bersifat
opsional.
Anda juga dapat menganotasi dokumen menggunakan konsol Google Cloud . Buat
file JSON Lines dengan konten saja (tanpa kolom textSegmentAnnotations);
dokumen diupload ke Vertex AI tanpa anotasi apa pun.
[[["Mudah dipahami","easyToUnderstand","thumb-up"],["Memecahkan masalah saya","solvedMyProblem","thumb-up"],["Lainnya","otherUp","thumb-up"]],[["Sulit dipahami","hardToUnderstand","thumb-down"],["Informasi atau kode contoh salah","incorrectInformationOrSampleCode","thumb-down"],["Informasi/contoh yang saya butuhkan tidak ada","missingTheInformationSamplesINeed","thumb-down"],["Masalah terjemahan","translationIssue","thumb-down"],["Lainnya","otherDown","thumb-down"]],["Terakhir diperbarui pada 2025-09-04 UTC."],[],[],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."]]