Spaces:
Sleeping
Sleeping
File size: 6,928 Bytes
09da05c | 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 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 | services:
embedding-model-cache:
image: python:3.10-slim
working_dir: /app
env_file:
- .env
environment:
NVIDIA_VISIBLE_DEVICES: all
PYTHONUNBUFFERED: "1"
PYTHONDONTWRITEBYTECODE: "1"
HF_HOME: /root/.cache/huggingface
HUGGINGFACE_HUB_CACHE: /root/.cache/huggingface/hub
SENTENCE_TRANSFORMERS_HOME: /root/.cache/huggingface/sentence_transformers
volumes:
- ./:/app
- ./data:/app/data
- adsp_venv:/opt/venv
- ./data/huggingface:/root/.cache/huggingface
command:
- /bin/sh
- -lc
- |
set -eu
mkdir -p "$${HF_HOME}" "$${HUGGINGFACE_HUB_CACHE}" "$${SENTENCE_TRANSFORMERS_HOME}"
/bin/sh scripts/bootstrap_venv.sh
/opt/venv/bin/python - <<'PY'
import os
from adsp.data_pipeline.embedding_utils import (
get_configured_embedding_backend,
get_configured_embedding_model_name,
)
backend = get_configured_embedding_backend()
if backend != "huggingface":
print(f"Skipping local embedding model cache for backend: {backend}")
raise SystemExit(0)
from sentence_transformers import SentenceTransformer
cache_dir = os.environ.get("SENTENCE_TRANSFORMERS_HOME") or os.environ.get("HF_HOME")
model_name = get_configured_embedding_model_name()
print(f"Caching embedding model: {model_name}")
print(f"Cache directory: {cache_dir}")
SentenceTransformer(model_name, cache_folder=cache_dir)
print("Embedding model cache ready.")
PY
restart: "no"
persona-extraction:
image: python:3.10-slim
working_dir: /app
env_file:
- .env
environment:
PYTHONUNBUFFERED: "1"
PYTHONDONTWRITEBYTECODE: "1"
HF_HOME: /root/.cache/huggingface
HUGGINGFACE_HUB_CACHE: /root/.cache/huggingface/hub
SENTENCE_TRANSFORMERS_HOME: /root/.cache/huggingface/sentence_transformers
volumes:
- ./:/app
- ./data:/app/data
- adsp_venv:/opt/venv
- ./data/huggingface:/root/.cache/huggingface
depends_on:
embedding-model-cache:
condition: service_completed_successfully
command:
- /bin/sh
- -lc
- |
set -eu
/bin/sh scripts/bootstrap_venv.sh
echo "Starting persona extraction with the following environment variables:"
echo "PERSONA_PDF_PATH: $${PERSONA_PDF_PATH}"
persona_pdf_path="${PERSONA_PDF_PATH:?PERSONA_PDF_PATH is required in .env}"
set -- /opt/venv/bin/python scripts/run_persona_extraction.py \
--pdf-path "$${persona_pdf_path}"
"$@"
restart: "no"
fact-extraction:
image: python:3.10-slim
working_dir: /app
env_file:
- .env
environment:
PYTHONUNBUFFERED: "1"
PYTHONDONTWRITEBYTECODE: "1"
HF_HOME: /root/.cache/huggingface
HUGGINGFACE_HUB_CACHE: /root/.cache/huggingface/hub
SENTENCE_TRANSFORMERS_HOME: /root/.cache/huggingface/sentence_transformers
volumes:
- ./:/app
- ./data:/app/data
- adsp_venv:/opt/venv
- ./data/huggingface:/root/.cache/huggingface
depends_on:
embedding-model-cache:
condition: service_completed_successfully
persona-extraction:
condition: service_completed_successfully
command:
- /bin/sh
- -lc
- |
set -eu
/bin/sh scripts/bootstrap_venv.sh
factdata_pdf_path="${FACT_DATA_PDF_PATH:?FACT_DATA_PDF_PATH is required in .env}"
set -- /opt/venv/bin/python scripts/run_fact_data_extraction.py \
--pdf-path "$${factdata_pdf_path}"
fact_page_range="${FACT_PAGE_RANGE:-__unset__}"
if [ "$${fact_page_range}" != "__unset__" ]; then
set -- "$@" --page-range "$${fact_page_range}"
fi
if [ "${FACT_DEBUG:-false}" = "true" ]; then
set -- "$@" --debug
fi
if [ "${FACT_NO_CACHE:-false}" = "true" ]; then
set -- "$@" --no-cache
fi
fact_extra_args="${FACT_EXTRA_ARGS:-__unset__}"
if [ "$${fact_extra_args}" != "__unset__" ]; then
# shellcheck disable=SC2086
set -- "$@" $${fact_extra_args}
fi
"$@"
restart: "no"
api:
image: python:3.10-slim
working_dir: /app
env_file:
- .env
environment:
NVIDIA_VISIBLE_DEVICES: "${ADSP_API_GPU_VISIBLE_DEVICES:-all}"
NVIDIA_DRIVER_CAPABILITIES: "${ADSP_API_GPU_DRIVER_CAPABILITIES:-compute,utility}"
PYTHONUNBUFFERED: "1"
PYTHONDONTWRITEBYTECODE: "1"
HF_HOME: /root/.cache/huggingface
HUGGINGFACE_HUB_CACHE: /root/.cache/huggingface/hub
SENTENCE_TRANSFORMERS_HOME: /root/.cache/huggingface/sentence_transformers
ADSP_API_HOST: 0.0.0.0
volumes:
- ./:/app
- ./data:/app/data
- ./data/processed/vectorstores:/app/data/processed/vectorstores
- adsp_venv:/opt/venv
- ./data/huggingface:/root/.cache/huggingface
gpus: "${ADSP_API_GPU_REQUEST:-all}"
depends_on:
embedding-model-cache:
condition: service_completed_successfully
fact-extraction:
condition: service_completed_successfully
command:
- /bin/sh
- -lc
- |
set -eu
/bin/sh scripts/bootstrap_venv.sh
exec /opt/venv/bin/python scripts/run_api.py
ports:
- "${ADSP_API_PORT:-8000}:${ADSP_API_PORT:-8000}"
healthcheck:
test:
- CMD
- /opt/venv/bin/python
- -c
- import os,urllib.request; urllib.request.urlopen('http://127.0.0.1:' + os.environ.get('ADSP_API_PORT', '8000') + '/health', timeout=5).read()
interval: 60s
timeout: 5s
retries: 20
start_period: 10s
restart: unless-stopped
frontend:
image: python:3.10-slim
working_dir: /app
env_file:
- .env
environment:
PYTHONUNBUFFERED: "1"
PYTHONDONTWRITEBYTECODE: "1"
HF_HOME: /root/.cache/huggingface
HUGGINGFACE_HUB_CACHE: /root/.cache/huggingface/hub
SENTENCE_TRANSFORMERS_HOME: /root/.cache/huggingface/sentence_transformers
ADSP_FE_API_URL: "${ADSP_FE_API_URL:-http://api:8000}"
volumes:
- ./:/app
- ./data:/app/data
- adsp_venv:/opt/venv
- ./data/huggingface:/root/.cache/huggingface
depends_on:
embedding-model-cache:
condition: service_completed_successfully
api:
condition: service_healthy
command:
- /bin/sh
- -lc
- |
set -eu
/bin/sh scripts/bootstrap_venv.sh
exec /opt/venv/bin/python -m streamlit run adsp/fe/app.py \
--server.address=0.0.0.0 \
--server.port="${ADSP_FE_PORT:-8501}" \
--server.headless=true
ports:
- "${ADSP_FE_PORT:-8501}:${ADSP_FE_PORT:-8501}"
restart: unless-stopped
volumes:
adsp_venv:
|