Today we are excited to announce that you can now perform batch transforms with ایمیزون سیج میکر جمپ اسٹارٹ large language models (LLMs) for Text2Text Generation. Batch transforms are useful in situations where the responses don’t need to be real time and therefore you can do inference in batch for large datasets in bulk. For batch transform, a batch job is run that takes batch input as a dataset and a pre-trained model, and outputs predictions for each data point in the dataset. Batch transform is cost-effective because unlike real-time hosted endpoints that have persistent hardware, batch transform clusters are torn down when the job is complete and therefore the hardware is only used for the duration of the batch job.
In some use cases, real-time inference requests can be grouped in small batches for batch processing to create real-time or near-real-time responses. For example, if you need to process a continuous stream of data with low latency and high throughput, invoking a real-time endpoint for each request separately would require more resources and can take longer to process all the requests because the processing is being done serially. A better approach would be to group some of the requests and call the real-time endpoint in batch inference mode, which processes your requests in one forward pass of the model and returns the bulk response for the request in real time or near-real time. The latency of the response will depend upon how many requests you group together and instance memory size, therefore you can tune the batch size per your business requirements for latency and throughput. We call this real-time batch inference because it combines the concept of batching while still providing real-time responses. With real-time batch inference, you can achieve a balance between low latency and high throughput, enabling you to process large volumes of data in a timely and efficient manner.
Jumpstart batch transform for Text2Text Generation models allows you to pass the batch hyperparameters through environment variables that further increase throughput and minimize latency.
JumpStart provides pretrained, open-source models for a wide range of problem types to help you get started with machine learning (ML). You can incrementally train and tune these models before deployment. JumpStart also provides solution templates that set up infrastructure for common use cases, and executable example notebooks for ML with ایمیزون سیج میکر. You can access the pre-trained models, solution templates, and examples through the JumpStart landing page in ایمیزون سیج میکر اسٹوڈیو. You can also access JumpStart models using the SageMaker Python SDK.
In this post, we demonstrate how to use the state-of-the-art pre-trained text2text FLAN T5 models from Hugging Face for batch transform and real-time batch inference.
حل جائزہ
The notebook showing batch transform of pre-trained Text2Text FLAN T5 models from گلے لگانے والا چہرہ in available in the following GitHub ذخیرہ. This notebook uses data from the Hugging Face cnn_dailymail dataset for a text summarization task using the SageMaker SDK.
The following are the key steps for implementing batch transform and real-time batch inference:
- شرائط مرتب کریں۔
- پہلے سے تربیت یافتہ ماڈل منتخب کریں۔
- Retrieve artifacts for the model.
- Specify batch transform job hyperparameters.
- Prepare data for the batch transform.
- Run the batch transform job.
- Evaluate the summarization using a RED (Recall-Oriented Understudy for Gisting Evaluation) score.
- Perform real-time batch inference.
شرائط مرتب کریں۔
Before you run the notebook, you must complete some initial setup steps. Let’s set up the SageMaker execution role so it has permissions to run AWS services on your behalf:
پہلے سے تربیت یافتہ ماڈل منتخب کریں۔
We use the huggingface-text2text-flan-t5-large model as a default model. Optionally, you can retrieve the list of available Text2Text models on JumpStart and choose your preferred model. This method provides a straightforward way to select different model IDs using same notebook. For demonstration purposes, we use the huggingface-text2text-flan-t5-large model:
Retrieve artifacts for the model
SageMaker کے ساتھ، ہم پہلے سے تربیت یافتہ ماڈل کا اندازہ لگا سکتے ہیں، یہاں تک کہ اسے نئے ڈیٹاسیٹ پر پہلے ٹھیک ٹیوننگ کیے بغیر۔ ہم بازیافت کرکے شروع کرتے ہیں۔ deploy_image_uri
, deploy_source_uri
، اور model_uri
for the pre-trained model:
Specify batch transform job hyperparameters
You may pass any subset of hyperparameters as environment variables to the batch transform job. You can also pass these hyperparameters in a JSON payload. However, if you’re setting environment variables for hyperparameters like the following code shows, then the advanced hyperparameters from the individual examples in the JSON lines payload will not be used. If you want to use hyperparameters from the payload, you may want to set the hyper_params_dict
parameter as null instead.
Prepare data for batch transform
Now we’re ready to load the cnn_dailymail dataset from Hugging Face:
We go over each data entry and create the input data in the required format. We create an articles.jsonl
file as a test data file containing articles that need to be summarized as input payload. As we create this file, we append the prompt "Briefly summarize this text:"
to each test input row. If you want to have different hyperparameters for each test input, you can append those hyperparameters as part of creating the dataset.
ہم تخلیق کرتے ہیں highlights.jsonl
as the ground truth file containing highlights of each article stored in the test file articles.jsonl
. We store both test files in an ایمیزون سادہ اسٹوریج سروس (Amazon S3) bucket. See the following code:
Run the batch transform job
When you start a batch transform job, SageMaker launches the necessary compute resources to process the data, including CPU or GPU instances depending on the selected instance type. During the batch transform job, SageMaker automatically provisions and manages the compute resources required to process the data, including instances, storage, and networking resources. When the batch transform job is complete, the compute resources are automatically cleaned up by SageMaker. This means that the instances and storage used during the job are stopped and removed, freeing up resources and minimizing cost. See the following code:
The following is one example record from the articles.jsonl
test file. Note that record in this file has an ID that matched with predict.jsonl
file records that shows a summarized record as output from the Hugging Face Text2Text model. Similarly, the ground truth file also has a matching ID for the data record. The matching ID across the test file, ground truth file, and output file allows linking input records with output records for easy interpretation of the results.
The following is the example input record provided for summarization:
The following is the predicted output with summarization:
The following is the ground truth summarization for model evaluation purposes:
Next, we use the ground truth and predicted outputs for model evaluation.
Evaluate the model using a ROUGE score¶
RED, or Recall-Oriented Understudy for Gisting Evaluation, is a set of metrics and a software package used for evaluating automatic summarization and machine translation in natural language processing. The metrics compare an automatically produced summary or translation against a reference (human-produced) summary or translation or a set of references.
In the following code, we combine the predicted and original summaries by joining them on the common key id
and use this to compute the ROUGE score:
Perform real-time batch inference
Next, we show you how to run real-time batch inference on the endpoint by providing the inputs as a list. We use the same model ID and dataset as earlier, except we take a few records from the test dataset and use them to invoke a real-time endpoint.
The following code shows how to create and deploy a real-time endpoint for real-time batch inference:
Next, we prepare our input payload. For this, we use the data that we prepared earlier and extract the first 10 test inputs and append the text inputs with hyperparameters that we want to use. We provide this payload to the real-time invoke_endpoint
. The response payload is then returned as a list of responses. See the following code:
صاف کرو
اختتامی نقطہ کی جانچ کرنے کے بعد، یقینی بنائیں کہ آپ نے SageMaker inference endpoint کو حذف کر دیا ہے اور چارجز سے بچنے کے لیے ماڈل کو حذف کر دیا ہے۔
نتیجہ
In this notebook, we performed a batch transform to showcase the Hugging Face Text2Text Generator model for summarization tasks. Batch transform is advantageous in obtaining inferences from large datasets without requiring a persistent endpoint. We linked input records with inferences to aid in result interpretation. We used the ROUGE score to compare the test data summarization with the model-generated summarization.
Additionally, we demonstrated real-time batch inference, where you can send a small batch of data to a real-time endpoint to achieve a balance between latency and throughput for scenarios like streaming input data. Real-time batch inference helps increase throughput for real-time requests.
Try out the batch transform with Text2Text Generation models in SageMaker today and let us know your feedback!
مصنفین کے بارے میں
ہیمنت سنگھ۔ is a Machine Learning Engineer with experience in Amazon SageMaker JumpStart and Amazon SageMaker built-in algorithms. He got his masters from Courant Institute of Mathematical Sciences and B.Tech from IIT Delhi. He has experience in working on a diverse range of machine learning problems within the domain of natural language processing, computer vision, and time series analysis.
رچنا چڈا is a Principal Solutions Architect AI/ML in Strategic Accounts at AWS. Rachna is an optimist who believes that the ethical and responsible use of AI can improve society in future and bring economic and social prosperity. In her spare time, Rachna likes spending time with her family, hiking, and listening to music.
ڈاکٹر آشیش کھیتان Amazon SageMaker بلٹ ان الگورتھم کے ساتھ ایک سینئر اپلائیڈ سائنٹسٹ ہے اور مشین لرننگ الگورتھم تیار کرنے میں مدد کرتا ہے۔ انہوں نے یونیورسٹی آف الینوائے اربانا-چمپین سے پی ایچ ڈی کی۔ وہ مشین لرننگ اور شماریاتی اندازہ میں ایک فعال محقق ہے، اور اس نے NeurIPS، ICML، ICLR، JMLR، ACL، اور EMNLP کانفرنسوں میں بہت سے مقالے شائع کیے ہیں۔
- SEO سے چلنے والا مواد اور PR کی تقسیم۔ آج ہی بڑھا دیں۔
- پلیٹوآئ اسٹریم۔ ویب 3 ڈیٹا انٹیلی جنس۔ علم میں اضافہ۔ یہاں تک رسائی حاصل کریں۔
- ایڈریین ایشلے کے ساتھ مستقبل کا نقشہ بنانا۔ یہاں تک رسائی حاصل کریں۔
- PREIPO® کے ساتھ PRE-IPO کمپنیوں میں حصص خریدیں اور بیچیں۔ یہاں تک رسائی حاصل کریں۔
- ماخذ: https://aws.amazon.com/blogs/machine-learning/perform-batch-transforms-with-amazon-sagemaker-jumpstart-text2text-generation-large-language-models/
- : ہے
- : ہے
- : نہیں
- :کہاں
- $UP
- 000
- 1
- 10
- 100
- 11
- 13
- 14
- 20
- 2014
- 50
- 7
- 8
- 9
- a
- قابلیت
- ہمارے بارے میں
- اوپر
- قبولیت
- مقبول
- تک رسائی حاصل
- کے مطابق
- اکاؤنٹس
- حاصل
- حاصل کرتا ہے
- کے پار
- اعمال
- فعال
- اعلی درجے کی
- فائدہ مند
- کے خلاف
- AI
- AI / ML
- امداد
- یلگوردمز
- تمام
- مبینہ طور پر
- کی اجازت دیتا ہے
- بھی
- ایمیزون
- ایمیزون سیج میکر
- ایمیزون سیج میکر جمپ اسٹارٹ
- ایمیزون ویب سروسز
- an
- تجزیہ
- اور
- اعلان کریں
- کوئی بھی
- اے پی آئی
- اطلاقی
- نقطہ نظر
- کیا
- ارد گرد
- مضمون
- مضامین
- AS
- At
- کوششیں
- اتھارٹی
- خودکار
- خود کار طریقے سے
- دستیاب
- سے اجتناب
- AWS
- متوازن
- بیس
- کی بنیاد پر
- BE
- بن گیا
- کیونکہ
- ہو جاتا ہے
- اس سے پہلے
- کیا جا رہا ہے
- یقین ہے کہ
- خیال ہے
- بنیامین
- بہتر
- کے درمیان
- جسم
- دونوں
- دونوں اطراف
- حدود
- مختصر
- لانے
- لاتا ہے
- تعمیر میں
- کاروبار
- لیکن
- by
- فون
- کر سکتے ہیں
- نہیں کر سکتے ہیں
- مقدمات
- کیونکہ
- بوجھ
- میں سے انتخاب کریں
- طبقے
- کلائنٹ
- قریب
- سی این این
- کوڈ
- جمع
- یکجا
- امتزاج
- کس طرح
- وعدوں
- انجام دیا
- کامن
- موازنہ
- مکمل
- کمپیوٹنگ
- کمپیوٹر
- کمپیوٹر ویژن
- تصور
- سلوک
- کانفرنسوں
- کنٹینر
- جاری
- مسلسل
- حصہ ڈالا
- قیمت
- سرمایہ کاری مؤثر
- سکتا ہے
- وکیل
- انسداد
- ممالک
- کورٹ
- تخلیق
- تخلیق
- جرم
- فوجداری
- اعداد و شمار
- ڈیٹا انٹری
- ڈیٹاسیٹس
- مردہ
- فیصلہ
- پہلے سے طے شدہ
- دلی
- مظاہرہ
- demonstrated,en
- شعبہ
- منحصر ہے
- تعیناتی
- تعیناتی
- بیان کیا
- اس بات کا تعین
- ترقی
- ترقی
- مختلف
- اختلافات
- مختلف
- براہ راست
- متنوع
- do
- میں Docker
- ڈومین
- کیا
- نہیں
- دروازے
- نیچے
- مدت
- کے دوران
- ہر ایک
- اس سے قبل
- وسطی
- آسان
- اقتصادی
- ہنر
- کوششوں
- اہل
- کو فعال کرنا
- آخر
- اختتام پوائنٹ
- انجینئر
- کو یقینی بنانے کے
- داخل ہوتا ہے
- اندراج
- ماحولیات
- دور
- اخلاقی
- اندازہ
- کا جائزہ لینے
- تشخیص
- بھی
- ثبوت
- مثال کے طور پر
- مثال کے طور پر
- اس کے علاوہ
- بہت پرجوش
- پھانسی
- تجربہ
- نکالنے
- چہرہ
- عقیدے
- خاندان
- چند
- فائل
- فائلوں
- پہلا
- کے بعد
- کے لئے
- مجبور
- غیر ملکی
- رسمی طور پر
- باضابطہ طور پر
- فارمیٹ
- آگے
- بانی
- سے
- مکمل
- مزید
- مستقبل
- نسل
- جنریٹر
- حاصل
- فراہم کرتا ہے
- Go
- اہداف
- حکومتیں
- GPU
- زیادہ سے زیادہ
- گراؤنڈ
- گروپ
- ہارڈ ویئر
- ہے
- he
- مدد
- مدد کرتا ہے
- اس کی
- یہاں
- ہائی
- پر روشنی ڈالی گئی
- ان
- میزبانی کی
- کس طرح
- کیسے
- تاہم
- HTML
- HTTP
- HTTPS
- گلے لگانے والا چہرہ
- انسانی
- انسانی حقوق
- انسانیت
- ID
- شناخت
- if
- ایلی نوائے
- تصویر
- فوری طور پر
- پر عمل درآمد
- درآمد
- کو بہتر بنانے کے
- in
- شامل
- سمیت
- اضافہ
- آزادی
- انفرادی
- انفرادی طور پر
- معلومات
- انفراسٹرکچر
- ابتدائی
- نا انصافی
- ان پٹ
- آدانوں
- انکوائری
- مثال کے طور پر
- کے بجائے
- انسٹی ٹیوٹ
- بین الاقوامی سطح پر
- تشریح
- میں
- کی تحقیقات
- تحقیقات
- تحقیقات
- اسرائیل
- IT
- میں
- جنوری
- ایوب
- میں شامل
- شمولیت
- فوٹو
- JSON
- جج
- جون
- دائرہ کار
- صرف
- جسٹس
- کلیدی
- جان
- لینڈنگ
- زبان
- بڑے
- آخری
- تاخیر
- بعد
- آغاز
- سیکھنے
- چھوڑ دیا
- دو
- ہلکے
- کی طرح
- پسند
- لائن
- لائنوں
- منسلک
- منسلک
- لسٹ
- سن
- لوڈ
- لانگ
- اب
- لو
- مشین
- مشین لرننگ
- بنا
- بنانا
- انتظام کرتا ہے
- انداز
- بہت سے
- نشان لگا دیا گیا
- ملا
- کے ملاپ
- ریاضیاتی
- مئی..
- کا مطلب ہے کہ
- رکن
- اراکین
- رکنیت
- یاد داشت
- طریقہ
- پیمائش کا معیار
- کم سے کم
- ML
- موڈ
- ماڈل
- ماڈل
- مہینہ
- زیادہ
- منتقل
- موسیقی
- ضروری
- نام
- قدرتی
- قدرتی زبان عملیات
- ضروری
- ضرورت ہے
- مذاکرات
- نہ ہی
- نیدرلینڈ
- نیٹ ورکنگ
- نئی
- خبر
- خبر جاری
- نوٹ بک
- اب
- اعتراض
- حاصل کرنا
- of
- دفتر
- سرکاری طور پر
- on
- ایک
- صرف
- کھول
- اوپن سورس
- کھول دیا
- مخالفت
- مخالفت کی
- or
- اصل
- OS
- ہمارے
- باہر
- پیداوار
- پر
- پیکج
- صفحہ
- فلسطین
- کاغذات
- پیرامیٹر
- پیرامیٹرز
- حصہ
- پارٹی
- منظور
- راستہ
- ہموار
- امن
- لوگ
- انجام دیں
- اجازتیں
- پلاٹا
- افلاطون ڈیٹا انٹیلی جنس
- پلیٹو ڈیٹا
- مہربانی کرکے
- پوائنٹ
- ممکن
- پوسٹ
- پیشن گوئی
- پیش گوئی
- کی پیشن گوئی
- پیشن گوئی
- پیش گو
- کو ترجیح دی
- تیار
- تیار
- ضروریات
- صدر
- دباؤ
- وزیر اعظم
- وزیر اعظم
- پرنسپل
- مسئلہ
- مسائل
- عمل
- عمل
- پروسیسنگ
- تیار
- خوشحالی
- فراہم
- فراہم
- فراہم کرتا ہے
- فراہم کرنے
- شائع
- مقاصد
- ازگر
- رینج
- تیار
- اصلی
- اصل وقت
- ریکارڈ
- ریکارڈ
- حوالہ جات
- مراد
- جاری
- ہٹا دیا گیا
- بار بار
- رپورٹ
- درخواست
- درخواستوں
- کی ضرورت
- ضرورت
- ضروریات
- محقق
- وسائل
- جواب
- جوابات
- ذمہ داریاں
- ذمہ دار
- نتیجہ
- نتائج کی نمائش
- واپسی
- واپسی
- کا جائزہ لینے کے
- حقوق
- کردار
- روم
- ROW
- رن
- s
- sagemaker
- سیج میکر کا اندازہ
- کہا
- اسی
- یہ کہہ
- منظرنامے
- سائنس
- سائنسدان
- سکور
- sdk
- دیکھنا
- کی تلاش
- منتخب
- بھیجنے
- سینئر
- سیریز
- سروسز
- مقرر
- قائم کرنے
- سیٹ اپ
- مشترکہ
- وہ
- ہونا چاہئے
- دکھائیں
- نمائش
- شوز
- اطمینان
- دستخط
- اسی طرح
- سادہ
- بعد
- صورتحال
- حالات
- سائز
- چھوٹے
- So
- سماجی
- سوسائٹی
- سافٹ ویئر کی
- حل
- حل
- کچھ
- بات
- بات
- خرچ کرنا۔
- شروع کریں
- شروع
- حالت
- محکمہ خارجہ
- ریاستی آرٹ
- بیان
- امریکہ
- شماریات
- مرحلہ
- مراحل
- ابھی تک
- بند کر دیا
- ذخیرہ
- ذخیرہ
- ذخیرہ
- براہ راست
- حکمت عملی
- سٹریم
- محرومی
- سختی
- موضوع
- مختصر
- خلاصہ
- موسم گرما
- حمایت
- لے لو
- لیا
- لیتا ہے
- ٹاسک
- کاموں
- ٹیک
- سانچے
- خطے
- علاقے
- ٹیسٹ
- سے
- کہ
- ۔
- کے بارے میں معلومات
- ہالینڈ
- ریاست
- دنیا
- ان
- ان
- تو
- لہذا
- یہ
- وہ
- اس
- ان
- کے ذریعے
- تھرو پٹ
- وقت
- وقت کا سلسلہ
- کرنے کے لئے
- آج
- مل کر
- پھٹا
- کی طرف
- ٹرین
- تبدیل
- ٹرانسفارمر
- تبادلوں
- ترجمہ
- سچ
- حقیقت
- قسم
- اقسام
- کمزور
- متحدہ
- ریاست ہائے متحدہ امریکہ
- یونیورسل
- یونیورسٹی
- برعکس
- اپ لوڈ کرنا
- صلی اللہ علیہ وسلم
- us
- استعمال کی شرائط
- استعمال کیا جاتا ہے
- کا استعمال کرتے ہوئے
- نائب صدر
- نقطہ نظر
- جلد
- W
- چاہتے ہیں
- جنگ
- تھا
- دیکھیئے
- راستہ..
- we
- ویب
- ویب خدمات
- بدھ کے روز
- آپ کا استقبال ہے
- خیر مقدم کیا
- اچھا ہے
- کیا
- جب
- چاہے
- جس
- جبکہ
- ڈبلیو
- وسیع
- وسیع رینج
- گے
- ساتھ
- کے اندر
- بغیر
- کام کر
- دنیا
- گا
- تم
- اور
- زیفیرنیٹ