Skip to content

Claude/lam zip model generation ywu h2#93

Open
mirai-gpro wants to merge 127 commits intoaigc3d:masterfrom
mirai-gpro:claude/lam-zip-model-generation-ywuH2
Open

Claude/lam zip model generation ywu h2#93
mirai-gpro wants to merge 127 commits intoaigc3d:masterfrom
mirai-gpro:claude/lam-zip-model-generation-ywuH2

Conversation

@mirai-gpro
Copy link

No description provided.

claude and others added 30 commits February 7, 2026 13:02
Root cause: defaults.py's default_setup() and default_config_parser()
assume a distributed training environment with writable filesystem.
On Cloud Run (read-only /app), this causes silent init failures.

Changes:
- app.py: Skip default_setup() entirely, manually set CPU/single-process config
- app.py: Redirect save_path to /tmp (only writable dir on Cloud Run)
- app.py: Add GCS FUSE mount path resolution with Docker-baked fallback
- cloudbuild.yaml: Add Cloud Storage FUSE volume mount for model serving
- cloudbuild.yaml: Increase max-instances to 4
- Include handoff docs and full LAM_Audio2Expression codebase

https://claude.ai/code/session_01C6n4TZ9PPdx46jCevmVo7P
The LAM model file was misidentified as .tar but is actually a PyTorch
weights file. Gemini renamed it to .pth on GCS. Also source wav2vec2
config.json from the model directory instead of LAM configs/.

https://claude.ai/code/session_01C6n4TZ9PPdx46jCevmVo7P
- Import gourmet-sp from implementation-testing branch
- Add sendAudioToExpression() to shop introduction TTS flow
  (firstShop and remainingShops now get lip sync data before playback)
- Remove legacy event hooks in concierge-controller init()
  (replaced with clean linkTtsPlayer helper)
- Clean up LAMAvatar.astro: remove legacy frame playback code
  (startFramePlaybackFromQueue, stopFramePlayback, frameQueue, etc.)
- Simplify to single sync mechanism: frameBuffer + ttsPlayer.currentTime
- Reduce health check interval from 2s to 10s

https://claude.ai/code/session_01C6n4TZ9PPdx46jCevmVo7P
Using official LAM sample avatar as placeholder. Will be replaced with
custom-generated avatar later.

https://claude.ai/code/session_01C6n4TZ9PPdx46jCevmVo7P
- Add fade-in/fade-out smoothing (6 frames / 200ms) to prevent
  Gaussian Splat visual distortion at speech start/end
- Parallelize expression generation with TTS synthesis:
  remaining sentence expression is pre-fetched during first
  sentence playback, eliminating wait time between segments
- Add fetchExpressionFrames() for background expression fetch
  with pendingExpressionFrames buffer swap pattern
- Apply same optimization to shop introduction flow

https://claude.ai/code/session_01C6n4TZ9PPdx46jCevmVo7P
sendAudioToExpression fetch could hang indefinitely (Cloud Run cold
start / service down), blocking await and preventing TTS play().

- Add AbortController timeout (8s) to all expression API fetches
- Wrap expression await with Promise.race so TTS plays even if
  expression API is slow/down (lip sync degrades gracefully)
- Applied to speakTextGCP, speakResponseInChunks, and shop flow

https://claude.ai/code/session_01C6n4TZ9PPdx46jCevmVo7P
Root cause: sendAudioToExpression fetch hung in browser, blocking
await and preventing TTS play() from ever being called.

Fix: all expression API calls are now fire-and-forget - TTS playback
starts immediately without waiting for expression frames. Frames
arrive asynchronously and getExpressionData() picks them up in
real-time from the frameBuffer.

- Remove await/Promise.race from all sendAudioToExpression calls
- Remove fetchExpressionFrames and pendingExpressionFrames
  (no longer needed - direct fire-and-forget is simpler)
- Keep AbortController timeout (8s) inside sendAudioToExpression
  to prevent leaked connections

https://claude.ai/code/session_01C6n4TZ9PPdx46jCevmVo7P
… calls

Architecture change: expression frames are now returned WITH TTS audio
from the backend, instead of the frontend calling audio2exp directly.

Backend (app_customer_support_modified.py):
- Replace fire-and-forget send_to_audio2exp with get_expression_frames
  that returns {names, frames, frame_rate}
- Send MP3 directly to audio2exp (no separate PCM generation needed)
- TTS response: {success, audio, expression: {...}}
- Server-to-server communication: no CORS, stable, fast

Frontend (concierge-controller.ts):
- New queueExpressionFromTtsResponse() reads expression from TTS response
- Remove sendAudioToExpression (direct browser→audio2exp REST calls)
- Remove audio2expApiUrl, audio2expWsUrl, connectLAMAvatarWebSocket
- Remove EXPRESSION_API_TIMEOUT_MS, AbortController timeout
- Existing 1st-sentence-ahead pattern now automatically includes
  expression data (no separate API call needed)

https://claude.ai/code/session_01C6n4TZ9PPdx46jCevmVo7P
…orget proxy

- Backend: TTS endpoint no longer blocks on expression generation
- Backend: New /api/audio2expression proxy (server-to-server, CORS-free)
- Frontend: All expression calls use fireAndForgetExpression() (never blocks TTS play)
- Removes ~2s first-sentence delay caused by synchronous expression in TTS

https://claude.ai/code/session_01C6n4TZ9PPdx46jCevmVo7P
…aining

Two bugs fixed:
1. Buffer corruption: frames from segment 1 mixed with segment 2
   (ttsPlayer.currentTime resets but frameBuffer was concatenated)
   → Now clear buffer before each new TTS segment

2. 3-second delay: expression frames arrived after TTS started playing
   → Pre-fetch remaining segment's expression during first segment playback
   → When second segment starts, pre-fetched frames are immediately available

New prefetchExpression() method returns Promise with parsed frames,
applied non-blocking via .then() to never delay TTS playback.

https://claude.ai/code/session_01C6n4TZ9PPdx46jCevmVo7P
Architecture change: backend includes expression data in TTS response
(server-to-server audio2exp call ~150ms) instead of separate proxy.

- Backend TTS endpoint calls audio2exp synchronously, includes result
- Frontend applyExpressionFromTts(): instant buffer queue from TTS data
- Proxy fireAndForgetExpression kept as fallback (timeout/error cases)
- All 5 call sites (speakTextGCP, speakResponseInChunks x2, shop x2) updated
- Removes prefetch complexity (TTS response already carries expression)

Result: lip sync starts from frame 0, no 2-3 second gap.

https://claude.ai/code/session_01C6n4TZ9PPdx46jCevmVo7P
Architecture redesign for true zero-delay TTS playback:
- Backend TTS endpoint starts audio2exp in background thread, returns
  audio + expression_token immediately (no blocking)
- New /api/expression/poll endpoint: frontend polls for result
- Frontend pollExpression(): fire-and-forget polling at 150ms intervals
- Removes sync expression, proxy, and prefetch approaches

Timeline: TTS returns ~500ms, audio2exp completes ~150ms later (background),
frontend first poll arrives ~200ms after TTS → expression available ~350ms
after playback starts. Previous: 2-3 seconds delay or TTS blocked.

https://claude.ai/code/session_01C6n4TZ9PPdx46jCevmVo7P
…aster response

Backend: revert to sync expression in TTS response (remove async cache/polling).
Frontend: replace pollExpression with applyExpressionFromTts (sync from TTS response).
Frontend: fire sendMessage() immediately while ack plays (don't await firstAckPromise).
pendingAckPromise is awaited before TTS playback to prevent ttsPlayer conflict.

https://claude.ai/code/session_01C6n4TZ9PPdx46jCevmVo7P
…nterrupt)

unlockAudioParams() does play→pause→reset on ttsPlayer for iOS unlock.
When called during ack playback (parallel LLM mode), it kills the ack audio.
Skip it when pendingAckPromise is active (audio already unlocked by ack).

https://claude.ai/code/session_01C6n4TZ9PPdx46jCevmVo7P
…rentAudio safety

Root cause: ack "はい" gets paused (not ended) by some interruption, so
pendingAckPromise never resolves → speakResponseInChunks stuck forever.
Fix 1: resolve pendingAckPromise on both 'ended' and 'pause' events.
Fix 2: call stopCurrentAudio() after pendingAckPromise resolves to ensure
ttsPlayer is clean before new TTS playback.

https://claude.ai/code/session_01C6n4TZ9PPdx46jCevmVo7P
- Container: max-height 650px → height calc(100dvh - 40px), max-height 960px
- Avatar stage: 140px → 300px (desktop), 100px → 200px (mobile)
- Chat area: min-height 150px guaranteed for message display

