เริ่มต้นใช้งานเริ่มต้นใช้งานได้ฟรี

ค้นหาโมเดล text-to-image ที่ได้รับความนิยมสูงสุด

ถึงเวลาปรับการค้นหาเพื่อหาและโหลดโมเดล Stable Diffusion สำหรับงาน text-to-image ที่ได้รับความนิยมสูงสุดจาก CompVis บน Hugging Face Hub

Photo of a labrador chasing a ball

Hugging Face Hub API ถูกโหลดไว้แล้ว (api) เช่นเดียวกับโมดูล StableDiffusionPipeline จากไลบรารี diffusers ด้วยโมเดล Stable Diffusion คุณสามารถสร้างภาพจาก prompt ใดก็ได้ตามต้องการ เช่น "a black labrador chasing a tennis ball"

แบบฝึกหัดนี้เป็นส่วนหนึ่งของหลักสูตร

โมเดล Multi-Modal ด้วย Hugging Face

ดูคอร์ส

คำแนะนำการฝึกหัด

  • ใช้เฉพาะโมเดลที่รองรับงาน text-to-image เท่านั้น
  • ใช้แท็กที่เหมาะสมเพื่อให้แน่ใจว่าโมเดลสามารถโหลดได้ด้วยคลาส StableDiffusionPipeline จากไลบรารี diffusers
  • เรียงลำดับผลลัพธ์ตามจำนวน "likes"
  • โหลดโมเดลที่ได้รับความนิยมสูงสุดจาก models โดยใช้ ID ของโมเดลนั้น

แบบฝึกหัดเชิงโต้ตอบแบบลงมือทำ

ลองทำแบบฝึกหัดนี้โดยเติมโค้ดตัวอย่างนี้ให้สมบูรณ์

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].____)
แก้ไขและรันโค้ด