Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 40db98915f | |||
| 94926b74b6 | |||
| d0347b0755 | |||
| 9bc9ba11c5 | |||
| 48fdc65e3d | |||
| 2cd97315cd |
@@ -0,0 +1,37 @@
|
|||||||
|
// .devcontainer/devcontainer.json
|
||||||
|
// Dev container for the Vast.ai serverless Ollama template.
|
||||||
|
// Includes Docker-in-Docker so you can build and test images from inside the container.
|
||||||
|
{
|
||||||
|
"name": "vast.ai-serverless-ollama",
|
||||||
|
"image": "mcr.microsoft.com/devcontainers/base:trixie",
|
||||||
|
"features": {
|
||||||
|
"ghcr.io/devcontainers/features/python:1": {
|
||||||
|
"installTools": true,
|
||||||
|
"version": "3.12"
|
||||||
|
},
|
||||||
|
"ghcr.io/devcontainers/features/docker-in-docker:3.0.0": {
|
||||||
|
"moby": false,
|
||||||
|
"version": "latest",
|
||||||
|
"installDockerBuildx": true,
|
||||||
|
"dockerDashComposeVersion": "v2"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"runArgs": ["--privileged"],
|
||||||
|
"containerEnv": {
|
||||||
|
"DOCKER_BUILDKIT": "1"
|
||||||
|
},
|
||||||
|
"postCreateCommand": "python3 -m pip install --user --upgrade pip && python3 -m pip install --user -r requirements.txt pyyaml",
|
||||||
|
"customizations": {
|
||||||
|
"vscode": {
|
||||||
|
"extensions": [
|
||||||
|
"ms-python.python",
|
||||||
|
"ms-azuretools.vscode-docker"
|
||||||
|
],
|
||||||
|
"settings": {
|
||||||
|
"python.defaultInterpreterPath": "/usr/bin/python3",
|
||||||
|
"terminal.integrated.defaultProfile.linux": "bash",
|
||||||
|
"docker.showStartPage": false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1 +1,2 @@
|
|||||||
vastai-sdk>=0.3.0
|
vastai-sdk>=0.3.0
|
||||||
|
nltk==3.9.4
|
||||||
+15
-15
@@ -60,32 +60,32 @@ function install_vastai_sdk() {
|
|||||||
fi
|
fi
|
||||||
if [ "$FORCE_UPDATE" = true ]; then
|
if [ "$FORCE_UPDATE" = true ]; then
|
||||||
uv_flags+=(--force-reinstall)
|
uv_flags+=(--force-reinstall)
|
||||||
echo "Force reinstalling vastai-sdk"
|
echo "Force reinstalling vastai"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# If SDK_BRANCH is set, install vastai-sdk from the vast-sdk repo at that branch/tag/commit.
|
# If SDK_BRANCH is set, install vastai from the vast-cli repo at that branch/tag/commit.
|
||||||
if [ -n "${SDK_BRANCH:-}" ]; then
|
if [ -n "${SDK_BRANCH:-}" ]; then
|
||||||
if [ -n "${SDK_VERSION:-}" ]; then
|
if [ -n "${SDK_VERSION:-}" ]; then
|
||||||
echo "WARNING: Both SDK_BRANCH and SDK_VERSION are set; using SDK_BRANCH=${SDK_BRANCH}"
|
echo "WARNING: Both SDK_BRANCH and SDK_VERSION are set; using SDK_BRANCH=${SDK_BRANCH}"
|
||||||
fi
|
fi
|
||||||
echo "Installing vastai-sdk from https://github.com/vast-ai/vast-sdk/ @ ${SDK_BRANCH}"
|
echo "Installing vastai from https://github.com/vast-ai/vast-cli/ @ ${SDK_BRANCH}"
|
||||||
if ! uv pip install "${uv_flags[@]}" "vastai-sdk @ git+https://github.com/vast-ai/vast-sdk.git@${SDK_BRANCH}"; then
|
if ! uv pip install "${uv_flags[@]}" "vastai @ git+https://github.com/vast-ai/vast-cli.git@${SDK_BRANCH}"; then
|
||||||
report_error_and_exit "Failed to install vastai-sdk from vast-ai/vast-sdk@${SDK_BRANCH}"
|
report_error_and_exit "Failed to install vastai from vast-ai/vast-cli@${SDK_BRANCH}"
|
||||||
fi
|
fi
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "${SDK_VERSION:-}" ]; then
|
if [ -n "${SDK_VERSION:-}" ]; then
|
||||||
echo "Installing vastai-sdk version ${SDK_VERSION}"
|
echo "Installing vastai version ${SDK_VERSION}"
|
||||||
if ! uv pip install "${uv_flags[@]}" "vastai-sdk==${SDK_VERSION}"; then
|
if ! uv pip install "${uv_flags[@]}" "vastai==${SDK_VERSION}"; then
|
||||||
report_error_and_exit "Failed to install vastai-sdk==${SDK_VERSION}"
|
report_error_and_exit "Failed to install vastai==${SDK_VERSION}"
|
||||||
fi
|
fi
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Installing default vastai-sdk"
|
echo "Installing default vastai"
|
||||||
if ! uv pip install "${uv_flags[@]}" vastai-sdk; then
|
if ! uv pip install "${uv_flags[@]}" vastai; then
|
||||||
report_error_and_exit "Failed to install vastai-sdk"
|
report_error_and_exit "Failed to install vastai"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -339,19 +339,19 @@ set +e
|
|||||||
PY_STATUS=1
|
PY_STATUS=1
|
||||||
|
|
||||||
if [ -f "$SERVER_DIR/worker.py" ]; then
|
if [ -f "$SERVER_DIR/worker.py" ]; then
|
||||||
echo "trying worker.py"
|
echo "Running worker.py"
|
||||||
python3 -m "worker" |& tee -a "$PYWORKER_LOG"
|
python3 -m "worker" |& tee -a "$PYWORKER_LOG"
|
||||||
PY_STATUS=${PIPESTATUS[0]}
|
PY_STATUS=${PIPESTATUS[0]}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "${PY_STATUS}" -ne 0 ] && [ -f "$SERVER_DIR/workers/$BACKEND/worker.py" ]; then
|
if [ "${PY_STATUS}" -ne 0 ] && [ -f "$SERVER_DIR/workers/$BACKEND/worker.py" ]; then
|
||||||
echo "trying workers.${BACKEND}.worker"
|
echo "Running workers.${BACKEND}.worker"
|
||||||
python3 -m "workers.${BACKEND}.worker" |& tee -a "$PYWORKER_LOG"
|
python3 -m "workers.${BACKEND}.worker" |& tee -a "$PYWORKER_LOG"
|
||||||
PY_STATUS=${PIPESTATUS[0]}
|
PY_STATUS=${PIPESTATUS[0]}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "${PY_STATUS}" -ne 0 ] && [ -f "$SERVER_DIR/workers/$BACKEND/server.py" ]; then
|
if [ "${PY_STATUS}" -ne 0 ] && [ -f "$SERVER_DIR/workers/$BACKEND/server.py" ]; then
|
||||||
echo "trying workers.${BACKEND}.server"
|
echo "Running workers.${BACKEND}.server"
|
||||||
python3 -m "workers.${BACKEND}.server" |& tee -a "$PYWORKER_LOG"
|
python3 -m "workers.${BACKEND}.server" |& tee -a "$PYWORKER_LOG"
|
||||||
PY_STATUS=${PIPESTATUS[0]}
|
PY_STATUS=${PIPESTATUS[0]}
|
||||||
fi
|
fi
|
||||||
@@ -365,4 +365,4 @@ if [ "${PY_STATUS}" -ne 0 ]; then
|
|||||||
report_error_and_exit "PyWorker exited with status ${PY_STATUS}"
|
report_error_and_exit "PyWorker exited with status ${PY_STATUS}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "launching PyWorker server done"
|
echo "PyWorker bootstrap complete"
|
||||||
|
|||||||
@@ -7,12 +7,15 @@ from vastai import Worker, WorkerConfig, HandlerConfig, LogActionConfig, Benchma
|
|||||||
# vLLM model configuration
|
# vLLM model configuration
|
||||||
MODEL_SERVER_URL = 'http://127.0.0.1'
|
MODEL_SERVER_URL = 'http://127.0.0.1'
|
||||||
MODEL_SERVER_PORT = 18000
|
MODEL_SERVER_PORT = 18000
|
||||||
MODEL_LOG_FILE = '/var/log/portal/vllm.log'
|
MODEL_LOG_FILE = '/var/log/onstart.log'
|
||||||
MODEL_HEALTHCHECK_ENDPOINT = "/health"
|
MODEL_HEALTHCHECK_ENDPOINT = "/health"
|
||||||
|
|
||||||
# vLLM-specific log messages
|
# vLLM-specific log messages
|
||||||
MODEL_LOAD_LOG_MSG = [
|
MODEL_LOAD_LOG_MSG = [
|
||||||
"Application startup complete.",
|
"Application startup complete.",
|
||||||
|
"llama runner started in",
|
||||||
|
"Server listening on",
|
||||||
|
"msg=\"Listening on",
|
||||||
]
|
]
|
||||||
|
|
||||||
MODEL_ERROR_LOG_MSGS = [
|
MODEL_ERROR_LOG_MSGS = [
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ def benchmark_generator() -> dict:
|
|||||||
benchmark_data = {
|
benchmark_data = {
|
||||||
"inputs": prompt,
|
"inputs": prompt,
|
||||||
"parameters": {
|
"parameters": {
|
||||||
"max_new_tokens": 128,
|
"max_new_tokens": 500,
|
||||||
"temperature": 0.7,
|
"temperature": 0.7,
|
||||||
"return_full_text": False
|
"return_full_text": False
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user