Spaces:
Sleeping
Sleeping
Dmitry Beresnev commited on
Commit ·
62a5a49
1
Parent(s): e1e4b82
fix context window size
Browse files111 unmodified lines112113114115116117476 unmodified lines594595596597598599600324 unmodified lines925926927928929930111 unmodified linesREQUEST_TIMEOUT = int(os.getenv("REQUEST_TIMEOUT", "300")) # 5 minutesLOG_REQUEST_BODY = os.getenv("LOG_REQUEST_BODY", "1") == "1"LOG_REQUEST_BODY_MAX_CHARS = int(os.getenv("LOG_REQUEST_BODY_MAX_CHARS", "2000"))@dataclass476 unmodified lines"-hf", model_id,"--host", "0.0.0.0","--port", str(port),"-c", "2048", # Context size"-t", "4", # CPU threads"-ngl", "0", # GPU layers (0 for CPU-only)"--cont-batching", # Enable continuous batching324 unmodified linesmetrics.record_request(current_model, request_latency)return resultexcept aiohttp.ClientError as e:logger.exception(f"request_id={request_id} llama-server error")raise HTTPException(status_code=500, detail=f"llama-server error: {str(e)}")111 unmodified lines112113114115116117118476 unmodified lines595596597598599600601324 unmodified lines926927928929930931932933934111 unmodified linesREQUEST_TIMEOUT = int(os.getenv("REQUEST_TIMEOUT", "300")) # 5 minutesLOG_REQUEST_BODY = os.getenv("LOG_REQUEST_BODY", "1") == "1"LOG_REQUEST_BODY_MAX_CHARS = int(os.getenv("LOG_REQUEST_BODY_MAX_CHARS", "2000"))CONTEXT_SIZE = int(os.getenv("CONTEXT_SIZE", "2048"))@dataclass476 unmodified lines"-hf", model_id,"--host", "0.0.0.0","--port", str(port),"-c", str(CONTEXT_SIZE), # Context size"-t", "4", # CPU threads"-ngl", "0", # GPU layers (0 for CPU-only)"--cont-batching", # Enable continuous batching324 unmodified linesmetrics.record_request(current_model, request_latency)return resultexcept aiohttp.ClientResponseError as e:logger.exception(f"request_id={request_id} llama-server error")raise HTTPException(status_code=e.status, detail=f"llama-server error: {e.message}")except aiohttp.ClientError as e:logger.exception(f"request_id={request_id} llama-server error")raise HTTPException(status_code=500, detail=f"llama-server error: {str(e)}")
app.py+5-1