올바른 모델 구조 사용하기
질의응답(question-answering)은 추출형(extractive) 또는 생성형(generative)으로 나눌 수 있으며, 입력과 출력을 올바르게 처리하려면 서로 다른 transformer 구조가 필요해요.
다음 중 하나를 사용합니다:
"distilbert-base-uncased-distilled-squad"같은 인코더 전용 모델"gpt2"같은 디코더 전용 모델
작업별로 널리 쓰이는 모델에 대한 지식을 활용해 알맞은 모델을 선택하세요. pipeline과 모나리자에 대한 텍스트는 이미 로드되어 있어요.
이 연습은 강의의 일부입니다
Python으로 배우는 LLM 입문
실습형 인터랙티브 연습
이 예제를 이 샘플 코드를 완성하여 풀어보세요.
question = "Who painted the Mona Lisa?"
# Define the appropriate model
qa = pipeline(task="question-answering", model=____)
output = qa(question=question, context=text)
print(output['answer'])