Commit d527efc6 authored by nanahira's avatar nanahira

no server kill

parent 72e49d5f
Pipeline #17176 passed with stages
in 14 minutes and 27 seconds
...@@ -6,3 +6,4 @@ Dockerfile ...@@ -6,3 +6,4 @@ Dockerfile
/*.sh /*.sh
/models /models
/static /static
/docker-compose.yml
...@@ -6,7 +6,7 @@ RUN apt update && apt -y install python3-pip python-is-python3 && \ ...@@ -6,7 +6,7 @@ RUN apt update && apt -y install python3-pip python-is-python3 && \
WORKDIR /app WORKDIR /app
COPY ./requirements.txt ./ COPY ./requirements.txt ./
RUN pip install -r requirements.txt RUN pip install --no-cache -r requirements.txt
COPY . ./ COPY . ./
......
version: '2.4'
services:
naifu:
build: '.'
network_mode: host
runtime: nvidia
volumes:
- ./models:/app/models
...@@ -216,7 +216,7 @@ def generate(request: GenerationRequest, authorized: bool = Depends(verify_token ...@@ -216,7 +216,7 @@ def generate(request: GenerationRequest, authorized: bool = Depends(verify_token
if "CUDA out of memory" in e_s or \ if "CUDA out of memory" in e_s or \
"an illegal memory access" in e_s or "CUDA" in e_s: "an illegal memory access" in e_s or "CUDA" in e_s:
logger.error("GPU error, committing seppuku.") logger.error("GPU error, committing seppuku.")
os.kill(mainpid, signal.SIGTERM) # os.kill(mainpid, signal.SIGTERM)
return {"error": str(e)} return {"error": str(e)}
@app.post('/generate', response_model=Union[GenerationOutput, ErrorOutput]) @app.post('/generate', response_model=Union[GenerationOutput, ErrorOutput])
...@@ -267,7 +267,7 @@ def generate(request: GenerationRequest, authorized: bool = Depends(verify_token ...@@ -267,7 +267,7 @@ def generate(request: GenerationRequest, authorized: bool = Depends(verify_token
if "CUDA out of memory" in e_s or \ if "CUDA out of memory" in e_s or \
"an illegal memory access" in e_s or "CUDA" in e_s: "an illegal memory access" in e_s or "CUDA" in e_s:
logger.error("GPU error, committing seppuku.") logger.error("GPU error, committing seppuku.")
os.kill(mainpid, signal.SIGTERM) # os.kill(mainpid, signal.SIGTERM)
return {"error": str(e)} return {"error": str(e)}
@app.post('/generate-text', response_model=Union[TextOutput, ErrorOutput]) @app.post('/generate-text', response_model=Union[TextOutput, ErrorOutput])
...@@ -294,7 +294,7 @@ def generate_text(request: TextRequest, authorized: bool = Depends(verify_token) ...@@ -294,7 +294,7 @@ def generate_text(request: TextRequest, authorized: bool = Depends(verify_token)
if "CUDA out of memory" in e_s or \ if "CUDA out of memory" in e_s or \
"an illegal memory access" in e_s or "CUDA" in e_s: "an illegal memory access" in e_s or "CUDA" in e_s:
logger.error("GPU error, committing seppuku.") logger.error("GPU error, committing seppuku.")
os.kill(mainpid, signal.SIGTERM) # os.kill(mainpid, signal.SIGTERM)
return ErrorOutput(error=str(e)) return ErrorOutput(error=str(e))
@app.get('/predict-tags', response_model=Union[TagOutput, ErrorOutput]) @app.get('/predict-tags', response_model=Union[TagOutput, ErrorOutput])
...@@ -321,7 +321,7 @@ async def predict_tags(prompt="", authorized: bool = Depends(verify_token)): ...@@ -321,7 +321,7 @@ async def predict_tags(prompt="", authorized: bool = Depends(verify_token)):
if "CUDA out of memory" in e_s or \ if "CUDA out of memory" in e_s or \
"an illegal memory access" in e_s or "CUDA" in e_s: "an illegal memory access" in e_s or "CUDA" in e_s:
logger.error("GPU error, committing seppuku.") logger.error("GPU error, committing seppuku.")
os.kill(mainpid, signal.SIGTERM) # os.kill(mainpid, signal.SIGTERM)
return ErrorOutput(error=str(e)) return ErrorOutput(error=str(e))
#@app.get('/') #@app.get('/')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment