Spaces:
Paused
Paused
| FROM python:latest | |
| ENV PYTHONUNBUFFERED 1 | |
| EXPOSE 8000 | |
| WORKDIR /app | |
| RUN wget -qO- "https://cmake.org/files/v3.17/cmake-3.17.0-Linux-x86_64.tar.gz" | tar --strip-components=1 -xz -C /usr/local | |
| COPY requirements.txt ./ | |
| RUN pip install --upgrade pip && \ | |
| pip install -r requirements.txt | |
| RUN curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash | |
| RUN apt-get install git-lfs | |
| RUN git clone https://github.com/emscripten-core/emsdk.git && \ | |
| cd emsdk && \ | |
| ./emsdk install latest && \ | |
| ./emsdk activate latest | |
| # Add Emscripten to PATH | |
| ENV PATH="/app/emsdk:${PATH}" | |
| ENV PATH="/app/emsdk/upstream/emscripten:${PATH}" | |
| RUN git clone https://github.com/ggerganov/ggml && cd ggml && mkdir build && cd build && cmake .. | |
| RUN git clone https://huggingface.co/bigcode/gpt_bigcode-santacoder | |
| RUN python ggml/examples/starcoder/convert-hf-to-ggml.py ./gpt_bigcode-santacoder/ | |
| RUN cd ggml/build && make -j4 starcoder starcoder-quantize | |
| RUN ggml/build/bin/starcoder-quantize models/./gpt_bigcode-santacoder/-ggml.bin ggml-model-q4_0.bin 2 | |
| RUN ls ggml/build/bin | |
| RUN emcc -Iggml/include -Iggml/include/ggml -Iggml/examples ggml/src/ggml.c ggml/examples/starcoder/main.cpp -o santacoder.js -s EXPORTED_FUNCTIONS='["_malloc","_free"]' -s EXPORTED_RUNTIME_METHODS='["ccall"]' -s ALLOW_MEMORY_GROWTH=1 --preload-file ggml-model-q4_0.bin | |
| RUN git config --global user.email "matthoffner@gmail.com" \ | |
| && git config --global user.name "matthoffner" \ | |
| && export HOME=/root \ | |
| && touch $HOME/.netrc \ | |
| && git clone https://huggingface.co/matthoffner/santacoder-wasm \ | |
| && cd santacoder-wasm \ | |
| && mv ../santacoder.wasm . \ | |
| && mv ../santacoder.js . \ | |
| && mv ../santacoder.data . \ | |
| && git add . \ | |
| && git commit -m 'Add model' \ | |
| && git push | |
| COPY . . | |
| RUN ls -al | |
| CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"] | |