AI-Master-Book
  • about AI-Master-Book
  • AI Master Book
    • 이상치 탐지 with Python
    • 베이지안 뉴럴네트워크 (BNN) with Python
    • 그래프 뉴럴네트워크 (GNN) with Python
    • 데이터 마케팅 분석 with Python
  • LLM MASTER BOOK
    • OpenAI API 쿡북 with Python
    • 기초부터 심화까지 RAG 쿡북 with Python
    • MCP 에이전트 쿡북 with Python
  • LLMs
    • OpenAI API
      • 1️⃣ChatCompletion
      • 2️⃣DALL-E
      • 3️⃣Text to Speech
      • 4️⃣Video to Transcripts
      • 5️⃣Assistants API
      • 6️⃣Prompt Engineering
      • 7️⃣OpenAI New GPT-4o
    • LangChain
      • LangChain Basic
        • 1️⃣Basic Modules
        • 2️⃣Model I/O
        • 3️⃣Prompts
        • 4️⃣Chains
        • 5️⃣Agents
        • 6️⃣Tools
        • 7️⃣Memory
      • LangChain Intermediate
        • 1️⃣OpenAI LLM
        • 2️⃣Prompt Template
        • 3️⃣Retrieval
        • 4️⃣RAG ChatBot
        • 5️⃣RAG with Gemini
        • 6️⃣New Huggingface-LangChain
        • 7️⃣Huggingface Hub
        • 8️⃣SQL Agent & Chain
        • 9️⃣Expression Language(LCEL)
        • 🔟Llama3-8B with LangChain
      • LangChain Advanced
        • 1️⃣LLM Evaluation
        • 2️⃣RAG Evaluation with RAGAS
        • 3️⃣LangChain with RAGAS
        • 4️⃣RAG Paradigms
        • 5️⃣LangChain: Advance Techniques
        • 6️⃣LangChain with NeMo-Guardrails
        • 7️⃣LangChain vs. LlamaIndex
        • 8️⃣LangChain LCEL vs. LangGraph
    • LlamaIndex
      • LlamaIndex Basic
        • 1️⃣Introduction
        • 2️⃣Customization
        • 3️⃣Data Connectors
        • 4️⃣Documents & Nodes
        • 5️⃣Naive RAG
        • 6️⃣Advanced RAG
        • 7️⃣Llama3-8B with LlamaIndex
        • 8️⃣LlmaPack
      • LlamaIndex Intermediate
        • 1️⃣QueryEngine
        • 2️⃣Agent
        • 3️⃣Evaluation
        • 4️⃣Evaluation-Driven Development
        • 5️⃣Fine-tuning
        • 6️⃣Prompt Compression with LLMLingua
      • LlamaIndex Advanced
        • 1️⃣Agentic RAG: Router Engine
        • 2️⃣Agentic RAG: Tool Calling
        • 3️⃣Building Agent Reasoning Loop
        • 4️⃣Building Multi-document Agent
    • Hugging Face
      • Huggingface Basic
        • 1️⃣Datasets
        • 2️⃣Tokenizer
        • 3️⃣Sentence Embeddings
        • 4️⃣Transformers
        • 5️⃣Sentence Transformers
        • 6️⃣Evaluate
        • 7️⃣Diffusers
      • Huggingface Tasks
        • NLP
          • 1️⃣Sentiment Analysis
          • 2️⃣Zero-shot Classification
          • 3️⃣Aspect-Based Sentiment Analysis
          • 4️⃣Feature Extraction
          • 5️⃣Intent Classification
          • 6️⃣Topic Modeling: BERTopic
          • 7️⃣NER: Token Classification
          • 8️⃣Summarization
          • 9️⃣Translation
          • 🔟Text Generation
        • Audio & Tabular
          • 1️⃣Text-to-Speech: TTS
          • 2️⃣Speech Recognition: Whisper
          • 3️⃣Audio Classification
          • 4️⃣Tabular Qustaion & Answering
        • Vision & Multimodal
          • 1️⃣Image-to-Text
          • 2️⃣Text to Image
          • 3️⃣Image to Image
          • 4️⃣Text or Image-to-Video
          • 5️⃣Depth Estimation
          • 6️⃣Image Classification
          • 7️⃣Object Detection
          • 8️⃣Segmentatio
      • Huggingface Optimization
        • 1️⃣Accelerator
        • 2️⃣Bitsandbytes
        • 3️⃣Flash Attention
        • 4️⃣Quantization
        • 5️⃣Safetensors
        • 6️⃣Optimum-ONNX
        • 7️⃣Optimum-NVIDIA
        • 8️⃣Optimum-Intel
      • Huggingface Fine-tuning
        • 1️⃣Transformer Fine-tuning
        • 2️⃣PEFT Fine-tuning
        • 3️⃣PEFT: Fine-tuning with QLoRA
        • 4️⃣PEFT: Fine-tuning Phi-2 with QLoRA
        • 5️⃣Axoltl Fine-tuning with QLoRA
        • 6️⃣TRL: RLHF Alignment Fine-tuning
        • 7️⃣TRL: DPO Fine-tuning with Phi-3-4k-instruct
        • 8️⃣TRL: ORPO Fine-tuning with Llama3-8B
        • 9️⃣Convert GGUF gemma-2b with llama.cpp
        • 🔟Apple Silicon Fine-tuning Gemma-2B with MLX
        • 🔢LLM Mergekit
    • Agentic LLM
      • Agentic LLM
        • 1️⃣Basic Agentic LLM
        • 2️⃣Multi-agent with CrewAI
        • 3️⃣LangGraph: Multi-agent Basic
        • 4️⃣LangGraph: Agentic RAG with LangChain
        • 5️⃣LangGraph: Agentic RAG with Llama3-8B by Groq
      • Autonomous Agent
        • 1️⃣LLM Autonomous Agent?
        • 2️⃣AutoGPT: Worldcup Winner Search with LangChain
        • 3️⃣BabyAGI: Weather Report with LangChain
        • 4️⃣AutoGen: Writing Blog Post with LangChain
        • 5️⃣LangChain: Autonomous-agent Debates with Tools
        • 6️⃣CAMEL Role-playing Autonomous Cooperative Agents
        • 7️⃣LangChain: Two-player Harry Potter D&D based CAMEL
        • 8️⃣LangChain: Multi-agent Bid for K-Pop Debate
        • 9️⃣LangChain: Multi-agent Authoritarian Speaker Selection
        • 🔟LangChain: Multi-Agent Simulated Environment with PettingZoo
    • Multimodal
      • 1️⃣PaliGemma: Open Vision LLM
      • 2️⃣FLUX.1: Generative Image
    • Building LLM
      • 1️⃣DSPy
      • 2️⃣DSPy RAG
      • 3️⃣DSPy with LangChain
      • 4️⃣Mamba
      • 5️⃣Mamba RAG with LangChain
      • 7️⃣PostgreSQL VectorDB with pgvorco.rs
