แนวทางการ fine-tuning

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

Jasmin Ludolf

Senior Data Science Content Developer, DataCamp

Fine-tuning

 

LLMs fine-tuning chemistry use case

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

Full fine-tuning

 

  • อัปเดต weight ของโมเดลทั้งหมด
  • ใช้ทรัพยากรการคำนวณสูง

 

Full fine-tuning

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

Partial fine-tuning

 

  • บาง layer ถูกตรึงค่าไว้
  • อัปเดตเฉพาะ layer ที่เกี่ยวกับงานนั้น ๆ

 

Partial fine-tuning

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

Transfer learning

 

  • นำโมเดลที่ผ่านการฝึกมาแล้วไปปรับใช้กับงานที่เกี่ยวข้อง
  • ถ่ายทอดความรู้จากโดเมนหนึ่งสู่โดเมนที่ใกล้เคียง

The transfer learning paradigm

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

N-shot learning

  • Zero-shot learning: ไม่มีตัวอย่าง
  • One-shot learning: มีหนึ่งตัวอย่าง
  • Few-shot learning: มีตัวอย่างหลายรายการ
Python เบื้องต้นสำหรับ LLMs

One-shot learning

from transformers import pipeline

generator = pipeline(task="sentiment-analysis", model="distilbert-base-uncased-finetuned-sst-2-english")

input_text = """
Classify the sentiment of this sentence as either Positive or Negative.
Example:
Text: "I'm feeling great today!" Sentiment: Positive
Text: "The weather today is lovely." Sentiment:
"""

result = generator(input_text, max_length=100)
print(result[0]["label"])
POSITIVE
Python เบื้องต้นสำหรับ LLMs

มาฝึกกันเถอะ!

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

Preparing Video For Download...