Skip to content

junsoo999/vllm-benchmark-tools

Repository files navigation

vLLM Benchmark Tools

vLLM 프레임워크를 기반으로 GPU 성능을 측정하고 결과를 Teams, Slack 등으로 전송할 수 있는 파이썬 도구입니다.

주요 기능

  • 벤치마크 모듈: vLLM을 통한 GPU 성능 측정
  • 리포트 모듈: Teams, Slack, 이메일을 통한 결과 전송 (전략 패턴 활용)
  • 데이터 저장: pandas DataFrame, Excel, CSV 형태로 결과 저장
  • CLI 인터페이스: 명령행에서 쉽게 사용 가능
  • 설정 파일 지원: JSON/YAML 설정 파일로 복잡한 테스트 구성

설치

# 저장소 클론
git clone <repository-url>
cd vllm-benchmark-tools

# 패키지 설치
pip install -e .

# 또는 uv 사용
uv sync

빠른 시작

1. 기본 벤치마크 실행

python -m vllm_benchmark.cli --model meta-llama/Llama-2-7b-hf --verbose

2. Teams 알림과 함께 실행

python -m vllm_benchmark.cli \
  --model meta-llama/Llama-2-7b-hf \
  --teams-webhook https://your-teams-webhook-url \
  --verbose

3. 설정 파일로 실행

python -m vllm_benchmark.cli --config config.json

사용법

Python API 사용

from vllm_benchmark import (
    BenchmarkRunner, BenchmarkConfig, ModelConfig, TestConfig,
    ReportManager, ReportConfig, TeamsConfig
)

# 모델 설정
models = [
    ModelConfig(
        name="meta-llama/Llama-2-7b-hf",
        tensor_parallel_size=1
    )
]

# 테스트 설정
test_config = TestConfig(
    input_token_lengths=[1, 128, 512],
    output_token_lengths=[128, 256, 512],
    batch_sizes=[1, 16, 64, 128],
    warmup_iterations=3,
    test_iterations=5,
)

# 벤치마크 설정
benchmark_config = BenchmarkConfig(
    models=models,
    test_config=test_config,
    output_dir="./benchmark_results",
    verbose=True,
)

# 벤치마크 실행
runner = BenchmarkRunner(benchmark_config)
result = runner.run_benchmark()

# Teams 리포트 전송
teams_config = TeamsConfig(
    webhook_url="https://your-teams-webhook-url",
    title="vLLM 벤치마크 결과"
)

report_config = ReportConfig(
    enabled_notifiers=["teams"],
    teams=teams_config
)

report_manager = ReportManager(report_config)
report_manager.send_report(result)

CLI 옵션

python -m vllm_benchmark.cli --help

주요 옵션:

  • --model: 테스트할 모델 이름들
  • --tensor-parallel-size: 텐서 병렬 크기
  • --input-tokens: 입력 토큰 길이들
  • --output-tokens: 출력 토큰 길이들
  • --batch-sizes: 배치 크기들
  • --teams-webhook: Teams 웹훅 URL
  • --slack-webhook: Slack 웹훅 URL
  • --email-*: 이메일 설정 옵션들

설정 파일

JSON 설정 예제

{
  "models": [
    {
      "name": "meta-llama/Llama-2-7b-hf",
      "tensor_parallel_size": 1,
      "gpu_memory_utilization": 0.9
    }
  ],
  "test_config": {
    "input_token_lengths": [1, 128, 512],
    "output_token_lengths": [128, 256, 512],
    "batch_sizes": [1, 16, 64, 128],
    "warmup_iterations": 3,
    "test_iterations": 5
  },
  "report_config": {
    "enabled_notifiers": ["teams"],
    "teams": {
      "webhook_url": "https://your-teams-webhook-url",
      "title": "vLLM 벤치마크 결과"
    }
  }
}

알림 서비스 설정

Microsoft Teams

  1. Teams 채널에서 웹훅 URL 생성
  2. CLI에서 --teams-webhook 옵션 사용
  3. 또는 설정 파일에서 teams.webhook_url 설정

Slack

  1. Slack 앱에서 웹훅 URL 생성
  2. CLI에서 --slack-webhook 옵션 사용
  3. 또는 설정 파일에서 slack.webhook_url 설정

이메일

  1. SMTP 서버 정보 설정
  2. CLI에서 --email-* 옵션들 사용
  3. 또는 설정 파일에서 email 섹션 설정

결과 파일

벤치마크 결과는 다음 형태로 저장됩니다:

  • Excel: benchmark_results_YYYYMMDD_HHMMSS.xlsx
  • CSV: benchmark_results_YYYYMMDD_HHMMSS.csv
  • 리포트: benchmark_report_YYYYMMDD_HHMMSS.md/html/txt

예제

examples/ 디렉토리에서 다양한 사용 예제를 확인할 수 있습니다:

  • basic_usage.py: 기본 사용법
  • config_examples.py: 설정 파일 예제들

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors