เริ่มต้นใช้งานเริ่มต้นใช้งานได้ฟรี

ใช้งานโมเดลที่ fine-tune แล้ว

โมเดลผ่านการ fine-tune เรียบร้อยแล้ว ถึงเวลานำไปใช้กับข้อมูลใหม่และสร้างการจำแนกประเภท มาดูกันว่าโมเดลที่ fine-tune แล้วจะแท็กการโต้ตอบใหม่ว่ามีความเสี่ยงต่ำหรือสูงในการเลิกใช้บริการ (churn) ได้ดีแค่ไหน

model ที่ผ่านการ fine-tune และ tokenizer ได้ถูกโหลดไว้ให้แล้ว

แบบฝึกหัดนี้เป็นส่วนหนึ่งของหลักสูตร

Python เบื้องต้นสำหรับ LLMs

ดูคอร์ส

คำแนะนำการฝึกหัด

  • แปลงข้อมูลใหม่ให้เป็น token
  • ส่ง input ที่แปลงแล้วเข้าสู่โมเดลที่ fine-tune ไว้ โดยปิดการคำนวณ gradient
  • ดึงผลการพยากรณ์ใหม่ออกมา

แบบฝึกหัดเชิงโต้ตอบแบบลงมือทำ

ลองทำแบบฝึกหัดนี้โดยเติมโค้ดตัวอย่างนี้ให้สมบูรณ์

input_text = ["I'd just like to say, I love the product! Thank you!"]

# Tokenize the new data
inputs = ____(____, return_tensors="pt", padding=True, truncation=True)

# Pass the tokenized inputs through the model
with ____:
    outputs = ____

# Extract the new predictions
predicted_labels = ____.____(outputs.logits, dim=1).tolist()

label_map = {0: "Low risk", 1: "High risk"}
for i, predicted_label in enumerate(predicted_labels):
    churn_label = label_map[predicted_label]
    print(f"\n Input Text {i + 1}: {input_text[i]}")
    print(f"Predicted Label: {predicted_label}")
แก้ไขและรันโค้ด