From 884666c3e9013d967d1141c6f01cea80afc41877 Mon Sep 17 00:00:00 2001 From: Lim Chee Kin Date: Thu, 7 Sep 2023 08:55:15 +0800 Subject: [PATCH] bug: moved the run commands from dockerfile to python file --- orca-mini-v3-7b/Dockerfile | 4 ---- orca-mini-v3-7b/fastapi_app.py | 5 ++++- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/orca-mini-v3-7b/Dockerfile b/orca-mini-v3-7b/Dockerfile index aa68240..16fbc2d 100644 --- a/orca-mini-v3-7b/Dockerfile +++ b/orca-mini-v3-7b/Dockerfile @@ -16,7 +16,3 @@ RUN pip install -U pip setuptools wheel && \ # Download model RUN mkdir model && \ curl -L https://huggingface.co/TheBloke/orca_mini_v3_7B-GGML/resolve/main/orca_mini_v3_7b.ggmlv3.q4_0.bin -o model/ggml-model.bin - -# Fix: Cannot allocate memory. Try increasing RLIMIT_MLOCK ('ulimit -l' as root). -RUN echo "* soft memlock unlimited" >> /etc/security/limits.conf && \ - echo "* hard memlock unlimited" >> /etc/security/limits.conf diff --git a/orca-mini-v3-7b/fastapi_app.py b/orca-mini-v3-7b/fastapi_app.py index fced351..58495f0 100644 --- a/orca-mini-v3-7b/fastapi_app.py +++ b/orca-mini-v3-7b/fastapi_app.py @@ -5,7 +5,10 @@ image = Image.from_dockerfile( "Dockerfile", force_build=True -).pip_install("pydantic_settings").pip_install("fastapi==0.100.1") +).pip_install("pydantic_settings").pip_install("fastapi==0.100.1").run_commands( + # Fix: Cannot allocate memory. Try increasing RLIMIT_MLOCK ('ulimit -l' as root). + 'echo "* soft memlock unlimited" >> /etc/security/limits.conf && echo "* hard memlock unlimited" >> /etc/security/limits.conf', +) @stub.function(image=image, cpu=14, memory=5120, keep_warm=1, timeout=600)