Skip to content

Commit 6668cc8

Browse files
authoredAug 31, 2024
Merge branch 'main' into feat/evict-req-on-client-disconnect-streaming-case
2 parents 6c2e0c6 + ecf76ac commit 6668cc8

25 files changed

+983
-52
lines changed
 

‎README.md

+15-15
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,16 @@ LitServe is at least [2x faster](#performance) than plain FastAPI due to AI-spec
1919
<div align='center'>
2020

2121
<pre>
22-
✅ (2x)+ faster serving ✅ Easy to use ✅ Batching, Streaming
23-
✅ Bring your own model ✅ PyTorch/JAX/TF/... ✅ Built on FastAPI
24-
✅ GPU autoscaling ✅ Multi-modal ✅ Self-host or ⚡️ managed
22+
✅ (2x)+ faster serving ✅ Easy to use ✅ LLMs, non LLMs and more
23+
✅ Bring your own model ✅ PyTorch/JAX/TF/... ✅ Built on FastAPI
24+
✅ GPU autoscaling ✅ Batching, Streaming ✅ Self-host or ⚡️ managed
2525
</pre>
2626

2727
<div align='center'>
2828

2929
[![Discord](https://img.shields.io/discord/1077906959069626439?label=Get%20help%20on%20Discord)](https://discord.gg/VptPCZkGNa)
3030
![cpu-tests](https://github.com/Lightning-AI/litserve/actions/workflows/ci-testing.yml/badge.svg)
31+
[![codecov](https://codecov.io/gh/Lightning-AI/litserve/graph/badge.svg?token=SmzX8mnKlA)](https://codecov.io/gh/Lightning-AI/litserve)
3132
[![license](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://github.com/Lightning-AI/litserve/blob/main/LICENSE)
3233

3334
</div>
@@ -104,24 +105,23 @@ python server.py
104105
```
105106

106107
### Test the server
108+
Run the auto-generated test client:
109+
```bash
110+
python client.py
111+
```
107112

108-
Run this command on your terminal to test the server:
109-
113+
Or use this terminal command:
110114
```bash
111115
curl -X POST http://127.0.0.1:8000/predict -H "Content-Type: application/json" -d '{"input": 4.0}'
112116
```
113117

114-
<details>
115-
<summary>Example of a custom Python client</summary>
118+
### LLM serving
119+
LitServe isn’t *just* for LLMs like vLLM or Ollama; it serves any AI model with full control over internals ([learn more](https://lightning.ai/docs/litserve/features/serve-llms)).
120+
For easy LLM serving, use [LitGPT](https://github.com/Lightning-AI/litgpt?tab=readme-ov-file#deploy-an-llm) (built on LitServe).
116121

117-
```python
118-
import requests
119-
response = requests.post(
120-
"http://127.0.0.1:8000/predict",
121-
json={"input": 4.0}
122-
)
123122
```
124-
</details>
123+
litgpt serve microsoft/phi-2
124+
```
125125

126126
### Summary
127127
- LitAPI lets you easily build complex AI systems with one or more models ([docs](https://lightning.ai/docs/litserve/api-reference/litapi)).
@@ -148,7 +148,7 @@ Use LitServe to deploy any model or AI service: (Gen AI, classical ML, embedding
148148
<strong>LLMs:</strong> <a target="_blank" href="https://lightning.ai/lightning-ai/studios/deploy-a-private-llama-3-8b-api">Llama 3 (8B)</a>, <a target="_blank" href="https://lightning.ai/lightning-ai/studios/openai-fault-tolerant-proxy-server">LLM Proxy server</a>, <a target="_blank" href="https://lightning.ai/lightning-ai/studios/deploy-ai-agent-with-tool-use">Agent with tool use</a>
149149
<strong>RAG:</strong> <a target="_blank" href="https://lightning.ai/lightning-ai/studios/deploy-a-private-llama-3-1-rag-api">RAG API (LlamaIndex)</a>
150150
<strong>NLP:</strong> <a target="_blank" href="https://lightning.ai/lightning-ai/studios/deploy-any-hugging-face-model-instantly">Hugging face</a>, <a target="_blank" href="https://lightning.ai/lightning-ai/studios/deploy-a-hugging-face-bert-model">BERT</a>, <a target="_blank" href="https://lightning.ai/lightning-ai/studios/deploy-text-embedding-api-with-litserve">Text embedding API</a>
151-
<strong>Multimodal:</strong> <a target="_blank" href="https://lightning.ai/lightning-ai/studios/deploy-open-ai-clip-with-litserve">OpenAI Clip</a>, <a target="_blank" href="https://lightning.ai/lightning-ai/studios/deploy-a-multi-modal-llm-with-minicpm">MiniCPM</a>, <a target="_blank" href="https://lightning.ai/lightning-ai/studios/deploy-phi3-5-vision-api-with-litserve">Phi-3.5 Vision Instruct</a>
151+
<strong>Multimodal:</strong> <a target="_blank" href="https://lightning.ai/lightning-ai/studios/deploy-open-ai-clip-with-litserve">OpenAI Clip</a>, <a target="_blank" href="https://lightning.ai/lightning-ai/studios/deploy-a-multi-modal-llm-with-minicpm">MiniCPM</a>, <a target="_blank" href="https://lightning.ai/lightning-ai/studios/deploy-phi3-5-vision-api-with-litserve">Phi-3.5 Vision Instruct</a>, <a target="_blank" href="https://lightning.ai/bhimrajyadav/studios/deploy-and-chat-with-qwen2-vl-using-litserve">Qwen2-VL</a>
152152
<strong>Audio:</strong> <a target="_blank" href="https://lightning.ai/lightning-ai/studios/deploy-open-ai-s-whisper-model">Whisper</a>, <a target="_blank" href="https://lightning.ai/lightning-ai/studios/deploy-an-music-generation-api-with-meta-s-audio-craft">AudioCraft</a>, <a target="_blank" href="https://lightning.ai/lightning-ai/studios/deploy-an-audio-generation-api">StableAudio</a>, <a target="_blank" href="https://lightning.ai/lightning-ai/studios/deploy-a-noise-cancellation-api-with-deepfilternet">Noise cancellation (DeepFilterNet)</a>
153153
<strong>Vision:</strong> <a target="_blank" href="https://lightning.ai/lightning-ai/studios/deploy-a-private-api-for-stable-diffusion-2">Stable diffusion 2</a>, <a target="_blank" href="https://lightning.ai/lightning-ai/studios/deploy-an-image-generation-api-with-auraflow">AuraFlow</a>, <a target="_blank" href="https://lightning.ai/lightning-ai/studios/deploy-an-image-generation-api-with-flux">Flux</a>, <a target="_blank" href="https://lightning.ai/lightning-ai/studios/deploy-a-super-resolution-image-api-with-aura-sr">Image Super Resolution (Aura SR)</a>,
154154
<a target="_blank" href="https://lightning.ai/bhimrajyadav/studios/deploy-background-removal-api-with-litserve">Background Removal</a>, <a target="_blank" href="https://lightning.ai/lightning-ai/studios/deploy-a-controlled-image-generation-api-controlnet">Control Stable Diffusion (ControlNet)</a>

‎src/litserve/__init__.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@
1111
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
14-
from litserve.__about__ import * # noqa: F401, F403
14+
from litserve.__about__ import * # noqa: F403
1515
from litserve.api import LitAPI
1616
from litserve.server import LitServer, Request, Response
17-
from litserve import examples
17+
from litserve import test_examples
1818
from litserve.specs.openai import OpenAISpec
1919

20-
__all__ = ["LitAPI", "LitServer", "Request", "Response", "examples", "OpenAISpec"]
20+
__all__ = ["LitAPI", "LitServer", "Request", "Response", "test_examples", "OpenAISpec"]

‎src/litserve/api.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ def device(self):
103103
def device(self, value):
104104
self._device = value
105105

106-
def _sanitize(self, max_batch_size: int, spec: LitSpec):
106+
def _sanitize(self, max_batch_size: int, spec: Optional[LitSpec]):
107107
if self.stream:
108108
self._default_unbatch = self._unbatch_stream
109109
else:

‎src/litserve/examples/__init__.py

-3
This file was deleted.

0 commit comments

Comments
 (0)