Deep Learning Frameworks

From HPCWIKI
Revision as of 14:47, 16 July 2026 by Clara (talk | contribs) (Phase 6.1: LLM-Optimized Wiki Template migration)
Jump to navigation Jump to search

Deep Learning Frameworks

Template:Status

Template:TOC

Overview

딥러닝 모델을 설계, 훈련, 배포하기 위한 소프트웨어 라이브러리 및 프레임워크의 생태계.

Summary

  • 무엇인가? TensorFlow, PyTorch, Keras 등 딥러닝 모델 개발을 위한 프레임워크
  • 왜 필요한가? 복잡한 신경망 연산을 추상화하여 개발자가 모델에 집중할 수 있게 함
  • 언제 사용하는가? 이미지 인식, NLP, 추천 시스템 등 모든 딥러닝 프로젝트

---

Purpose

주요 딥러닝 프레임워크의 특징, 비교, 선택 가이드 제공

  • Goal: 개발자가 프로젝트에 맞는 프레임워크를 선택할 수 있도록 정보 제공
  • Scope: TensorFlow, PyTorch, Keras, MXNet, Caffe, Theano, CNTK 등 주요 프레임워크
  • Non-goals: 프레임워크별 상세 API 문서화, 커스텀 프레임워크 개발 가이드

---

Key Concepts

Framework Developer Status GPU Support Language
TensorFlow Google Active Yes Python
PyTorch Meta (Facebook) Active Yes Python
Keras Google (TF 통합) Merged into TensorFlow Yes Python
MXNet Apache Development halted (late 2022) Yes Multiple
Caffe Berkeley AI Research Merged into PyTorch (Caffe2) Yes C++
Theano Universite de Montreal Dead (Keras, Lasagne, Blocks 기반) Yes Python
CNTK Microsoft No longer actively developed (v2.7) Yes Python 3.6

---

Architecture

TensorFlow Architecture

  • Graph-based computation (Static computational graph)
  • Keras high-level API
  • TensorFlow Serving for deployment

PyTorch Architecture

  • Dynamic computational graph (Define-by-Run)
  • TorchScript for deployment
  • PyTorch Lightning for structured training

---

Workflow

  1. 프레임워크 선택 (프로젝트 요구사항 기반)
  2. 환경 설정 (CUDA, cuDNN, GPU 드라이버)
  3. 모델 정의 (네트워크 아키텍처)
  4. 데이터 로딩 및 전처리
  5. 모델 훈련 (GPU 가속)
  6. 모델 평가 및 검증
  7. 모델 저장 및 배포

---

Configuration

# PyTorch 설치 (CUDA 11.8)
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118

# TensorFlow 설치 (CUDA 12.0)
pip install tensorflow[and-cuda]

---

Examples

PyTorch 모델 정의

import torch
import torch.nn as nn

class SimpleNet(nn.Module):
    def __init__(self):
        super().__init__()
        self.fc = nn.Linear(784, 10)
    
    def forward(self, x):
        return self.fc(x.view(x.size(0), -1))

model = SimpleNet()

TensorFlow/Keras 모델 정의

import tensorflow as tf

model = tf.keras.Sequential([
    tf.keras.layers.Flatten(input_shape=(28, 28)),
    tf.keras.layers.Dense(128, activation='relu'),
    tf.keras.layers.Dense(10)
])

---

Best Practices

  • 프로덕션 배포: PyTorch는 TorchScript, TensorFlow는 SavedModel 사용
  • GPU 가속: cuDNN 버전 호환성 반드시 확인
  • 대규모 분산 훈련: TensorFlow는 tf.distribute, PyTorch는 DDP 사용
  • 모델 최적화: ONNX 형식으로 변환하여 다양한 환경에서 배포

---

Performance

Framework Training Speed Inference Speed Ecosystem
TensorFlow Fast Fast Mature (TF Serving, TFLite, TF.js)
PyTorch Fast Fast Growing (TorchServe, TorchScript)
Keras Fast (TF 백엔드) Fast (TF 백엔드) Simple API, limited customization

---

Limitations

  • TensorFlow: Graph 기반이라 디버깅이 어려움 (TF2에서 개선됨)
  • PyTorch: 프로덕션 배포 생태계가 TensorFlow보다 성숙도 낮음
  • Theano/CNTK: 더 이상 개발되지 않음 - 新项目 권장 안함
  • MXNet: 커뮤니티 활동이 크게 감소

---

References

---

Related Pages

---