Skip to content

feat(avatar): 연습생 얼굴을 직접 그리는 아바타 (GPU 렌더 서버) - #40

Closed
Lee-Soyeon wants to merge 18 commits into
feat/pass-naturalnessfrom
feat/rendered-avatar
Closed

Lee-Soyeon wants to merge 18 commits into
feat/pass-naturalnessfrom
feat/rendered-avatar

Conversation

@Lee-Soyeon

Copy link
Copy Markdown
Contributor

요약

연습생 얼굴을 우리 GPU 서버에서 직접 그려 통화 영상 트랙에 올립니다. Simli 같은 호스팅 아바타 없이, 사진 한 장과 말소리로 입·눈·고갯짓이 움직이는 얼굴을 만듭니다. 말이 없을 때도 얼굴이 멈추지 않고, 팬이 끊으면 입도 같이 멈춥니다.

목적

Simli 아바타는 "입이 어색하고 인위적"이라는 반려를 받았고(2026-10-26), Anam은 연습생 얼굴을 미성년으로 판정해 거절했으며, Tavus는 유료 요금제가 필요합니다. 공개 모델(Ditto, Apache-2.0)을 우리 서버에서 돌리면 분당 비용이 Anam·Tavus의 1/10 이하로 내려가고, 얼굴·입 모양을 우리가 직접 고칠 수 있습니다.

주요 변경 사항

직접 그리는 아바타 (fancall.agent.avatar)

  • RenderedVideoGenerator: 말소리를 40ms 단위로 렌더러에 보내 얼굴 프레임을 받고, 같은 40ms의 음성과 짝지어 내보냅니다. 렌더러가 느려도 입과 소리가 어긋나지 않습니다.
  • 말이 없을 때는 무음을 계속 보내 듣는 얼굴(깜빡임·고갯짓)을 유지합니다. 팬이 끼어들면 남은 말을 버리고 렌더러도 비웁니다.
  • WebSocketRenderer: GPU 렌더 서버와 통신. 서버가 80ms 뒤를 보고 그리므로 프레임이 늦게 오면 음성을 들고 기다립니다.
  • FakeRenderer + IdleClip: GPU 없이도 통화가 돌아가게 대기 프레임에 입을 그립니다 (개발·테스트용).

GPU 렌더 서버 (tools/ditto_render_server.py)

  • Ditto 스트리밍 파이프라인을 WebSocket으로 감쌉니다. 통화 시작 전 워밍업, 준비된 프레임만 바로 전송, 상반신 통화 사진 위에 얼굴 얹기(layout JSON).

설정

  • RENDER_URL / RENDER_PHOTO / RENDER_LAYOUT / RENDER_IDLE_DIR / RENDER_WIDTH·RENDER_HEIGHT. RENDER_URL이 있으면 호스팅 아바타보다 먼저 씁니다.

판정표 기록 (docs/call-naturalness-criteria.md §3.1)

  • Simli vs Ditto vs Ditto+LatentSync 입 모양 측정, 렌더 서버 T4 속도.

테스트 체크리스트

  • RENDER_IDLE_DIR만 설정하고 통화를 걸면 GPU 없이 대기 프레임 얼굴이 나오고, 말할 때 입이 움직인다
  • RENDER_URL로 렌더 서버에 연결하면 연습생 얼굴이 말소리에 맞춰 움직이고, 말이 없을 때도 깜빡인다
  • 연습생이 말하는 도중 팬이 끼어들면 목소리와 입이 같이 멈춘다
  • 렌더 서버가 꺼져 있으면 음성 통화로 이어진다 (아바타 실패가 통화를 끊지 않음)
  • 단위 테스트 108개 통과, pylint 10, mypy·pyright 0

아직 안 된 것

  • 실시간 속도는 4090급 GPU에서 다시 재야 합니다 (Colab T4 PyTorch는 초당 2.9장).
  • 입 모양은 Ditto 기준이며, 더 자연스러운 입(ㅁ·ㅂ·ㅍ 닫힘)은 모델 선택이 남았습니다 (LatentSync·SoulX-FlashHead 비교 중).

🤖 Generated with Claude Code

https://claude.ai/code/session_01AtsuqBSuAK5BAFAqzBocNz

Lee-Soyeon and others added 6 commits October 26, 2026 20:00
호스팅 아바타(Simli 등) 대신 에이전트가 자기 영상 트랙에 얼굴을 직접 올린다.

- fancall.agent.avatar: 말소리 → 40ms 단위 얼굴 프레임 + 같은 길이의 음성 프레임을
  짝지어 내보내는 RenderedVideoGenerator. 말이 없을 때는 무음을 계속 보내
  (continuous 렌더러) 듣는 얼굴이 멈추지 않고, 팬이 끊으면 남은 말을 버린다
