Views
No views yet
11. end-to-end 테스트 파일로 전체 흐름 검증
2 - test_text2feed_pipeline.py
3 - test_image2feed_pipeline.py
4
52. RunPod serverless handler로 캐릭터/피드 분리 실행
6 - handler_character.py
7 - handler_feed.py11. 캐릭터 생성
2 - 텍스트로 캐릭터를 만들거나
3 - 이미지로 캐릭터를 만들 수 있음
4 - 결과로 character.png와 appearance.json을 만듦
5
62. 피드 생성
7 - 1단계에서 나온 appearance.json
8 - 사용자의 quest text
9 - 위 두 개를 사용해서 feed.png를 만듦1handler_character
2 입력:
3 - character_ko 또는 character_image
4 출력:
5 - character.png
6 - appearance.json
7
8handler_feed
9 입력:
10 - appearance.json
11 - quest_ko
12 출력:
13 - feed.png
14 - quest_en1handler_character.py
2 텍스트 branch와 이미지 branch를 모두 처리
3 character.png와 appearance.json을 반환
4
5handler_feed.py
6 appearance.json과 quest_ko를 받아 feed.png를 반환1test_text2feed_pipeline.py
2 텍스트 캐릭터 설명에서 시작해서 character.png, appearance.json, feed.png까지 생성
3
4test_image2feed_pipeline.py
5 입력 캐릭터 이미지에서 시작해서 character.png, appearance.json, feed.png까지 생성1텍스트로 캐릭터 생성 테스트
2 -> test_text2feed_pipeline.py
3
4이미지로 캐릭터 생성 테스트
5 -> test_image2feed_pipeline.py1appearance.json + quest_ko
2-> Qwen2.5-7B로 quest_en 생성
3-> SDXL + lora_v3_32bit + lora_bg_v1로 feed.png 생성1models/lora_v3_32bit/pytorch_lora_weights.safetensors
2models/lora_bg_v1/pytorch_lora_weights.safetensors1캐릭터 생성:
2 models/lora_v3_32bit
3
4피드 생성:
5 models/lora_v3_32bit/pytorch_lora_weights.safetensors
6 models/lora_bg_v1/pytorch_lora_weights.safetensors1stabilityai/stable-diffusion-xl-base-1.0
2Qwen/Qwen2.5-7B-Instruct
3Qwen/Qwen2.5-VL-7B-Instruct1stabilityai/stable-diffusion-xl-base-1.0
2 - character.png 생성
3 - feed.png 생성
4
5Qwen/Qwen2.5-7B-Instruct
6 - 한국어 캐릭터 설명 -> 영어 캐릭터 프롬프트
7 - 한국어 퀘스트 -> 영어 장면 프롬프트
8
9Qwen/Qwen2.5-VL-7B-Instruct
10 - 캐릭터 이미지 -> appearance.json 추출rembg도 첫 실행 시 배경 제거용 모델을 캐시에 다운로드할 수 있습니다.1test_text2feed_pipeline.py
2test_image2feed_pipeline.py
3handler_character.py
4handler_feed.py
5test_qwen25_vl_extract.py
6src/pipeline/persona2prompt.py
7src/feed/feed_generator_1.py
8src/feed/feed_generator_2.py
9requirements.txt1.env
2HF_TOKEN
3outputs/
4data/
5image/
6grid/
7logs
8cachesgit lfs를 먼저 켭니다.1git lfs install
2git clone https://huggingface.co/Hadimeeee/mongle-hf-package
3cd mongle-hf-package
4git lfs pull1du -sh models/lora_v3_32bit/pytorch_lora_weights.safetensors
2du -sh models/lora_bg_v1/pytorch_lora_weights.safetensors177M 정도로 보여야 정상입니다. 몇 KB로 보이면 LFS pointer만 받은 상태입니다.pip install -r requirements.txttorch, torchvision, xformers, bitsandbytes 버전 충돌이 날 수 있습니다. 그 경우 RunPod 이미지의 CUDA/PyTorch 버전에 맞춰 먼저 설치한 뒤 requirements.txt를 조정하세요.1python test_text2feed_pipeline.py \
2 --name runpod_text_test \
3 --character-ko "이 친구는 부드러운 체리핑크색 곰 인형이에요. 크림색 배를 가지고 있고 작은 둥근 귀와 분홍색 코가 있어요." \
4 --quest-ko "공원에서 30분 달리기를 완료했어요!" \
5 --force1character_ko
2-> Qwen2.5-7B
3-> English character prompt
4-> SDXL + lora_v3_32bit
5-> character.png
6-> Qwen2.5-VL
7-> appearance.json
8-> quest_ko를 Qwen2.5-7B로 quest_en 변환
9-> SDXL + lora_v3_32bit + lora_bg_v1
10-> feed.png1outputs/text2feed/runpod_text_test/
2 character.png
3 appearance_raw.txt
4 appearance.json
5 character_prompt.json
6 quest.json
7 feed.png
8 results.json1python test_text2feed_pipeline.py \
2 --name runpod_text_fast \
3 --character-text "soft cherry pink bear plush mascot with a cream belly, tiny pink nose, rounded ears" \
4 --quest-ko "공원에서 30분 달리기를 완료했어요!" \
5 --force1python test_text2feed_pipeline.py \
2 --name runpod_text_fastest \
3 --character-text "soft cherry pink bear plush mascot with a cream belly, tiny pink nose, rounded ears" \
4 --quest-en "running with arms swinging along a fluffy cloud meadow path" \
5 --forcehandler_character.py1mode = "text"
2 character_ko 또는 character_text 사용
3 -> character.png
4 -> appearance.json
5
6mode = "image"
7 character_image base64 사용
8 -> rembg
9 -> appearance.json
10 -> character.png1{
2 "input": {
3 "mode": "text",
4 "name": "char_text_01",
5 "character_ko": "이 친구는 부드러운 체리핑크색 곰 인형이에요. 크림색 배와 작은 둥근 귀가 있어요.",
6 "seed": 42,
7 "character_steps": 30
8 }
9}1{
2 "input": {
3 "mode": "image",
4 "name": "char_image_01",
5 "character_image": "<base64 png or jpg>",
6 "seed": 42,
7 "character_steps": 30
8 }
9}1{
2 "name": "char_text_01",
3 "mode": "text",
4 "character_image": "<base64 png>",
5 "appearance": {
6 "animal_type": "bear",
7 "body_color": "soft cherry pink"
8 },
9 "appearance_raw": "..."
10}python handler_character.py1mkdir -p image
2# image/01.jpg 위치에 캐릭터 이미지를 업로드1python test_image2feed_pipeline.py \
2 --name runpod_image_test \
3 --character-image image/01.jpg \
4 --quest-ko "공원에서 30분 달리기를 완료했어요!" \
5 --force1character_image
2-> rembg
3-> input_nobg.png
4-> Qwen2.5-VL
5-> appearance.json
6-> SDXL + lora_v3_32bit
7-> character.png
8-> quest_ko를 Qwen2.5-7B로 quest_en 변환
9-> SDXL + lora_v3_32bit + lora_bg_v1
10-> feed.png1outputs/image2feed/runpod_image_test/
2 input_nobg.png
3 appearance_raw.txt
4 appearance.json
5 character.png
6 quest.json
7 feed.png
8 results.json1python test_image2feed_pipeline.py \
2 --name runpod_image_fast \
3 --character-image image/01.jpg \
4 --quest-en "running with arms swinging along a fluffy cloud meadow path" \
5 --forcehandler_feed.pyappearance와 퀘스트 텍스트를 받아서 피드 이미지를 만듭니다.1{
2 "input": {
3 "name": "feed_01",
4 "appearance": {
5 "animal_type": "bear",
6 "body_color": "soft cherry pink",
7 "body_shape": "round plush body",
8 "eye_style": "small black bead eyes"
9 },
10 "quest_ko": "공원에서 30분 달리기를 완료했어요!",
11 "feed_seed": 123
12 }
13}quest_en을 넣어서 Qwen 번역 단계를 건너뛸 수 있습니다.1{
2 "input": {
3 "name": "feed_fast_01",
4 "appearance": {
5 "animal_type": "bear",
6 "body_color": "soft cherry pink"
7 },
8 "quest_en": "running with arms swinging along a fluffy cloud meadow path",
9 "feed_seed": 123
10 }
11}1{
2 "name": "feed_01",
3 "quest": {
4 "quest_ko": "공원에서 30분 달리기를 완료했어요!",
5 "quest_en": "running with arms swinging along a fluffy cloud meadow path"
6 },
7 "feed_image": "<base64 png>"
8}python handler_feed.pyhandler_character.py와 handler_feed.py를 나누어 사용하는 것이 자연스럽습니다.1handler_character.py
2 - 앱에서 캐릭터 생성 요청을 받음
3 - 텍스트 입력이면 text branch 사용
4 - 이미지 입력이면 image branch 사용
5 - character.png와 appearance.json 반환
6 - 서버는 character.png를 S3에 업로드하고 appearance를 DB에 저장
7
8handler_feed.py
9 - 앱에서 quest 완료 요청을 받음
10 - 서버가 DB에서 character_id로 appearance를 조회
11 - appearance + quest_ko를 RunPod에 전달
12 - feed.png와 quest_en 반환
13 - 서버는 feed.png를 S3에 업로드하고 feed record를 DB에 저장1캐릭터 생성 요청
2-> handler_character
3-> character.png + appearance.json
4-> S3 + DB 저장
5
6퀘스트 완료 요청
7-> DB에서 appearance 조회
8-> handler_feed
9-> feed.png + quest_en
10-> S3 + DB 저장appearance.json이 캐릭터 생성과 피드 생성을 이어주는 중간 산출물입니다.