Spaces:
Build error
Build error
File size: 1,965 Bytes
f2ae3ad 5114a95 f2ae3ad 5ae0b37 86ed0ec 5114a95 4ad0a28 5114a95 4ad0a28 5114a95 4a9d38b 5114a95 4a9d38b 5114a95 86ed0ec f2ae3ad 8d604f9 f2ae3ad 8d604f9 86ed0ec 02200f4 8d604f9 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
#!/bin/bash
set -eux # Keep this for detailed logging
export CUDA_VISIBLE_DEVICES="0"
export CUDA_HOME="/usr/local/cuda"
echo "Attempting to locate and activate Conda environment..."
# Add a common Conda binary path to PATH *before* trying to find 'conda'
# This is crucial if conda is installed but not in the default PATH
export PATH="/opt/conda/bin:$PATH"
# 1. Try to find the 'conda' executable in the system's PATH
CONDA_EXEC=$(which conda)
if [ -z "$CONDA_EXEC" ]; then
echo "ERROR: 'conda' executable still not found in PATH even after adding /opt/conda/bin."
echo "This indicates that Conda might be installed in a different location, or not at all."
exit 1
fi
echo "Found 'conda' executable at: $CONDA_EXEC"
# 2. Derive the base Conda installation path from the executable's location.
CONDA_BASE_PATH=$(dirname $(dirname "$CONDA_EXEC"))
echo "Derived Conda base path: $CONDA_BASE_PATH"
# 3. Construct the path to conda.sh script based on the derived base path
CONDA_SH_PATH="$CONDA_BASE_PATH/etc/profile.d/conda.sh"
if [ -f "$CONDA_SH_PATH" ]; then
echo "Found conda.sh at: $CONDA_SH_PATH"
source "$CONDA_SH_PATH" || { echo "ERROR: Failed to source conda.sh script at $CONDA_SH_PATH. Check permissions."; exit 1; }
else
echo "ERROR: conda.sh not found at expected location derived from 'conda' executable: $CONDA_SH_PATH"
exit 1
fi
echo "Conda environment initialized successfully."
# Activate the specific conda environment
conda activate cosmos-predict1 || { echo "ERROR: Failed to activate conda environment 'cosmos-predict1'. Ensure it exists and is accessible for this user."; exit 1; }
# Set PYTHONPATH after conda activation, as conda might adjust PATH/PYTHONPATH internally.
export PYTHONPATH="/app:/app/gui/api"
echo "Starting GEN3C FastAPI inference server..."
export GEN3C_CKPT_PATH="/app/checkpoints"
export GEN3C_GPU_COUNT=1
exec uvicorn gui.api.server:app --host 0.0.0.0 --port 7860 --proxy-headers |