🎯 Mục tiêu bài học
Trong bài này, chúng ta sẽ tìm hiểu cách các AI models tạo ra hình ảnh - từ lý thuyết đến thực hành.
Sau bài này, bạn sẽ:
✅ Hiểu cách Diffusion Models hoạt động (forward/reverse process) ✅ Nắm các tham số quan trọng: CFG Scale, Steps, Seed ✅ Thực hành tạo hình ảnh với DALL-E 3 và Replicate API ✅ Áp dụng best practices cho image generation
🔍 Diffusion Models là gì?
Diffusion models học cách tạo hình ảnh bằng cách:
- Forward process: Thêm noise vào image cho đến khi thành random noise
- Reverse process: Học cách remove noise từng bước để tạo image
Checkpoint
Bạn đã hiểu forward process và reverse process trong Diffusion Models chưa?
📊 Các loại Image Generation Models
1. DALL-E (OpenAI)
- DALL-E 2: 1024x1024, inpainting, variations
- DALL-E 3: Text tốt hơn, prompt chính xác hơn
1from openai import OpenAI23client = OpenAI()45response = client.images.generate(6 model="dall-e-3",7 prompt="A serene Vietnamese countryside with rice paddies at sunset, watercolor style",8 size="1024x1024",9 quality="hd",10 n=111)1213image_url = response.data[0].url14print(image_url)