- WebSocketRenderer: GPU 렌더 서버(tools/ditto_render_server.py, Ditto 스트리밍)와
  통신. 서버는 80ms 뒤를 보고 그리므로 프레임이 늦게 오면 음성을 들고 기다린다
- FakeRenderer + IdleClip: GPU 없이도 통화가 돌아가게 대기 프레임에 입을 그린다
- 설정 RENDER_URL / RENDER_PHOTO / RENDER_LAYOUT / RENDER_IDLE_DIR / RENDER_WIDTH·HEIGHT.
  RENDER_URL이 있으면 호스팅 아바타보다 먼저 쓴다

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AtsuqBSuAK5BAFAqzBocNz
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AtsuqBSuAK5BAFAqzBocNz
@Lee-Soyeon
Lee-Soyeon requested a review from ywkim October 26, 2026 12:05
Lee-Soyeon and others added 12 commits October 27, 2026 07:36
Monochrome slide page with the mouth-model comparison videos, measurements,
dialogue test results and the decisions left for the morning.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AtsuqBSuAK5BAFAqzBocNz
Inference on a 6s clip drops from 164s (20 steps) to 51s (8 steps + DeepCache)
and 40s (5 steps + DeepCache) on a T4 with the same mouth-sound correlation.
Still slower than real time.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AtsuqBSuAK5BAFAqzBocNz
- visual12-report.html: 유튜브 영통팬싸 12fps 분석(시선·머리·표정·손·장면), 요소별 실시간 생성 방법과 시간 예산. 실제 영상 프레임은 공개 레포라 제외
- naturalness-review.html: 10/29 눈 판정(사진 1장 방식 탈락, 얼굴 교체 통과), Puck·Gemma·LiveKit 크레딧, 남은 길 A/B

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AUm3yxum3wRFVbeon6JVQn
- §5: 시선·끄덕임·깜빡임·장면 길이·말할 때/들을 때 차이·얼굴 크기 합격선 (중앙값·사분위)
- visual12-report: 144편 최종 집계, 입 재합성 실측(Fish ko 0.46 · Puck en 0.23 · Puck ko 0.11), 통화 지연 실측

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AUm3yxum3wRFVbeon6JVQn

ywkim commented Oct 29, 2026

Copy link
Copy Markdown
Contributor

📦 fancall 개발은 buppy 모노레포로 옮겼습니다

fancall은 이제 algorima/buppy 안의 모듈(backend/fancall/, frontend/src/fancall/)입니다. 이 레포의 PR은 여기서 머지하지 않고, buppy에 새 PR로 옮겨 리뷰합니다.

  • v0.5.0까지: algorima/buppy#1499 에서 커밋 이력째 합쳤습니다.
  • v0.5.1~v0.13.0: algorima/buppy#1502 ~ algorima/buppy#1506 스택에서 리뷰 중입니다. 열린 PR들은 이 코드 위에서 만든 것이라, 스택이 머지된 뒤 옮기면 충돌이 가장 적습니다.

이 PR

#37 위에 쌓여 있습니다. docs/review/media/의 mp4 영상은 buppy에 커밋할 수 없으니 gs://buppy/static/에 올리고 링크로 바꿔 주세요. backend/tools/ditto_render_server.py와 docs/는 직접 옮깁니다.

경로 대응

fancall buppy
backend/fancall/ backend/fancall/ (같음)
backend/tests/unit/test_*.py backend/tests/unit/test_fancall/test_*.py
frontend/src/ 아래 components/, repositories/, i18n/locales/, i18n/translations.ts, client.ts, index.ts, schemas.ts frontend/src/fancall/ 아래 같은 경로
데모 앱 frontend/src/app/, backend/main.py, backend/alembic/, pyproject.toml·poetry.lock, docs/, backend/tools/ 자동으로 옮겨지지 않습니다. buppy의 해당 위치에 직접 반영합니다

옮기는 방법

algorima/buppy#1499와 같은 경로 매핑으로 이 PR의 커밋을 다시 쓴 뒤 buppy에 cherry-pick합니다. 작성자와 커밋 메시지가 그대로 남고, 메시지의 (#N)은 (aioiahq/fancall#N)으로 바뀝니다. git-filter-repo가 필요합니다.

git clone https://github.com/algorima/fancall.git fancall-buppy && cd fancall-buppy
BASE=feat/pass-naturalness; PR_BRANCH=feat/rendered-avatar
for b in "$BASE" "$PR_BRANCH"; do git show-ref -q --verify "refs/heads/$b" || git branch "$b" "origin/$b"; done
git filter-repo --force --refs "$BASE" "$PR_BRANCH" \
  --path backend/fancall/ --path backend/tests/unit/ \
  --path frontend/src/client.ts --path frontend/src/index.ts --path frontend/src/schemas.ts \
  --path frontend/src/components/ --path frontend/src/i18n/translations.ts \
  --path frontend/src/i18n/locales/ --path frontend/src/repositories/ \
  --path-rename backend/tests/unit/:backend/tests/unit/test_fancall/ \
  --path-rename frontend/src/:frontend/src/fancall/ \
  --message-callback 'import re