Powered by GitBook
On this page
  • FLUX.1 특징
  • FLUX.1 사용 방법
  • Hugging Face Pipeline
  • FLUX.1 Prompt Structure and Components 노하우
  1. LLMs
  2. Multimodal

FLUX.1: Generative Image

PreviousPaliGemma: Open Vision LLMNextBuilding LLM

Last updated 9 months ago

FLUX.1 특징

1. Speed and Efficiency

FLUX.1은 이미지를 빠르게 생성하도록 설계되어 StableDiffusion, Midjourney, Colors, Aura 같은 경쟁사보다 빠른 속도를 자랑합니다. 이 모델은 세 가지 버전으로 제공됩니다:

  • FLUX.1[Schnell]: Flux Schnell은 품질은 낮지만 Pro 모델보다 약 10배 빠른 속도로 이미지를 생성합니다.

  • FLUX.1[Dev]: Flux Dev는 개발자를 위해 맞춤화되어 이미지 간 생성 같은 고급 기능을 지원합니다.

  • FLUX.1[Pro]: 120억 개의 파라미터를 지원하는 가장 강력한 버전인 Flux Pro는 비공개 소스이며 API를 통해 사용할 수 있습니다.

2. Prompt Adherence and Quality

Flux.1의 뛰어난 기능 중 하나는 뛰어난 프롬프트 준수입니다. 간단한 프롬프트든 복잡한 프롬프트를 사용하든 이 모델은 입력 설명과 거의 일치하는 고품질 이미지를 일관되게 제공합니다. 예를 들어, "카메라를 바라보는 고양이, 어안 렌즈"와 같은 간단한 프롬프트는 Midjourney V6의 결과와 비슷한 결과를 생성합니다. 보다 복잡한 프롬프트는 장면 내 사물의 배치와 디테일을 놀라울 정도로 정확하게 지시할 수 있습니다.

FLUX.1 사용 방법

1. FLUX1 AI 공식홈

FLUX1 AI 공식 홈에서 schnell을 Free로 사용할 수 있으나 속도는 느리다. Dev, Pro를 사용하려면 월구독제를 사용해야 한다.

2. Replicate

Replicate는 사용자가 클라우드에서 머신 러닝 모델을 실행할 수 있는 사용자 친화적인 플랫폼입니다. Flux Point1은 Replicate에서 무료로 액세스하고 테스트할 수 있습니다.

3. Poe

https://poe.com/ 에서 FLUX models을 선택하여 활용

4. Seaart.ai

Searart.ai는 최근 추가된 FLUX.1 모델을 포함한 다양한 확산 모델로 구동되는 이미지 생성 도구 모음을 제공하는 AI 플랫폼입니다. 이 플랫폼을 통해 사용자는 고품질 이미지를 무료로 손쉽게 생성할 수 있습니다. Seaart.ai는 매일 약 150개의 크레딧을 제공하며, 각 이미지 생성 작업에는 화면 비율에 따라 약 1크레딧이 소요됩니다. 이미지 대 이미지 작업에는 크레딧이 약간 더 필요할 수 있습니다.

5. Fal.ai

Fal.ai는 FLUX.1에 액세스할 수 있는 또 다른 플랫폼입니다. 프로세스는 다른 플랫폼과 유사하여 텍스트 프롬프트를 사용하여 이미지를 쉽게 생성할 수 있습니다.

6. Toast AI

Toast AI는 FLUX.1을 포함한 최신 AI 논문과 모델을 호스팅하는 무료 오픈 소스 플랫폼입니다. FLUx.1 개발 모델은 애니메이션을 포함한 다양한 스타일의 이미지를 생성하는 데 사용할 수 있습니다.

7. API Access

고급 또는 상업적 용도로 사용하려면 Black Forest Labs에서 제공하는 API를 통해 FLUX.1 [pro]에 직접 액세스할 수 있습니다. https://flux-ai.io 에 가입 후 API Key를 발행하여 유료로 사용하면 된다.

8. Hugging Face

Huggingface는 FLUX.1을 기반으로 하는 슈넬 모델의 평가판을 제공합니다. 이 플랫폼은 조정 가능한 설정으로 모델을 테스트할 수 있는 편리한 방법을 제공합니다.

Hugging Face Pipeline

Dependencies

%pip install transformers diffusers sentencepiece accelerate protobuf
import torch
from diffusers import FluxPipeline
import diffusers
from PIL import Image
import matplotlib.pyplot as plt
The installed version of bitsandbytes was compiled without GPU support. 8-bit optimizers, 8-bit multiplication, and GPU quantization are unavailable.

Flux Rope

# CUDA를 처리하도록 로프 함수 수정하기
_flux_rope = diffusers.models.transformers.transformer_flux.rope

def new_flux_rope(pos: torch.Tensor, dim: int, theta: int) -> torch.Tensor:
    assert dim % 2 == 0, "The dimension must be even."
    if pos.device.type == "cuda":
        return _flux_rope(pos.to("cpu"), dim, theta).to(device=pos.device)
    else:
        return _flux_rope(pos, dim, theta)

    diffusers.models.transformers.transformer_flux.rope = new_flux_rope

Pipeline

pipe = FluxPipeline.from_pretrained(
    "black-forest-labs/FLUX.1-schnell",
    revision='refs/pr/1',
    torch_dtype=torch.bfloat16
).to('cuda')
Loading pipeline components...:   0%|          | 7/7 [00:00<?, ?it/s]
Loading checkpoint shards:   0%|          | 2/2 [00:00<?, ?it/s]

Prompt

prompt = "A modern, minimalist Korean girl with dressed punk & goth look."

Generative Image

# Generate the image
out = pipe(
    prompt=prompt,
    guidance_scale=0.,
    height=1024,
    width=1024,
    num_inference_steps=4,
    max_sequence_length=256,
).images[0]

Save & Display

# Save the generated image
out.save("gen_girl.png")

# Display the generated image
image = Image.open("gen_girl.png")
plt.imshow(image)
plt.axis('off')
plt.show()

FLUX.1 Prompt Structure and Components 노하우

아래의 요소를 프롬프트에 반영하면 더 섬세하고 구체적인 이미지를 생성할 수 있습니다.

  1. Subject: The main focus of the image.

  2. Style: The artistic approach or visual aesthetic.

  3. Composition: How elements are arranged within the frame.

  4. Lighting: The type and quality of light in the scene.

  5. Color Palette: The dominant colors or color scheme.

  6. Mood/Atmosphere: The emotional tone or ambiance of the image.

  7. Technical Details: Camera settings, perspective, or specific visual techniques.

  8. Additional Elements: Supporting details or background information.

2️⃣
FLUX.1 AI: Free & Revolutionary FLUX AI Image Generator
black-forest-labs/flux-dev – Replicatereplicate
Free AI Art Generator: Create AI Art from Text - SeaArt AIseaart_web
Logo
Logo
FLUX.1 [dev] | AI Playground | fal.ai
Tost AI
FLUX.1 [Schnell] - a Hugging Face Space by black-forest-labshuggingface
Logo
Logo
Logo
Logo