카테고리 없음

ctransformers Docker 세팅

rongxian 2023. 9. 14. 13:44

 

# NVidia development base image
FROM nvidia/cuda:11.8.0-cudnn8-devel-ubuntu22.04

# Install necessary packages
RUN apt-get update && apt-get install -y \
    python3 \
    python3-pip

# Create a user named "user"
RUN useradd -m user

# Switch to the new user
USER user

# Set the home directory for the new user
ENV HOME=/home/user
RUN mkdir -p $HOME/.local/bin
ENV PATH=$HOME/.local/bin:$PATH
ENV CT_CUBLAS=1

# Install Jupyter Notebook and CTransformers
WORKDIR $HOME/app
RUN pip install --user --no-cache-dir --upgrade pip && pip install --user --no-cache-dir notebook ipywidgets
RUN CT_CUBLAS=1 pip install --no-cache-dir ctransformers --no-binary ctransformers --user

# Set the working directory
WORKDIR $HOME/app

COPY start_services /start_services
CMD /start_services
EXPOSE 8888
#!/bin/bash

# Start Jupyter notebook
jupyter notebook --allow-root --no-browse --ip 0.0.0.0 --NotebookApp.token "" --NotebookApp.password "" &

# Wait for any process to exit
wait -n

# Exit with status of process that exited first
exit $?​
version: '3'
services:
  ctransfomers:
    container_name: ctransfomers_cuda
    image: ctransformers:dev
    ports:
      - "8888:8888"
    volumes:
      - ./models/ggml_models:/home/user/app/models
      - ./files:/home/user/app/files
    environment:
      - NVIDIA_VISIBLE_DEVICES=0
    runtime: nvidia

 

 

 

출처: https://github.com/marella/ctransformers/issues/25#issuecomment-1603667390