This commit is contained in:
ENVY14 2026-03-09 23:50:35 +09:00
parent 37b39dc49a
commit 0deed9bedf
3 changed files with 113 additions and 13 deletions

View File

@ -5,14 +5,16 @@ description = "HUTAMS STT Service for LTE-R"
readme = "README.md"
requires-python = ">=3.11"
dependencies = [
"fastapi>=0.100.0",
"uvicorn>=0.23.0",
"faster-whisper",
"rapidfuzz",
"sqlalchemy",
"pydantic",
"pydub",
"python-multipart",
"fastapi>=0.110.0",
"uvicorn[standard]>=0.27.0",
"faster-whisper>=1.0.0",
"rapidfuzz>=3.0.0",
"sqlalchemy>=2.0.0",
"pydantic>=2.0.0",
"pydantic-settings>=2.0.0",
"pydub>=0.25.1",
"python-multipart>=0.0.9",
"imageio-ffmpeg>=0.5.0",
"jinja2",
"websockets"
]
@ -23,6 +25,5 @@ dev = [
"ruff"
]
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
[tool.uv]
package = false

View File

@ -8,7 +8,7 @@ HUTAMS 프로젝트 최초 설정 스크립트.
3. 대용량 언어모델(.gguf) 다운로드 (존재하지 않을 경우)
4. Whisper STT 모델 다운로드 (존재하지 않을 경우)
#>
[Console]::OutputEncoding = [System.Text.Encoding]::UTF8
$ErrorActionPreference = "Stop"
Write-Host "=====================================================" -ForegroundColor Cyan

99
setup2.ps1 Normal file
View File

@ -0,0 +1,99 @@
<#
.SYNOPSIS
HUTAMS 프로젝트 최초 설정 스크립트.
.DESCRIPTION
1. uv 동기화(의존성 라이브러리 설치)
2. llm_weights, whisper_weights 폴더 생성
3. 대용량 언어모델(.gguf) 다운로드 (존재하지 않을 경우)
4. Whisper STT 모델 다운로드 (존재하지 않을 경우)
#>
[Console]::OutputEncoding = [System.Text.Encoding]::UTF8
$ErrorActionPreference = "Stop"
Write-Host "=====================================================" -ForegroundColor Cyan
Write-Host " HUTAMS STT 프로젝트 초기화 스크립트 (setup.ps1) " -ForegroundColor Cyan
Write-Host "=====================================================" -ForegroundColor Cyan
# ── 1. uv 패키지 설치 ────────────────────────────────────────────────────────
Write-Host "`n[1/4] uv sync로 파이썬 패키지 설치 중..." -ForegroundColor Yellow
try {
uv sync
Write-Host "패키지 설치 완료!" -ForegroundColor Green
}
catch {
Write-Host "uv 실행 실패. https://docs.astral.sh/uv/ 에서 uv를 설치 후 재시도해주세요." -ForegroundColor Red
exit 1
}
# ── 2. 폴더 생성 ─────────────────────────────────────────────────────────────
Write-Host "`n[2/4] 모델 폴더 생성 중..." -ForegroundColor Yellow
New-Item -ItemType Directory -Force -Path "llm_weights" | Out-Null
New-Item -ItemType Directory -Force -Path "whisper_weights" | Out-Null
New-Item -ItemType Directory -Force -Path "data/audio" | Out-Null
New-Item -ItemType Directory -Force -Path "data/samples" | Out-Null
Write-Host "폴더 생성 완료!" -ForegroundColor Green
# ── 3. LLM 모델(.gguf) 다운로드 ──────────────────────────────────────────────
$LlmModelName = "Qwen3.5-0.8B-Q4_K_M.gguf"
$LlmModelPath = "llm_weights\$LlmModelName"
# [⚠️ 실제 사용 중인 모델 URL로 교체하세요]
$LlmDownloadUrl = "https://huggingface.co/unsloth/Qwen3.5-0.8B-GGUF/resolve/main/Qwen3.5-0.8B-Q4_K_M.gguf?download=true"
# $LlmModelName2 = "Qwen3.5-2B-Q4_K_M.gguf"
# $LlmDownloadUrl2 = "https://huggingface.co/unsloth/Qwen3.5-2B-GGUF/resolve/main/Qwen3.5-2B-Q4_K_M.gguf?download=true"# 모델이 실제로는 Qwen3.5-0.8B 이므로 실제 유효한 HuggingFace URL
Write-Host "`n[3/4] LLM 모델($LlmModelName) 확인 중..." -ForegroundColor Yellow
if (Test-Path -Path $LlmModelPath) {
Write-Host "이미 존재합니다. 다운로드를 건너뜁니다." -ForegroundColor Green
}
else {
Write-Host "다운로드 시작 (용량이 크므로 시간이 걸릴 수 있습니다)..." -ForegroundColor Yellow
try {
Invoke-WebRequest -Uri $LlmDownloadUrl -OutFile $LlmModelPath
Write-Host "LLM 모델 다운로드 완료!" -ForegroundColor Green
}
catch {
Write-Host "[오류] LLM 모델 다운로드 실패. 아래 URL에서 수동으로 받아 'llm_weights/' 폴더에 배치하세요:" -ForegroundColor Red
Write-Host "$LlmDownloadUrl" -ForegroundColor Yellow
}
}
# ── 4. Whisper STT 모델 다운로드 ─────────────────────────────────────────────
$WhisperDir = "whisper_weights"
$WhisperModelName = "large-v3-turbo"
$WhisperHfRepoId = "mobiuslabsgmbh/faster-whisper-large-v3-turbo"
Write-Host "`n[4/4] Whisper STT 모델($WhisperModelName) 다운로드 중..." -ForegroundColor Yellow
# whisper_weights/ 안에 이미 모델 폴더가 있으면 건너뜀
$WhisperFlag = Get-ChildItem -Path $WhisperDir -ErrorAction SilentlyContinue | Measure-Object
if ($WhisperFlag.Count -gt 0) {
Write-Host "이미 whisper_weights 폴더에 파일이 존재합니다. 건너뜁니다." -ForegroundColor Green
}
else {
Write-Host "uv run을 통해 Whisper 모델을 프로젝트 내부 캐시로 다운로드합니다 (최초 1회)..." -ForegroundColor Yellow
try {
# 환경변수로 다운로드 경로를 설정하고 서버를 즉시 로드(초기화) 후 종료
$env:WHISPER_MODEL_PATH = (Resolve-Path $WhisperDir).Path
uv run python -c "
from faster_whisper import WhisperModel
import os
model_path = os.environ.get('WHISPER_MODEL_PATH', './whisper_weights')
print(f'Whisper 모델 다운로드 위치: {model_path}')
m = WhisperModel('$WhisperModelName', device='cpu', compute_type='int8', download_root=model_path)
print('다운로드 완료!')
"
Write-Host "Whisper STT 모델 다운로드 완료!" -ForegroundColor Green
}
catch {
Write-Host "[오류] Whisper 모델 다운로드 실패. 서버 첫 기동 시 자동으로 다운로드를 시도합니다." -ForegroundColor Yellow
}
}
# ── 완료 ──────────────────────────────────────────────────────────────────────
Write-Host ""
Write-Host "=====================================================" -ForegroundColor Cyan
Write-Host " 모든 설정이 완료되었습니다! " -ForegroundColor Cyan
Write-Host " run_server.ps1을 실행하여 관제 서버를 시작하세요. " -ForegroundColor Cyan
Write-Host "=====================================================" -ForegroundColor Cyan