https://claude.ai/code/session_01C6n4TZ9PPdx46jCevmVo7P
Post-init camera: Z 1→0.6 (closer), Y 1.8→1.75 (slight down), FOV 50→36 (zoom in).
Eliminates wasted space above avatar head in the 300px avatar-stage.

https://claude.ai/code/session_01C6n4TZ9PPdx46jCevmVo7P
Previous: lookAt y=1.8 (head center) + tight zoom → mouth cut off at bottom.
Fix: lower target to y=1.62 (nose/mouth center), adjust OrbitControls target
to match. Camera Z=0.55, FOV=38 for balanced framing.

https://claude.ai/code/session_01C6n4TZ9PPdx46jCevmVo7P
targetY 1.62→1.66 (avatar lower in frame), camera Y 1.62→1.72
(above target, slight downward angle instead of looking up from below)

https://claude.ai/code/session_01C6n4TZ9PPdx46jCevmVo7P
Key improvements over existing lam_modal.py:
- @modal.asgi_app() + Gradio 4.x instead of subprocess + patching
- Direct Python integration with LAM pipeline (no regex patching)
- Blender 4.2 included for GLB generation (OpenAvatarChat format)
- Focused UI for concierge.zip generation with progress feedback
- Proper ASGI serving resolves Gradio UI display issue on Modal

Pipeline: Image → FLAME Tracking → LAM Inference → Blender GLB → ZIP

https://claude.ai/code/session_01XXVR6KsYFAQiJjHvdzCzoK
Major update to concierge_modal.py:
- Custom video upload: VHAP FLAME tracking extracts per-frame
  expression/pose parameters from user's own motion video
- Video preprocessing pipeline: frame extraction, face detection
  (VGGHead), background matting, landmark detection per frame
