การอุ่นเครื่องโมเดลที่บันทึกไว้
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
การแนะนำ
รันไทม์ TensorFlow มีส่วนประกอบที่เริ่มต้นอย่างเกียจคร้าน ซึ่งอาจทำให้เกิดเวลาแฝงสูงสำหรับคำขอแรกที่ส่งไปยังโมเดลหลังจากโหลดแล้ว เวลาแฝงนี้สามารถมีลำดับความสำคัญสูงกว่าคำขออนุมานเดียวได้หลายลำดับ
เพื่อลดผลกระทบของการเริ่มต้นแบบ Lazy ต่อเวลาแฝงของคำขอ คุณสามารถทริกเกอร์การเริ่มต้นระบบย่อยและส่วนประกอบในเวลาโหลดโมเดลได้ โดยจัดเตรียมชุดตัวอย่างของคำขอการอนุมานพร้อมกับ SavedModel กระบวนการนี้เรียกว่า "การอุ่นเครื่อง" โมเดล
การใช้งาน
SavedModel Warmup รองรับ Regress, Classify, MultiInference และ Predict หากต้องการทริกเกอร์การวอร์มอัพโมเดล ณ เวลาโหลด ให้แนบไฟล์ข้อมูลการวอร์มอัพใต้โฟลเดอร์ย่อย Assets.extra ของไดเร็กทอรี SavedModel
ข้อกำหนดสำหรับการวอร์มอัพโมเดลเพื่อให้ทำงานได้อย่างถูกต้อง:
- ชื่อไฟล์วอร์มอัพ: 'tf_serving_warmup_requests'
- ตำแหน่งไฟล์: Assets.extra/
- รูปแบบไฟล์: TFRecord โดยแต่ละบันทึกเป็น PredictionLog
- จำนวนบันทึกการอุ่นเครื่อง <= 1,000
- ข้อมูลการอุ่นเครื่องต้องเป็นตัวแทนของคำขออนุมานที่ใช้ในการให้บริการ
การสร้างข้อมูลอุ่นเครื่อง
สามารถเพิ่มข้อมูลการอุ่นเครื่องได้สองวิธี:
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-07-25 UTC
[null,null,["อัปเดตล่าสุด 2025-07-25 UTC"],[],[],null,["# SavedModel Warmup\n\n\u003cbr /\u003e\n\nIntroduction\n------------\n\nThe TensorFlow runtime has components that are lazily initialized,\nwhich can cause high latency for the first request/s sent to a model after it is\nloaded. This latency can be several orders of magnitude higher than that of a\nsingle inference request.\n\nTo reduce the impact of lazy initialization on request latency, it's possible to\ntrigger the initialization of the sub-systems and components at model load time\nby providing a sample set of inference requests along with the SavedModel. This\nprocess is known as \"warming up\" the model.\n\nUsage\n-----\n\nSavedModel Warmup is supported for Regress, Classify, MultiInference and\nPredict. To trigger warmup of the model at load time, attach a warmup data file\nunder the assets.extra subfolder of the SavedModel directory.\n\nRequirements for model warmup to work correctly:\n\n- Warmup file name: 'tf_serving_warmup_requests'\n- File location: assets.extra/\n- File format: [TFRecord](https://www.tensorflow.org/tutorials/load_data/tfrecord#tfrecords_format_details) with each record as a [PredictionLog](https://github.com/tensorflow/serving/blob/master/tensorflow_serving/apis/prediction_log.proto#:%7E:text=message-,PredictionLog,-%7B).\n- Number of warmup records \\\u003c= 1000.\n- The warmup data must be representative of the inference requests used at serving.\n\nWarm-up data generation\n-----------------------\n\nWarmup data can be added in two ways:\n\n- By directly populating the warmup requests into your exported Saved Model. This could be done by creating a script reading a list of sample inference requests, converting each request into [PredictionLog](https://github.com/tensorflow/serving/blob/master/tensorflow_serving/apis/prediction_log.proto#:%7E:text=message-,PredictionLog,-%7B) (if it's originally in a different format) and using [TFRecordWriter](https://www.tensorflow.org/api_docs/python/tf/io/TFRecordWriter) to write the PredictionLog entries into `YourSavedModel/assets.extra/tf_serving_warmup_requests`.\n- By using TFX Infra Validator [option to export a Saved Model with warmup](https://www.tensorflow.org/tfx/guide/infra_validator#producing_a_savedmodel_with_warmup). With this option the TFX Infa Validator will populate `YourSavedModel/assets.extra/tf_serving_warmup_requests` based on the validation requests provided via [RequestSpec](https://www.tensorflow.org/tfx/guide/infra_validator#requestspec)."]]