forked from lllyasviel/FramePack
-
Notifications
You must be signed in to change notification settings - Fork 0
commit #15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
hndrr
wants to merge
4
commits into
main
Choose a base branch
from
feat/ichiframe
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
commit #15
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,73 @@ | ||
| # Git | ||
| .git | ||
| .gitignore | ||
|
|
||
| # Python | ||
| __pycache__/ | ||
| *.py[cod] | ||
| *$py.class | ||
| *.so | ||
| .Python | ||
| build/ | ||
| develop-eggs/ | ||
| dist/ | ||
| downloads/ | ||
| eggs/ | ||
| .eggs/ | ||
| lib/ | ||
| lib64/ | ||
| parts/ | ||
| sdist/ | ||
| var/ | ||
| wheels/ | ||
| *.egg-info/ | ||
| .installed.cfg | ||
| *.egg | ||
| MANIFEST | ||
|
|
||
| # Virtual environments | ||
| .env | ||
| .venv | ||
| env/ | ||
| venv/ | ||
| ENV/ | ||
| env.bak/ | ||
| venv.bak/ | ||
|
|
||
| # IDE | ||
| .vscode/ | ||
| .idea/ | ||
| *.swp | ||
| *.swo | ||
|
|
||
| # OS | ||
| .DS_Store | ||
| Thumbs.db | ||
|
|
||
| # Project specific | ||
| outputs/ | ||
| temp_queue_images/ | ||
| archive/ | ||
| hf_download/ | ||
| job_queue.json | ||
| quick_prompts.json | ||
| *.log | ||
|
|
||
| # Docker | ||
| Dockerfile* | ||
| docker-compose*.yml | ||
| .dockerignore | ||
|
|
||
| # Documentation | ||
| *.md | ||
| plan/ | ||
|
|
||
| # Cache | ||
| .cache/ | ||
| .pytest_cache/ | ||
| .mypy_cache/ | ||
| .ruff_cache/ | ||
|
|
||
| # Temporary files | ||
| *.tmp | ||
| *.temp |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -188,3 +188,5 @@ job_queue.json | |
| main.obj | ||
| main.exp | ||
| main.lib | ||
| CLAUDE.md | ||
| .mcp/ | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,66 @@ | ||
| # FramePack-FastAPI with External Model Mount | ||
|
|
||
| FROM nvidia/cuda:12.1-devel-ubuntu22.04 | ||
|
|
||
| # Install system dependencies | ||
| RUN apt-get update && apt-get install -y \ | ||
| python3.10 \ | ||
| python3.10-dev \ | ||
| python3-pip \ | ||
| curl \ | ||
| git \ | ||
| build-essential \ | ||
| libgl1-mesa-glx \ | ||
| libglib2.0-0 \ | ||
| libsm6 \ | ||
| libxext6 \ | ||
| libxrender-dev \ | ||
| libgomp1 \ | ||
| ffmpeg \ | ||
| && rm -rf /var/lib/apt/lists/* | ||
|
|
||
| # Create symlink for python | ||
| RUN ln -s /usr/bin/python3.10 /usr/bin/python | ||
|
|
||
| # Install uv | ||
| COPY --from=ghcr.io/astral-sh/uv:latest /uv /bin/uv | ||
|
|
||
| # Set working directory | ||
| WORKDIR /app | ||
|
|
||
| # Copy dependency files | ||
| COPY pyproject.toml requirements.txt ./ | ||
|
|
||
| # Create virtual environment and install dependencies | ||
| RUN uv venv /opt/venv | ||
| ENV PATH="/opt/venv/bin:$PATH" | ||
|
|
||
| # Install Python dependencies | ||
| RUN uv pip install --no-cache -r requirements.txt | ||
|
|
||
| # Copy application code | ||
| COPY . . | ||
|
|
||
| # Create necessary directories | ||
| RUN mkdir -p outputs/images temp_queue_images loras | ||
|
|
||
| # Create model mount points | ||
| RUN mkdir -p /app/hf_download | ||
| VOLUME ["/app/hf_download"] | ||
|
|
||
| # Set environment variables | ||
| ENV PYTHONPATH="/app:$PYTHONPATH" | ||
| ENV PYTHONUNBUFFERED=1 | ||
| ENV HF_HOME="/app/hf_download" | ||
| ENV TRANSFORMERS_CACHE="/app/hf_download" | ||
| ENV HF_DATASETS_CACHE="/app/hf_download" | ||
|
|
||
| # Expose port | ||
| EXPOSE 8000 | ||
|
|
||
| # Health check | ||
| HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 \ | ||
| CMD curl -f http://localhost:8000/docs || exit 1 | ||
|
|
||
| # Start command | ||
| CMD ["uvicorn", "api.api:app", "--host", "0.0.0.0", "--port", "8000"] | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,248 @@ | ||
| # FramePack-FastAPI Docker Guide | ||
|
|
||
| このガイドでは、FramePack-FastAPIをDockerで実行する方法を説明します。 | ||
|
|
||
| ## 🐳 Docker構成 | ||
|
|
||
| ### 利用可能なDockerfile | ||
|
|
||
| 1. **Dockerfile** - CPU版(軽量、推論のみ) | ||
| 2. **Dockerfile.gpu** - GPU版(CUDA対応、高性能) | ||
|
Comment on lines
+9
to
+10
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
|
||
| ### Docker Compose設定 | ||
|
|
||
| 1. **docker-compose.yml** - CPU版用 | ||
| 2. **docker-compose.gpu.yml** - GPU版用 | ||
|
Comment on lines
+14
to
+15
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
|
||
| ## 🚀 クイックスタート | ||
|
|
||
| ### CPU版を起動 | ||
| ```bash | ||
| # 自動ビルド&起動 | ||
| ./docker-run.sh | ||
|
|
||
| # または手動で | ||
| docker-compose up | ||
| ``` | ||
|
|
||
| ### GPU版を起動 | ||
| ```bash | ||
| # 自動ビルド&起動(GPU必須) | ||
| ./docker-run.sh --gpu | ||
|
|
||
| # または手動で | ||
| docker-compose -f docker-compose.gpu.yml up | ||
| ``` | ||
|
|
||
| ## 🔨 手動ビルド | ||
|
|
||
| ### CPUイメージをビルド | ||
| ```bash | ||
| ./docker-build.sh | ||
| # または | ||
| docker build -f Dockerfile -t framepack-fastapi:latest . | ||
| ``` | ||
|
|
||
| ### GPUイメージをビルド | ||
| ```bash | ||
| ./docker-build.sh --gpu | ||
| # または | ||
| docker build -f Dockerfile.gpu -t framepack-fastapi-gpu:latest . | ||
| ``` | ||
|
|
||
| ## 🏃♂️ 実行方法 | ||
|
|
||
| ### 1. Docker Composeを使用(推奨) | ||
|
|
||
| #### CPU版 | ||
| ```bash | ||
| docker-compose up -d # バックグラウンド実行 | ||
| docker-compose logs -f # ログを表示 | ||
| ``` | ||
|
|
||
| #### GPU版 | ||
| ```bash | ||
| docker-compose -f docker-compose.gpu.yml up -d | ||
| docker-compose -f docker-compose.gpu.yml logs -f | ||
| ``` | ||
|
|
||
| ### 2. 直接Dockerコマンドを使用 | ||
|
|
||
| #### CPU版 | ||
| ```bash | ||
| docker run -d \ | ||
| -p 8000:8000 \ | ||
| -v $(pwd)/outputs:/app/outputs \ | ||
| -v $(pwd)/temp_queue_images:/app/temp_queue_images \ | ||
| -v $(pwd)/loras:/app/loras \ | ||
| -v $(pwd)/hf_download:/app/hf_download \ | ||
| framepack-fastapi:latest | ||
| ``` | ||
|
|
||
| #### GPU版 | ||
| ```bash | ||
| docker run -d \ | ||
| --gpus all \ | ||
| -p 8000:8000 \ | ||
| -v $(pwd)/outputs:/app/outputs \ | ||
| -v $(pwd)/temp_queue_images:/app/temp_queue_images \ | ||
| -v $(pwd)/loras:/app/loras \ | ||
| -v $(pwd)/hf_download:/app/hf_download \ | ||
| framepack-fastapi-gpu:latest | ||
| ``` | ||
|
|
||
| ## 🔧 カスタマイズ | ||
|
|
||
| ### ポート変更 | ||
| ```bash | ||
| # ポート8080で起動 | ||
| ./docker-run.sh --port 8080 | ||
|
|
||
| # または環境変数で設定 | ||
| export PORT=8080 | ||
| docker-compose up | ||
| ``` | ||
|
|
||
| ### 環境変数 | ||
|
|
||
| 重要な環境変数: | ||
|
|
||
| ```bash | ||
| # API設定 | ||
| API_HOST=0.0.0.0 | ||
| API_PORT=8000 | ||
|
|
||
| # モデルキャッシュ | ||
| HF_HOME=/app/hf_download | ||
| TRANSFORMERS_CACHE=/app/hf_download | ||
|
|
||
| # GPU設定(GPU版のみ) | ||
| CUDA_VISIBLE_DEVICES=0 | ||
| NVIDIA_VISIBLE_DEVICES=all | ||
| ``` | ||
|
|
||
| ### ボリューム設定 | ||
|
|
||
| 永続化されるデータ: | ||
|
|
||
| - `./outputs` - 生成された動画・画像 | ||
| - `./temp_queue_images` - キュー用一時画像 | ||
| - `./loras` - LoRAファイル | ||
| - `./hf_download` - Hugging Faceモデルキャッシュ | ||
| - `./job_queue.json` - ジョブキュー状態 | ||
|
|
||
| ## 📋 システム要件 | ||
|
|
||
| ### CPU版 | ||
| - **RAM**: 最小8GB、推奨16GB以上 | ||
| - **ストレージ**: 最小20GB の空き容量 | ||
| - **CPU**: マルチコア推奨 | ||
|
|
||
| ### GPU版 | ||
| - **GPU**: NVIDIA GPU(CUDA 12.1対応) | ||
| - **VRAM**: 最小8GB、推奨24GB以上 | ||
| - **RAM**: 最小16GB、推奨32GB以上 | ||
| - **ストレージ**: 最小50GB の空き容量 | ||
| - **NVIDIA Docker**: インストール済み | ||
|
|
||
| ## 🛠️ トラブルシューティング | ||
|
|
||
| ### よくある問題 | ||
|
|
||
| #### 1. GPU版でGPUが認識されない | ||
| ```bash | ||
| # NVIDIA Dockerの確認 | ||
| docker run --rm --gpus all nvidia/cuda:12.1-base-ubuntu22.04 nvidia-smi | ||
|
|
||
| # GPU対応確認 | ||
| docker-compose -f docker-compose.gpu.yml exec framepack-api-gpu python -c "import torch; print(torch.cuda.is_available())" | ||
| ``` | ||
|
|
||
| #### 2. メモリ不足エラー | ||
| ```bash | ||
| # Dockerのメモリ制限を確認・調整 | ||
| docker stats | ||
|
|
||
| # Swapファイルを有効化(Linux) | ||
| sudo swapon --show | ||
| ``` | ||
|
|
||
| #### 3. モデルダウンロードが遅い/失敗する | ||
| ```bash | ||
| # Hugging Face キャッシュを事前ダウンロード | ||
| mkdir -p hf_download | ||
| docker run -v $(pwd)/hf_download:/app/hf_download framepack-fastapi-gpu:latest python -c " | ||
| from transformers import AutoTokenizer | ||
| AutoTokenizer.from_pretrained('hunyuanvideo-community/HunyuanVideo', cache_dir='/app/hf_download') | ||
| " | ||
| ``` | ||
|
|
||
| #### 4. ポート競合 | ||
| ```bash | ||
| # 使用中のポートを確認 | ||
| netstat -tlnp | grep :8000 | ||
|
|
||
| # 別のポートを使用 | ||
| docker-compose up -e API_PORT=8080 | ||
| ``` | ||
|
|
||
| ### ログの確認 | ||
|
|
||
| ```bash | ||
| # サービスログ | ||
| docker-compose logs framepack-api | ||
|
|
||
| # リアルタイムログ | ||
| docker-compose logs -f framepack-api | ||
|
|
||
| # 特定コンテナのログ | ||
| docker logs <container_id> | ||
| ``` | ||
|
|
||
| ### パフォーマンス監視 | ||
|
|
||
| ```bash | ||
| # リソース使用量 | ||
| docker stats | ||
|
|
||
| # GPU使用量(GPU版) | ||
| docker-compose -f docker-compose.gpu.yml exec framepack-api-gpu nvidia-smi | ||
| ``` | ||
|
|
||
| ## 🌐 API アクセス | ||
|
|
||
| コンテナ起動後、以下のURLでアクセス可能: | ||
|
|
||
| - **API**: http://localhost:8000 | ||
| - **API ドキュメント**: http://localhost:8000/docs | ||
| - **動画生成**: http://localhost:8000/generate | ||
| - **画像生成**: http://localhost:8000/api/generate-image | ||
|
|
||
| ## 🔄 更新とメンテナンス | ||
|
|
||
| ### イメージの更新 | ||
| ```bash | ||
| # 最新コードでリビルド | ||
| ./docker-build.sh --tag latest | ||
|
|
||
| # 古いイメージを削除 | ||
| docker image prune -f | ||
| ``` | ||
|
|
||
| ### データのバックアップ | ||
| ```bash | ||
| # 生成データをバックアップ | ||
| tar -czf framepack-backup-$(date +%Y%m%d).tar.gz outputs/ temp_queue_images/ loras/ hf_download/ | ||
| ``` | ||
|
|
||
| ### コンテナの停止と削除 | ||
| ```bash | ||
| # サービス停止 | ||
| docker-compose down | ||
|
|
||
| # データボリュームも含めて削除 | ||
| docker-compose down -v | ||
|
|
||
| # 完全クリーンアップ | ||
| docker system prune -af | ||
| ``` | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This Dockerfile uses a CUDA base image (
nvidia/cuda:12.1-devel-ubuntu22.04), which implies it's intended for GPU usage. However,README_DOCKER.mdandREADME_DOCKER_REVISED.mddescribeDockerfileas the 'CPU version' or '開発用サーバー (モデルなし)'. This seems contradictory. If this Dockerfile is indeed for GPU, it might be clearer to name itDockerfile.gpuand ensure the CPU/dev version uses a non-CUDA base image.