AI 이미지 및 음성
AI 기술은 텍스트를 처리하는 것 이상의 일을 할 수 있습니다. 즉, 고품질 이미지를 생성하고 음성을 처리할 수 있습니다. 이 기사에서는 Ubuntu 26.04에 주류 AI 이미지 생성 및 음성 인식 도구를 설치하고 사용하는 방법을 다룹니다.
안정확산 WebUI (AUTOMATIC1111)
AUTOMATIC1111의 Stable Diffusion WebUI는 가장 널리 사용되는 AI 이미지 생성 도구로, 텍스트-이미지(txt2img), 이미지-이미지(img2img), 인페인팅 등을 지원하는 풍부한 기능의 웹 인터페이스를 제공합니다.
시스템 요구 사항
- 8GB 이상의 VRAM을 갖춘 NVIDIA GPU 권장
- Python 3.10+
- 최소 15GB의 디스크 공간(기본 모델은 각각 4~7GB)
종속성 설치
# Install system dependencies
sudo apt update
sudo apt install -y git python3 python3-venv python3-pip \
libgl1 libglib2.0-0 libsm6 libxext6 libxrender1 \
wget curl
# Ensure NVIDIA drivers and CUDA are installed (see GPU Setup section)
nvidia-smiStable Diffusion WebUI 설치
# Clone the repository
cd ~
git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui.git
cd stable-diffusion-webui
# First launch (automatically installs Python dependencies and downloads base models)
# This may take 10-30 minutes depending on network speed
./webui.sh# Custom launch parameters
./webui.sh --listen --port 7860 --enable-insecure-extension-access
# Common launch parameters:
# --listen Allow remote access (default is local only)
# --port 7860 Specify port
# --xformers Enable xformers acceleration (recommended)
# --medvram Medium VRAM optimization (recommended for 8GB GPUs)
# --lowvram Low VRAM optimization (for 4-6GB GPUs)
# --no-half Disable half precision (needed for some AMD GPUs)모델 다운로드
Stable Diffusion의 핵심은 체크포인트 모델 파일로, 수동으로 다운로드하여 지정된 디렉터리에 배치해야 합니다.
# Model storage directory
mkdir -p ~/stable-diffusion-webui/models/Stable-diffusion
# Download Stable Diffusion XL base model
wget -O ~/stable-diffusion-webui/models/Stable-diffusion/sd_xl_base_1.0.safetensors \
"https://huggingface.co/stabilityai/stable-diffusion-xl-base-1.0/resolve/main/sd_xl_base_1.0.safetensors"
# Download SDXL Refiner (optional, for image refinement)
wget -O ~/stable-diffusion-webui/models/Stable-diffusion/sd_xl_refiner_1.0.safetensors \
"https://huggingface.co/stabilityai/stable-diffusion-xl-refiner-1.0/resolve/main/sd_xl_refiner_1.0.safetensors"# Download VAE model (improves image colors)
mkdir -p ~/stable-diffusion-webui/models/VAE
wget -O ~/stable-diffusion-webui/models/VAE/sdxl_vae.safetensors \
"https://huggingface.co/stabilityai/sdxl-vae/resolve/main/sdxl_vae.safetensors"인기 있는 커뮤니티 모델 다운로드
커뮤니티는 Civitai 및 Hugging Face에 대한 다양한 미세 조정 모델을 제공합니다.
# Place models in the corresponding directories
# Checkpoint models -> models/Stable-diffusion/
# LoRA models -> models/Lora/
# VAE models -> models/VAE/
# Embeddings -> embeddings/
mkdir -p ~/stable-diffusion-webui/models/Lora
mkdir -p ~/stable-diffusion-webui/embeddings
# Example: download a model from Hugging Face
# wget -O ~/stable-diffusion-webui/models/Stable-diffusion/model_name.safetensors "download-link"WebUI 사용
실행 후 브라우저에서 http://localhost:7860을 방문하세요.
- txt2img — 이미지를 생성하라는 메시지를 입력하세요.
- img2img — 참조 이미지를 업로드하고 프롬프트에 따라 수정합니다.
- Inpaint — 로컬 다시 그릴 이미지 영역을 선택합니다.
- 확장 — 플러그인을 설치하여 기능 확장
예제 프롬프트:
Positive prompt: a beautiful mountain landscape, sunset, golden hour,
photorealistic, 8k, masterpiece, best quality
Negative prompt: blurry, low quality, distorted, watermark, text시작 스크립트 만들기
cat > ~/stable-diffusion-webui/start.sh << 'EOF'
#!/bin/bash
cd ~/stable-diffusion-webui
./webui.sh --listen --xformers --enable-insecure-extension-access
EOF
chmod +x ~/stable-diffusion-webui/start.shGPU에 8GB VRAM이 있는 경우 --medvram --xformers으로 실행하는 것이 좋습니다. SDXL 모델의 경우 최상의 경험을 위해 최소 10GB VRAM이 권장됩니다. SD 1.5 시리즈 모델은 단 4GB VRAM만으로도 원활하게 실행됩니다.
ComfyUI
ComfyUI는 시각적 노드 연결을 통해 이미지 생성 파이프라인을 구축하여 극도의 유연성을 제공하는 노드 기반 워크플로우 AI 이미지 생성 도구입니다.
ComfyUI 설치
# Install system dependencies
sudo apt install -y git python3 python3-venv python3-pip
# Clone ComfyUI
cd ~
git clone https://github.com/comfyanonymous/ComfyUI.git
cd ComfyUI
# Create a Python virtual environment
python3 -m venv venv
source venv/bin/activate
# Install PyTorch (CUDA version)
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu126
# Install ComfyUI dependencies
pip install -r requirements.txtComfyUI 실행
cd ~/ComfyUI
source venv/bin/activate
# Launch (default port 8188)
python main.py
# Allow remote access
python main.py --listen 0.0.0.0 --port 8188
# Low VRAM mode
python main.py --lowvram모델 설치
ComfyUI의 모델 디렉토리 구조:
# Model directories
ls ~/ComfyUI/models/
# checkpoints/ -- Checkpoint models
# clip/ -- CLIP models
# loras/ -- LoRA models
# vae/ -- VAE models
# controlnet/ -- ControlNet models
# upscale_models/ -- Upscaling models
# You can reuse AUTOMATIC1111 models via symlinks
ln -s ~/stable-diffusion-webui/models/Stable-diffusion/* ~/ComfyUI/models/checkpoints/
ln -s ~/stable-diffusion-webui/models/Lora/* ~/ComfyUI/models/loras/
ln -s ~/stable-diffusion-webui/models/VAE/* ~/ComfyUI/models/vae/노드 워크플로
ComfyUI는 노드와 연결을 사용하여 이미지 생성 파이프라인을 구축합니다.
- 브라우저에서
http://localhost:8188을 엽니다. - 기본 워크플로에는 기본 txt2img 노드가 포함되어 있습니다.
- 캔버스를 마우스 오른쪽 버튼으로 클릭하여 새 노드를 추가하세요.
- 생성을 시작하려면 “큐 프롬프트”를 클릭하세요.
ComfyUI Manager 설치(권장):
# ComfyUI Manager makes it easy to manage custom nodes
cd ~/ComfyUI/custom_nodes
git clone https://github.com/ltdrdata/ComfyUI-Manager.git
# After restarting ComfyUI, a Manager button will appear in the interface인기 있는 사용자 정의 노드
cd ~/ComfyUI/custom_nodes
# Advanced ControlNet nodes
git clone https://github.com/Fannovel16/comfyui_controlnet_aux.git
# IP-Adapter nodes (style transfer)
git clone https://github.com/cubiq/ComfyUI_IPAdapter_plus.git
# Image upscaling nodes
git clone https://github.com/ssitu/ComfyUI_UltimateSDUpscale.git
# Install dependencies for each node
cd ~/ComfyUI
source venv/bin/activate
for dir in custom_nodes/*/; do
if [ -f "$dir/requirements.txt" ]; then
pip install -r "$dir/requirements.txt"
fi
doneComfyUI는 AUTOMATIC1111 WebUI보다 학습 곡선이 더 가파르지만 더 뛰어난 유연성과 재현성을 제공합니다. 기본 워크플로로 시작하여 점차적으로 복잡한 노드를 추가합니다. https://comfyworkflows.com 또는 https://openart.ai/workflows.에서 커뮤니티 공유 워크플로를 다운로드할 수 있습니다.
OpenAI 속삭임
OpenAI Whisper는 매우 높은 정확도로 여러 언어로 음성을 텍스트로 변환하는 기능을 지원하는 강력한 음성 인식 모델입니다.
속삭임 설치
# Install system dependencies
sudo apt install -y python3 python3-pip python3-venv ffmpeg
# Create a virtual environment (recommended)
python3 -m venv ~/whisper-env
source ~/whisper-env/bin/activate
# Install Whisper
pip install openai-whisper
# Or install with GPU acceleration (requires CUDA)
pip install openai-whisper torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu126음성을 텍스트로
# Activate virtual environment
source ~/whisper-env/bin/activate
# Basic usage: transcribe an audio file
whisper audio.mp3 --language en --model medium
# Specify output format
whisper audio.mp3 --language en --model medium --output_format txt
whisper audio.mp3 --language en --model medium --output_format srt # Subtitle format
whisper audio.mp3 --language en --model medium --output_format vtt # WebVTT format
whisper audio.mp3 --language en --model medium --output_format json
# Auto-detect language
whisper audio.mp3 --model medium
# Specify output directory
whisper audio.mp3 --language en --model medium --output_dir ~/transcripts/속삭임 모델 크기
| 모델 | 매개변수 | VRAM 필요 | 상대 속도 | 정확성 |
|---|---|---|---|---|
tiny | 39M | ~1GB | 가장 빠른 | 공정한 |
base | 74M | ~1GB | 매우 빠르다 | 좋은 |
small | 244M | ~2GB | 빠른 | 더 나은 |
medium | 769M | ~5GB | 중간 | 매우 좋은 |
large-v3 | 1.5B | ~10GB | 느리게 | 최상의 |
turbo | 809M | ~6GB | 빠른 | 매우 좋은 |
# Use different model sizes
whisper audio.mp3 --model tiny # Fast but lower accuracy
whisper audio.mp3 --model small # Balance of speed and accuracy
whisper audio.mp3 --model large-v3 # Highest accuracy
whisper audio.mp3 --model turbo # Balance of speed and large model accuracyPython 사용법
import whisper
# Load model
model = whisper.load_model("medium")
# Transcribe audio
result = model.transcribe("audio.mp3", language="en")
# Output text
print(result["text"])
# Output segments with timestamps
for segment in result["segments"]:
print(f"[{segment['start']:.1f}s - {segment['end']:.1f}s] {segment['text']}")더 빠른 속삭임 사용(권장)
fast-whisper는 CTranslate2 엔진을 사용하며 VRAM 사용량이 적은 원래 Whisper보다 4배 빠릅니다.
# Install faster-whisper
pip install faster-whisperfrom faster_whisper import WhisperModel
# Load model (auto-downloads)
model = WhisperModel("medium", device="cuda", compute_type="float16")
# Transcribe
segments, info = model.transcribe("audio.mp3", language="en")
print(f"Detected language: {info.language}, confidence: {info.language_probability:.2f}")
for segment in segments:
print(f"[{segment.start:.1f}s -> {segment.end:.1f}s] {segment.text}")# faster-whisper command line usage
pip install faster-whisper-cli
faster-whisper audio.mp3 --language en --model medium --output_format srt일괄 처리 오디오
# Create a batch transcription script
cat > ~/transcribe.sh << 'SCRIPT'
#!/bin/bash
# Batch transcribe all audio files in a directory
INPUT_DIR="${1:-.}"
OUTPUT_DIR="${2:-./transcripts}"
MODEL="${3:-medium}"
source ~/whisper-env/bin/activate
mkdir -p "$OUTPUT_DIR"
for file in "$INPUT_DIR"/*.{mp3,wav,m4a,flac,ogg}; do
[ -f "$file" ] || continue
echo "Transcribing: $file"
whisper "$file" --language en --model "$MODEL" \
--output_format srt --output_dir "$OUTPUT_DIR"
done
echo "Transcription complete! Results saved to $OUTPUT_DIR"
SCRIPT
chmod +x ~/transcribe.sh
# Use the script
# ~/transcribe.sh ~/audio_files ~/output medium일반 전사의 경우 medium 모델은 정확성과 속도의 최상의 균형을 제공합니다. 정확도를 최대화하려면 large-v3을 사용하세요. 실시간 전사 또는 대용량 파일 처리의 경우 faster-whisper를 사용하십시오. 동일한 정확도 수준에서 약 4배의 속도 향상을 제공합니다.
도구 비교
| 도구 | 유형 | GPU 필요 | 최고의 대상 |
|---|---|---|---|
| AUTOMATIC1111 WebUI | 이미지 생성 | 4GB 이상 | 모든 기능을 갖춘 초보자 친화적인 |
| ComfyUI | 이미지 생성 | 4GB 이상 | 고급 워크플로, 재현성 |
| 속삭임 | 음성-텍스트 | 선택 과목 | 오디오 전사, 자막 |
| 더 빠른 속삭임 | 음성-텍스트 | 추천 | 대용량 오디오 처리 |