Spaces:
Paused
Paused
Georg Claude Sonnet 4.5 commited on
Commit ·
dd44013
1
Parent(s): d5c5d99
Fix Dockerfile build errors and always use real model
Browse filesBuild Fixes:
- Add cmake and build-essential to system dependencies
- Install PyTorch before building C++ extensions (required)
- Build only mycuda and mycpp (skip optional kaolin)
- Use proper pip install commands for C++ extensions
Always Real Mode:
- Remove USE_HF_WEIGHTS and USE_REAL_MODEL env var checks
- Always download weights from gpue/foundationpose-weights
- Set USE_REAL_MODEL=true permanently in app.py
- Update UI to show 'Real FoundationPose with GPU'
- Update README to mention Docker GPU (not ZeroGPU)
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Files changed (4)
- Dockerfile+13-12
- README.md+1-1
- app.py+4-4
- download_weights.py+14-20
5 unmodified lines6789101112131415161718192015 unmodified lines3637383940414243444546474849505152535455565758596061625 unmodified linesENV PATH=${CUDA_HOME}/bin:${PATH}ENV LD_LIBRARY_PATH=${CUDA_HOME}/lib64:${LD_LIBRARY_PATH}# FoundationPose configurationENV FOUNDATIONPOSE_MODEL_REPO=gpue/foundationpose-weightsENV USE_HF_WEIGHTS=trueENV USE_REAL_MODEL=false# Install system dependenciesRUN apt-get update && apt-get install -y \git \wget \python3.10 \python3.10-dev \python3-pip \15 unmodified lines# Set working directoryWORKDIR /app# Install Python dependencies first (for better Docker layer caching)COPY requirements.txt .RUN pip install --no-cache-dir -r requirements.txt# Clone FoundationPose repositoryRUN git clone https://github.com/NVlabs/FoundationPose.git /app/FoundationPose# Build FoundationPose C++ extensionsWORKDIR /app/FoundationPoseRUN bash build_all.sh || echo "⚠️ Build completed with warnings"# Copy application filesWORKDIR /appCOPY app.py client.py estimator.py download_weights.py ./# Create weights directoryRUN mkdir -p weights# Download weights if USE_HF_WEIGHTS=true (optional at build time)# Weights can also be downloaded at runtimeRUN python3 download_weights.py || echo "⚠️ Weight download skipped"# Expose Gradio portEXPOSE 78605 unmodified lines678910111213141516171819202115 unmodified lines3738394041424344454647484950515253545556575859606162635 unmodified linesENV PATH=${CUDA_HOME}/bin:${PATH}ENV LD_LIBRARY_PATH=${CUDA_HOME}/lib64:${LD_LIBRARY_PATH}# FoundationPose configuration - always use real modelENV FOUNDATIONPOSE_MODEL_REPO=gpue/foundationpose-weightsENV USE_REAL_MODEL=true# Install system dependenciesRUN apt-get update && apt-get install -y \git \wget \cmake \build-essential \python3.10 \python3.10-dev \python3-pip \15 unmodified lines# Set working directoryWORKDIR /app# Install Python dependencies first (PyTorch needed for building C++ extensions)COPY requirements.txt .RUN pip install --no-cache-dir torch torchvision --index-url https://download.pytorch.org/whl/cu118RUN pip install --no-cache-dir -r requirements.txt# Clone FoundationPose repositoryRUN git clone https://github.com/NVlabs/FoundationPose.git /app/FoundationPose# Build FoundationPose C++ extensions (skip kaolin - optional dependency)WORKDIR /app/FoundationPoseRUN cd bundlesdf/mycuda && pip install -e .RUN cd mycpp && python setup.py build_ext --inplace# Copy application filesWORKDIR /appCOPY app.py client.py estimator.py ./# Create weights directory and download model weightsRUN mkdir -p weightsRUN python3 -c "from huggingface_hub import snapshot_download; \snapshot_download(repo_id='gpue/foundationpose-weights', local_dir='weights', repo_type='model')"# Expose Gradio portEXPOSE 7860
15 unmodified lines1617181920212215 unmodified lines# FoundationPose Inference ServerThis Hugging Face Space provides 6D object pose estimation using [FoundationPose](https://github.com/NVlabs/FoundationPose) with ZeroGPU support.## Features15 unmodified lines1617181920212215 unmodified lines# FoundationPose Inference ServerThis Hugging Face Space provides 6D object pose estimation using [FoundationPose](https://github.com/NVlabs/FoundationPose) with GPU support via Docker.## Features
21 unmodified lines22232425262728293031250 unmodified lines28228328428528628728821 unmodified lines)logger = logging.getLogger(__name__)# Check if running in real FoundationPose mode or placeholder modeUSE_REAL_MODEL = os.environ.get("USE_REAL_MODEL", "false").lower() == "true"logger.info(f"Starting in {'REAL' if USE_REAL_MODEL else 'PLACEHOLDER'} mode")class FoundationPoseInference:250 unmodified linesgr.Markdown("# 🎯 FoundationPose 6D Object Pose Estimation")mode_indicator = gr.Markdown(f"**Mode:** {'🟢 Real FoundationPose' if USE_REAL_MODEL else '🟡 Placeholder'}",elem_id="mode")21 unmodified lines22232425262728293031250 unmodified lines28228328428528628728821 unmodified lines)logger = logging.getLogger(__name__)# Always use real FoundationPose modelUSE_REAL_MODEL = Truelogger.info("Starting in REAL mode with FoundationPose")class FoundationPoseInference:250 unmodified linesgr.Markdown("# 🎯 FoundationPose 6D Object Pose Estimation")mode_indicator = gr.Markdown("**Mode:** 🟢 Real FoundationPose with GPU",elem_id="mode")
3 unmodified lines45678910111213141516171819202122232425262728293031323 unmodified linesimport osfrom pathlib import Path# Check environment variablesrepo = os.environ.get('FOUNDATIONPOSE_MODEL_REPO', 'gpue/foundationpose-weights')token = os.environ.get('HF_TOKEN')use_hf = os.environ.get('USE_HF_WEIGHTS', 'false').lower() == 'true'use_real = os.environ.get('USE_REAL_MODEL', 'false').lower() == 'true'if use_hf and use_real:print(f'Downloading weights from {repo}...')try:from huggingface_hub import snapshot_downloadsnapshot_download(repo_id=repo,local_dir='weights',token=token,repo_type='model')print('✓ Weights downloaded successfully')except Exception as e:print(f'⚠️ Weight download failed: {e}')print('Space will run in placeholder mode')else:print('Placeholder mode - skipping weight download')print('Set USE_REAL_MODEL=true and USE_HF_WEIGHTS=true to enable')3 unmodified lines45678910111213141516171819202122232425263 unmodified linesimport osfrom pathlib import Path# Always download weights from model repositoryrepo = os.environ.get('FOUNDATIONPOSE_MODEL_REPO', 'gpue/foundationpose-weights')token = os.environ.get('HF_TOKEN')print(f'Downloading weights from {repo}...')try:from huggingface_hub import snapshot_downloadsnapshot_download(repo_id=repo,local_dir='weights',token=token,repo_type='model')print('✓ Weights downloaded successfully')except Exception as e:print(f'✗ Weight download failed: {e}')raise
Dockerfile+13-12
README.md+1-1
app.py+4-4
download_weights.py+14-20