dylanglenister
commited on
Commit
·
055dd28
1
Parent(s):
99b1cba
Revert "CHORE: Testing alternative token"
Browse filesThis reverts commit 99b1cba41022053f1aee377dd0363314a22fe2bb.
- Dockerfile +2 -2
- scripts/download_models.py +3 -3
Dockerfile
CHANGED
|
@@ -39,9 +39,9 @@ ENV PRELOAD_TRANSLATORS="0"
|
|
| 39 |
ENV EMBEDDING_HALF="0"
|
| 40 |
|
| 41 |
# Preload embedding model and warmup
|
| 42 |
-
RUN --mount=type=secret,id=
|
| 43 |
test -f /app/scripts/download_models.py && \
|
| 44 |
-
|
| 45 |
|
| 46 |
# Ensure ownership stays correct
|
| 47 |
RUN chown -R user:user /app/embedding_model_cache /app/llm_cache
|
|
|
|
| 39 |
ENV EMBEDDING_HALF="0"
|
| 40 |
|
| 41 |
# Preload embedding model and warmup
|
| 42 |
+
RUN --mount=type=secret,id=HUGGING_FACE_HUB_TOKEN,uid=1000 \
|
| 43 |
test -f /app/scripts/download_models.py && \
|
| 44 |
+
HUGGING_FACE_HUB_TOKEN=$(cat /run/secrets/HUGGING_FACE_HUB_TOKEN) python /app/scripts/download_models.py || true
|
| 45 |
|
| 46 |
# Ensure ownership stays correct
|
| 47 |
RUN chown -R user:user /app/embedding_model_cache /app/llm_cache
|
scripts/download_models.py
CHANGED
|
@@ -6,7 +6,7 @@ from huggingface_hub import snapshot_download
|
|
| 6 |
|
| 7 |
# --- Configuration ---
|
| 8 |
# Read the HF token from environment variables, essential for private models.
|
| 9 |
-
HUGGING_FACE_TOKEN = os.getenv("
|
| 10 |
|
| 11 |
# Central Hugging Face cache directory within the container.
|
| 12 |
HF_CACHE_DIR = os.getenv("HF_HOME", "/home/user/.cache/huggingface")
|
|
@@ -47,11 +47,11 @@ if __name__ == "__main__":
|
|
| 47 |
download_model(EMBEDDING_MODEL_REPO, EMBEDDING_MODEL_DIR)
|
| 48 |
|
| 49 |
if HUGGING_FACE_TOKEN:
|
| 50 |
-
print("
|
| 51 |
# WARNING: Do NOT print the full token. Just print the first few chars to confirm it's loaded.
|
| 52 |
print(f" Token starts with: '{HUGGING_FACE_TOKEN[:4]}...'")
|
| 53 |
|
| 54 |
# Download the private LLM (requires a token)
|
| 55 |
download_model(LLM_REPO, LLM_DIR, token=HUGGING_FACE_TOKEN)
|
| 56 |
else:
|
| 57 |
-
print("
|
|
|
|
| 6 |
|
| 7 |
# --- Configuration ---
|
| 8 |
# Read the HF token from environment variables, essential for private models.
|
| 9 |
+
HUGGING_FACE_TOKEN = os.getenv("HUGGING_FACE_HUB_TOKEN", None)
|
| 10 |
|
| 11 |
# Central Hugging Face cache directory within the container.
|
| 12 |
HF_CACHE_DIR = os.getenv("HF_HOME", "/home/user/.cache/huggingface")
|
|
|
|
| 47 |
download_model(EMBEDDING_MODEL_REPO, EMBEDDING_MODEL_DIR)
|
| 48 |
|
| 49 |
if HUGGING_FACE_TOKEN:
|
| 50 |
+
print("HUGGING_FACE_HUB_TOKEN environment variable found.")
|
| 51 |
# WARNING: Do NOT print the full token. Just print the first few chars to confirm it's loaded.
|
| 52 |
print(f" Token starts with: '{HUGGING_FACE_TOKEN[:4]}...'")
|
| 53 |
|
| 54 |
# Download the private LLM (requires a token)
|
| 55 |
download_model(LLM_REPO, LLM_DIR, token=HUGGING_FACE_TOKEN)
|
| 56 |
else:
|
| 57 |
+
print("HUGGING_FACE_HUB_TOKEN environment variable NOT found.")
|