return re.sub(rb"\(#(\d+)\)", rb"(aioiahq/fancall#\1)", message)'
cd ../buppy && git fetch origin main && git switch -c <새 브랜치> origin/main
git fetch ../fancall-buppy "$BASE:fancall/$BASE" "$PR_BRANCH:fancall/$PR_BRANCH"
git cherry-pick "fancall/$BASE..fancall/$PR_BRANCH"

buppy에서 달라진 점

  • 컴패니언 통화의 음성·아바타 ID는 컴패니언 Live 설정의 voiceId(ElevenLabs)·faceId(Simli)에서 옵니다(algorima/buppy#1503).
  • 백엔드는 buppy 기준(black 23, pyright 1.1.358)으로 검사합니다: make -C backend format lint type-check unit-test, make -C backend tach.
  • 프런트 번역 키는 t("fancall:key")로 씁니다(ADR-0002). fancall 모듈은 앱 코드와 aidol을 import할 수 없습니다(tach, eslint boundaries).
  • 영상 파일은 커밋할 수 없습니다(Danger가 CI를 실패시킴). gs://buppy/static/에 올리고 URL로 참조합니다.
  • PR을 여러 개 쌓을 때는 buppy docs/stacked-pr-guide.md(gh stack)를 따릅니다.

옮긴 뒤에는 이 PR에 buppy PR 링크를 남기고 닫아 주세요.


Generated by Claude Code · session session_01T5SeyErbjJvce4P8rjmZzs


Generated by Claude Code

ywkim commented Nov 8, 2026

Copy link
Copy Markdown
Contributor

buppy 이식 순서 (기록용)

buppy의 fancall 스택은 #1508 → #1503(#15·#18) → #1504(#26·#32·#27) → #1505(#31·#33) → #1506(#19·#20)입니다. 모두 fancall에서 이미 머지된 PR만 옮겼고, 지금 열린 PR과 겹치는 커밋은 없습니다.

  1. #39를 buppy #1504에 합치기 (프론트 schemas.ts 4줄)
  2. #38은 buppy에 이미 반영되어 있어 옮기지 않음
  3. feat(call): 휴대폰 영상통화 화면과 벨 울리는 동안 방 준비 #22 → feat(call): 연락처에서 아이돌을 골라 영상통화 걸기 #23 → #24를 buppy #1506 위에 새 스택으로
  4. #17에만 남은 부분을 정리한 뒤 feat(agent): 팬이 조용하면 연습생이 먼저 말하기 #34 → fix(agent): 팬이 끊으면 방을 지워 아바타까지 바로 종료 #35 → feat(call): 말로 대화하기와 자연스러움 합격선 #36 → feat(call): 실측 맞장구·바로 대답·상반신 화면으로 자연스러움 합격선 맞추기 #37
  5. feat(avatar): 연습생 얼굴을 직접 그리는 아바타 (GPU 렌더 서버) #40~#43은 draft가 풀린 뒤

#17 의존 문제

#34~#43은 모두 #17 브랜치(feat/realtime-avatar) 위에 쌓여 있어 diff가 #17 내용을 전제로 합니다. #17의 일부는 이미 나뉘어 옮겨졌지만(#18 → buppy #1503, #19·#20 → buppy #1506, C·D·E → #22~#24), #17에만 남은 부분이 있습니다: typecast_tts.py, settings.py의 AvatarSettings 등 54줄, worker.py 약 200줄, experiments/lam. 이 부분을 버릴지 따로 옮길지 정해야 이 줄을 옮길 수 있습니다.

이 PR은 5번 단계이고 #37 위에 있습니다. docs/review/media/*.mp4 8개는 buppy의 Danger가 비디오 추가 시 CI를 실패시키므로 gs://buppy/static/에 올리고 URL로 바꿔야 합니다.


Generated by Claude Code · session session_01T5SeyErbjJvce4P8rjmZzs


Generated by Claude Code

@Lee-Soyeon

Copy link
Copy Markdown
Contributor Author

@ywkim 이 PR은 buppy로 옮기지 않고 닫습니다.

  • 직접 그리는 얼굴(Ditto)은 10-28에 눈으로 비교했을 때 "사진이 그냥 말하는 영상 같고 입모양이 어색하다"는 판정이 나와 더 손보지 않기로 했습니다.
  • 통화 아바타는 buppy에서 Simli로 갑니다(algorima/buppy#1503, 채팅 답장은 algorima/buppy#1508로 이미 머지).
  • 브랜치와 비교 기록(docs/review/)은 지우지 않고 남겨 둡니다.

🤖 Generated with Claude Code

https://claude.ai/code/session_015k7pdiFvTCXcWnx8urUdo9

@Lee-Soyeon Lee-Soyeon closed this Nov 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants