가장 인기 있는 텍스트-투-이미지 모델 찾기
Hugging Face Hub에서 CompVis의 가장 인기 있는 텍스트-투-이미지 Stable Diffusion 모델을 찾아 로드하도록 검색을 더 정교하게 해 보세요.

Hugging Face Hub API(api)와 diffusers 라이브러리의 StableDiffusionPipeline 모듈이 미리 로드되어 있어요. Stable Diffusion 모델을 사용하면 원하는 어떤 프롬프트로도 이미지를 생성할 수 있어요. 예: "a black labrador chasing a tennis ball".
이 연습은 강의의 일부입니다
Hugging Face로 배우는 멀티모달 모델
연습 안내
text-to-image작업용 모델만 사용하세요.diffusers라이브러리의StableDiffusionPipeline클래스로 로드할 수 있도록 적절한 태그를 사용하세요.- 결과를
"likes"수에 따라 정렬하세요. - ID를 사용해
models중 가장 인기 있는 모델을 로드하세요.
실습형 인터랙티브 연습
이 예제를 이 샘플 코드를 완성하여 풀어보세요.
models = api.list_models(
# Filter for text-to-image tasks
task="____",
author="CompVis",
# Filter for models that can be loaded by the diffusers library
tags="diffusers:____",
# Sort according to the most popular
sort="____"
)
models = list(models)
# Load the most popular model from models
pipe = StableDiffusionPipeline.from_pretrained(models[0].____)