텍스트 번역하기
영어→스페인어 번역 예시를 살펴보셨죠. 이제 스페인어→영어 번역으로 직접 해 보세요.
pipeline은 미리 로드되어 있습니다.
이 연습은 강의의 일부입니다
Python으로 배우는 LLM 입문
연습 안내
- 스페인어→영어 번역(
es_to_en)을 위한 파이프라인 작업을 정의하세요. - 모델 파이프라인을 사용해
spanish_text를 번역하세요.
실습형 인터랙티브 연습
이 예제를 이 샘플 코드를 완성하여 풀어보세요.
spanish_text = "Este curso sobre LLMs se está poniendo muy interesante"
# Define the pipeline
translator = pipeline(task=____, model="Helsinki-NLP/opus-mt-es-en")
# Translate the Spanish text
translations = ____(____, clean_up_tokenization_spaces=True)
print(translations[0]["translation_text"])