Vision Language Model(VLM) 프롬프트 만들기
다음 두 개의 연습 문제에서는 Hugging Face의 BBC News 데이터셋을 사용해 멀티모달 모델로 뉴스 기사와 해당 헤드라인 이미지를 함께 분석해 감성을 파악해 볼 거예요.

먼저, 이미지와 뉴스 기사를 모두 포함하는 모델용 채팅 템플릿을 준비하겠습니다. 데이터셋(dataset)과 헤드라인 이미지(image)는 이미 로드되어 있어요.
이 연습은 강의의 일부입니다
Hugging Face로 배우는 멀티모달 모델
연습 안내
dataset에서 인덱스6에 있는 데이터 포인트로부터 뉴스 기사 본문(content)을 불러오세요.- f-string을 사용해
content를text_query에 삽입하도록 텍스트 쿼리를 완성하세요. image와text_query를 채팅 템플릿에 추가하고,text_query의 콘텐츠 타입을"text"로 지정하세요.
실습형 인터랙티브 연습
이 예제를 이 샘플 코드를 완성하여 풀어보세요.
# Load the news article content from datapoint 6
content = ____
# Complete the text query
text_query = f"Does the news article have a positive, negative, or neutral impact on championship winning chances: {____}. Provide reasoning."
# Add the text query dictionary to the chat template
chat_template = [
{
"role": "user",
"content": [
{
"type": "image",
"image": ____,
},
____
],
}
]