- VHAP GlobalTracker integration for multi-frame optimization
- Export to NeRF dataset format (transforms.json + flame_param/*.npz)
- Gradio UI: motion source selector (custom video or sample)
- Preview video with optional audio from source video
- Max 300 frames (10s@30fps) cap for manageable processing

This enables generating high-quality concierge.zip with custom
expressions/movements instead of being limited to pre-set samples.

https://claude.ai/code/session_01XXVR6KsYFAQiJjHvdzCzoK
- Replace add_local_dir("./assets") with HuggingFace downloads for all
  required model assets (FLAME tracking, parametric models, LAM assets)
- Remove REQUIRED_ASSET local check since assets are fetched at build time
- Build VHAP config programmatically instead of loading from YAML file
- Remove deprecated allow_concurrent_inputs parameter
- Add flame_vhap symlink for VHAP tracking compatibility
- Add critical file verification in _download_models()

Fixes FileNotFoundError: flame2023.pkl not found in container

https://claude.ai/code/session_01XXVR6KsYFAQiJjHvdzCzoK
Replace container-build-time HuggingFace downloads with add_local_dir
to mount model files from the user's local LAM repo. This is faster
and avoids dependency on HuggingFace availability.

- Add _has_model_zoo / _has_assets detection at module level
- Mount ./model_zoo and ./assets via add_local_dir (conditional)
- Add _setup_paths() to bridge directory layout differences:
  - assets/human_parametric_models → model_zoo/human_parametric_models
  - flame_assets/flame2023.pkl → flame_assets/flame/ (flat layout)
  - flame_vhap symlink for VHAP tracker
- Add model file verification with find-based search

https://claude.ai/code/session_01XXVR6KsYFAQiJjHvdzCzoK
Modal requires add_local_dir to be the last image build step.
Move _setup_model_paths() from run_function (build time) to
_init_lam_pipeline() (container startup) to comply with this.

https://claude.ai/code/session_01XXVR6KsYFAQiJjHvdzCzoK
User keeps all models under assets/ (not model_zoo/).
Instead of symlinking individual subdirectories, symlink the entire
model_zoo -> assets when model_zoo doesn't exist. This bridges
lam_models, flame_tracking_models, and human_parametric_models
all at once.

Also adds model.safetensors to the verification checklist.

https://claude.ai/code/session_01XXVR6KsYFAQiJjHvdzCzoK
Three files are not available locally and must be downloaded:
- model.safetensors (LAM-20K model weights from 3DAIGC/LAM-20K)
- template_file.fbx, animation.glb (from Ethan18/test_model LAM_assets.tar)

Download runs via run_function BEFORE add_local_dir to satisfy
Modal's ordering constraint. Downloads are cached in the image layer.

https://claude.ai/code/session_01XXVR6KsYFAQiJjHvdzCzoK
1. Downloaded LAM assets (template_file.fbx, animation.glb) were
   being overwritten by the add_local_dir mount of assets/.
   Fix: copy extracted assets into model_zoo/ during build so they
   survive the mount. Update all path references accordingly.

2. Pin gradio==4.44.0 and gradio_client==1.3.0 to avoid the
   json_schema_to_python_type TypeError on additionalProperties.

https://claude.ai/code/session_01XXVR6KsYFAQiJjHvdzCzoK
1. Switch assets download from Ethan18/test_model (incomplete) to
   official 3DAIGC/LAM-assets which includes sample_oac/ with
   template_file.fbx and animation.glb.

2. Monkey-patch gradio_client._json_schema_to_python_type to handle
   boolean additionalProperties schema (TypeError on bool).

https://claude.ai/code/session_01XXVR6KsYFAQiJjHvdzCzoK
claude and others added 30 commits February 15, 2026 16:04
Extracts the verified inference pipeline from concierge_modal.py into
a standalone Dockerfile + app_concierge.py that runs on HF Spaces
Docker SDK or any Docker+GPU environment.

- Dockerfile: nvidia/cuda:11.8 base with PyTorch 2.3.0, xformers 0.0.26.post1,
  Blender 4.2, all CUDA extensions pre-built
- app_concierge.py: Single-process Gradio app, no Modal dependencies,
  same generation pipeline (FLAME tracking + VHAP + LAM + Blender GLB)
- download_models.py: Fetches all model weights during Docker build

https://claude.ai/code/session_01XXVR6KsYFAQiJjHvdzCzoK
Integrated several fixes to improve model loading and GLB export. Updated comments for clarity and ensured proper usage of official tools.
The concierge_modal.py had a hand-written inline convert_and_order.py Blender
script that re-implemented the GLB generation logic from
tools/generateARKITGLBWithBlender.py. This "re-invention" diverged from the
official pipeline in subtle ways:

1. Vertex order was generated from the FBX mesh (using matrix_world for Z),
   while the official generateVertexIndices.py imports the OBJ and applies a
   90-degree rotation before sorting by Z.

2. The inline script combined GLB export + vertex order in one Blender session,
   bypassing the official convertFBX2GLB.py and generateVertexIndices.py scripts.

Now we call generate_glb() directly — the same function app_lam.py uses — which
runs the official Blender scripts (convertFBX2GLB.py, generateVertexIndices.py)
and handles temp file cleanup internally.

This eliminates the inline Blender script as a potential source of quality
divergence, while keeping all other improvements intact (xformers, weight
validation, diagnostics, torch.compile disabled).

https://claude.ai/code/session_01XXVR6KsYFAQiJjHvdzCzoK
…leanup

Root cause: lam/, vhap/, configs/, external/, app_lam.py were never mounted
into the Modal container. The container was using stale upstream code from
`git clone github.com/aigc3d/LAM`. Local modifications had no effect.

Changes:
- Mount lam/, configs/, vhap/, external/, app_lam.py, app_concierge.py
- Add BUILD_VERSION env var to force image rebuild on every deploy
- Clear old Volume output (concierge.zip, preview.mp4, etc.) before each
  generation to prevent returning stale cached results
- Log BUILD_VERSION on GPU worker startup for verification

https://claude.ai/code/session_01XXVR6KsYFAQiJjHvdzCzoK
…ling

- Replace bare-bones UI with polished design using gr.themes.Soft() and
  custom CSS (gradient header, step labels, tip/usage boxes)
- Add step-by-step guided input flow (Step 1/2/3 labels with tips)
- GPU worker now writes intermediate progress to per-job JSON on Volume,
  so UI displays real pipeline step names instead of just elapsed time
- Poll interval reduced from 5s to 2s for snappier feedback
- Per-job file scoping (tracked_{job_id}.png etc.) for multi-user safety
- Proper error propagation: GPU thread errors surface in UI instead of
  being silently swallowed by except/pass
- 30-minute timeout guard to prevent infinite polling
- Output section with autoplay preview, usage instructions, and labeled
  visualization panels

https://claude.ai/code/session_01XXVR6KsYFAQiJjHvdzCzoK
Updated the concierge ZIP generator script with final fixes and optimizations. Adjusted error handling, improved file management, and ensured consistent behavior with the official tools.
Based on ChatGPT consultation (2026-02-26), this implements:

1. lam_avatar_batch.py - UI-free batch execution for LAM ZIP generation
   - Reuses proven concierge_modal.py image definition
   - Single-shot GPU execution (no keep_warm, minimal credit usage)
   - CLI input: image bytes + JSON params (shape_scale, motion_name)
   - Output: avatar.zip (skin.glb + offset.ply + animation.glb) + preview/compare PNG
   - shape_param guard to detect "bird monster" vertex explosion artifacts

2. concierge_modal.py fixes:
   - Replace clang with gcc/g++ (fixes nvdiffrast c++11-narrowing errors)
   - Switch to NVlabs official nvdiffrast (from unstable ShenhanQian fork)
   - Set TORCH_CUDA_ARCH_LIST=8.9 for L4 GPU (sm_89)
   - Add TORCHDYNAMO_DISABLE=1 (prevents torch.compile inference corruption)
   - Add nvdiffrast pre-compilation step (avoids 10-30min cold-start delay)
   - Remove clang-specific -Wno-c++11-narrowing monkey patch (no longer needed)
   - Migrate from keep_warm to min_containers/max_containers (Modal 1.0)

https://claude.ai/code/session_017gYfX2b5kzgEuvXMsussqE
Summarizes 12,422 lines of ChatGPT consultation log into a structured
Japanese technical document covering:
- Architecture decisions (3-layer separation, batch vs web UI)
- Bird monster detection and prevention (shape_guard, TorchDynamo disable)
- Identity drift countermeasures (shape_scale parameter)
- All concierge_modal.py fixes (gcc, nvdiffrast, L4 GPU, Modal 1.0)
- Dependency management strategy and version pinning
- Experiment methodology (PNG-first, parameter sweep, compare images)

https://claude.ai/code/session_017gYfX2b5kzgEuvXMsussqE
Analyzes 3 chained errors from user's local deploy attempt:
1. keep_warm deprecation (Modal 1.0) -> min_containers migration
2. cpu_nms build failure (git clone cache miss) -> same-block fix
3. SyntaxError from manual fix attempt -> use repo version

Includes local vs repo version diff table and remediation steps.

https://claude.ai/code/session_017gYfX2b5kzgEuvXMsussqE
3 fixes:
1. main() now downloads results (avatar.zip, compare.png, etc.) from
   Modal Volume to local ./output/ directory automatically
2. Clean stale FLAME tracking data before each run to prevent
   cross-contamination between runs
3. Add del _mesh before saved_head_path removal for safety

Also add input/params.json as default parameter template.

https://claude.ai/code/session_017gYfX2b5kzgEuvXMsussqE
Root cause: @torch.compile decorator on Dinov2FusionWrapper.forward
(dinov2_fusion_wrapper.py:120) produces garbled features in PyTorch 2.3.0
+ CUDA 11.8, even with TORCHDYNAMO_DISABLE=1 environment variable.

Fixes:
- Monkey-patch torch.compile -> no-op BEFORE ModelLAM import
- Force-unwrap any residual torch.compile wrappers after model init
- Add torch._dynamo.reset() to clear stale compilation state
- Add comprehensive weight loading verification (loaded/total ratio)
- Add diagnostic tensor stats at inference (input/output shape, range)
- Add comp_rgb stats to result_meta.json for quality monitoring

https://claude.ai/code/session_017gYfX2b5kzgEuvXMsussqE
…indices

Root cause: generate_glb() step 4 correctly generates vertex_order.json
via Blender (gen_vertex_order_with_blender), which sorts vertices by Z
coordinate after 90-degree rotation. This matches the downstream viewer's
expected mapping between GLB vertices and offset.ply Gaussian splats.

However, both lam_avatar_batch.py and concierge_modal.py immediately
OVERWRITE this correct file with a naive sequential list [0,1,2,...,N].
This destroys the vertex mapping, causing Gaussian splats to attach to
wrong mesh vertices -> "bird monster" artifact.

The official app_lam.py does NOT overwrite vertex_order.json, confirming
this is a bug introduced in the batch/modal pipeline.

Fix: Remove the overwrite code in both files, letting generate_glb's
Blender-based vertex order stand as the final output.

https://claude.ai/code/session_017gYfX2b5kzgEuvXMsussqE
…ive diagnostics

Root cause: @torch.compile decorators on ModelLAM.forward_latent_points
(modeling_lam.py:179) and Dinov2FusionWrapper.forward (dinov2_fusion_wrapper.py:120)
are evaluated at IMPORT time during class definition. Previous fix monkey-patched
torch.compile AFTER the import (line 306 → 335), so the decorators had already
created wrapper objects that silently corrupt computation on Modal L4 + CUDA 11.8.

Three-layer defense:
1. BUILD TIME: sed removes @torch.compile from cloned LAM source files during
   Modal image build — eliminates decorators entirely
2. IMPORT TIME: monkey-patches torch.compile to no-op BEFORE any lam module
   imports in _init_lam_pipeline (moved from after to before imports)
3. CODE OVERLAY: adds local lam/ directory to Modal image to ensure code
   consistency between local repo and Modal runtime

Additional fixes:
- Pre-download DINOv2 pretrained weights (1.3GB) during image build to avoid
  runtime dependency on dl.fbaipublicfiles.com
- Add encoder sanity check: feeds dummy image through encoder and verifies
  output has reasonable variance (detects broken weights)
- Add Gaussian position diagnostics: logs XYZ range, offset magnitude, scaling
- Add per-frame diagnostics: logs foreground pixel ratio for first 3 frames
- Save diagnostic frames (frame_000/001/002.png) for visual verification
- Log weight loading breakdown: encoder/renderer/transformer key counts

https://claude.ai/code/session_017gYfX2b5kzgEuvXMsussqE
Critical bug: the add_local_dir("./lam") overlay in the Modal image build
was overwriting the sed-patched files from the git clone, restoring all
@torch.compile decorators. This made Layer 1 (build-time sed) of the
3-layer defense completely ineffective.

Now all 3 layers work together:
- Layer 1: sed removes decorators from git clone (build time)
- Layer 2: monkey-patch torch.compile before imports (runtime)
- Layer 3: local source files are also patched (overlay)

https://claude.ai/code/session_017gYfX2b5kzgEuvXMsussqE
- Base image: nvidia/cuda:11.8.0-devel → 12.1.0-devel
- PyTorch: 2.3.0+cu118 → 2.4.0+cu121
- torchvision: 0.18.0 → 0.19.0, torchaudio: 2.3.0 → 2.4.0
- xformers: 0.0.26.post1 → 0.0.27.post2 (cu121)
- numpy: 1.23.5 → 1.26.4 (last 1.x; avoids numpy 2.0 breakage)
- opencv-python-headless: unpin → 4.9.0.80 (numpy<2 compat)
- onnxruntime-gpu: install 1.18.1 from CUDA 12 feed (cuDNN 8.x compat)
- pytorch3d: add CXXFLAGS="-std=c++17" for CUDA 12.1 compilation
- diff-gaussian-rasterization: patch #include <cfloat>/<cstdint>
- simple-knn: patch #include <cfloat> for CUDA 12.1

https://claude.ai/code/session_017gYfX2b5kzgEuvXMsussqE
Mirrors the Dockerfile changes for the Modal deployment path.
lam_avatar_batch.py imports this image definition, so both must
be updated together.

- Base: nvidia/cuda:11.8.0-devel → 12.1.0-devel
- PyTorch: 2.3.0+cu118 → 2.4.0+cu121
- xformers: 0.0.26.post1 → 0.0.27.post2
- numpy: 1.23.5 → 1.26.4
- opencv-python-headless: pin 4.9.0.80 (numpy<2 compat)
- onnxruntime-gpu: 1.18.1 from CUDA 12 feed
- CXXFLAGS="-std=c++17" for pytorch3d on CUDA 12.1
- diff-gaussian-rasterization: patch cfloat/cstdint headers
- simple-knn: patch cfloat header

https://claude.ai/code/session_017gYfX2b5kzgEuvXMsussqE
1. CRITICAL: rembg[gpu] → rembg (both files)
   rembg[gpu] pulls onnxruntime-gpu from PyPI (CUDA 11 build),
   overwriting our explicit CUDA 12 install. Drop [gpu] extra
   and rely solely on our pinned onnxruntime-gpu==1.18.1.

2. HIGH: nvdiffrast fork mismatch (concierge_modal.py)
   Was using NVlabs/nvdiffrast (official), but Dockerfile and
   requirements.txt use ShenhanQian/nvdiffrast@backface-culling.
   Aligned to ShenhanQian fork for functional consistency.

3. MEDIUM: Dockerfile onnxruntime-gpu install order
   Moved AFTER rembg install to guarantee it's the final version.
   Also updated stale CUDA 11.8 comment in concierge_modal.py.

https://claude.ai/code/session_017gYfX2b5kzgEuvXMsussqE
The build failed with "glm/glm.hpp: No such file or directory" because
the third_party/glm submodule was not being cloned. Adding --recursive
ensures the GLM dependency is fetched. Fixed in both concierge_modal.py
and Dockerfile.

https://claude.ai/code/session_017gYfX2b5kzgEuvXMsussqE
…oat aliases

chumpy 0.70 imports `from numpy import bool, int, float, complex, object,
unicode, str` which were removed in NumPy 1.24. Since we use NumPy 1.26.4,
this crashes at runtime when FLAME model loading triggers chumpy import.
Patch chumpy's __init__.py in-place after install to use numpy._type_ aliases.

https://claude.ai/code/session_017gYfX2b5kzgEuvXMsussqE
…ken import

The previous approach used `import chumpy` to find its __init__.py path,
but that itself triggers the broken `from numpy import bool` and crashes.
Use importlib.util.find_spec() instead, which locates the module on disk
without executing it.

https://claude.ai/code/session_017gYfX2b5kzgEuvXMsussqE
The sed command patches chumpy's __init__.py source file, but Python
uses cached .pyc bytecode from __pycache__/ which still contains the
old `from numpy import bool` import. Deleting __pycache__ forces
Python to recompile from the patched source.

https://claude.ai/code/session_017gYfX2b5kzgEuvXMsussqE
cpu_nms.pyx line 29 uses np.int which was removed in NumPy 1.24+.
Patch the .pyx source before Cython compilation to use np.intp instead.

https://claude.ai/code/session_017gYfX2b5kzgEuvXMsussqE
…atibility

Switch from CUDA 12.1 to CUDA 11.8 with LAM's officially recommended
package versions to determine if CUDA version is the root cause of
avatar corruption:

- Base image: cuda:12.1.0 -> cuda:11.8.0
- PyTorch: 2.4.0 -> 2.3.0 (official)
- xformers: 0.0.27.post2 -> 0.0.26.post1 (official)
- TORCH_CUDA_ARCH_LIST: "8.9" -> broad list for multi-GPU compat
- onnxruntime-gpu: use PyPI default (CUDA 11)

https://claude.ai/code/session_017gYfX2b5kzgEuvXMsussqE
Official inference code (lam/runners/infer/lam.py:337-339) explicitly calls
self.model.to(torch.float32) before inference, but the custom Modal code only
calls lam.to("cuda") without dtype. With mixed_precision: bf16 in config,
model parameters may remain in bf16, causing corrupted avatar output.

https://claude.ai/code/session_017gYfX2b5kzgEuvXMsussqE
The previous session (9755e46) downgraded CUDA 12.1 to 11.8 without
user authorization. This restores the correct CUDA 12.1 configuration:

- Base image: cuda:11.8.0 -> cuda:12.1.0
- PyTorch: 2.3.0+cu118 -> 2.4.0+cu121
- xformers: 0.0.26.post1 -> 0.0.27.post2
- TORCH_CUDA_ARCH_LIST: broad list -> 8.9 (L4 only)
- onnxruntime-gpu: CUDA 12 index restored
- nvdiffrast: NVlabs official (not ShenhanQian fork)
- rembg[gpu] restored

https://claude.ai/code/session_017gYfX2b5kzgEuvXMsussqE
…hs call

- Usage examples: input.png -> input.jpg (user's actual file)
- Remove duplicate _setup_model_paths() from generate_avatar_batch
  (_init_lam_pipeline already calls it internally)

https://claude.ai/code/session_017gYfX2b5kzgEuvXMsussqE
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