Repository navigation
Conversation
Needs more testing but good enough for now. I get the same results with this as with `vllm serve`.
Co-authored-by: Tanmay Verma <tanmayv@nvidia.com> Co-authored-by: Tanmay Verma <tanmayv@login-eos01.eos.clusters.nvidia.com> Co-authored-by: Tanmay Verma <tanmay2592@gmail.com> Co-authored-by: Ryan McCormick <rmccormick@nvidia.com>
Co-authored-by: Graham King <grahamk@nvidia.com>
Fixes a panic.
ai-dynamo#32) Co-authored-by: ptarasiewiczNV <104908264+ptarasiewiczNV@users.noreply.github.com>
Co-authored-by: ptarasiewicz@nvidia.com <Piotr Tarasiewicz>
Co-authored-by: ptarasiewicz@nvidia.com <Piotr Tarasiewicz>
1. Create `my_engine.py`
```
import asyncio
async def generate(request):
yield {"id":"1","choices":[{"index":0,"delta":{"content":"The","role":"assistant"}}],"created":1841762283,"model":"Llama-3.2-1B-Instruct","system_fingerprint":"local","object":"chat.completion.chunk"}
await asyncio.sleep(0.1)
yield {"id":"1","choices":[{"index":0,"delta":{"content":" capital","role":"assistant"}}],"created":1841762283,"model":"Llama-3.2-1B-Instruct","system_fingerprint":"local","object":"chat.completion.chunk"}
await asyncio.sleep(0.1)
yield {"id":"1","choices":[{"index":0,"delta":{"content":" of","role":"assistant"}}],"created":1841762283,"model":"Llama-3.2-1B-Instruct","system_fingerprint":"local","object":"chat.completion.chunk"}
await asyncio.sleep(0.1)
yield {"id":"1","choices":[{"index":0,"delta":{"content":" France","role":"assistant"}}],"created":1841762283,"model":"Llama-3.2-1B-Instruct","system_fingerprint":"local","object":"chat.completion.chunk"}
await asyncio.sleep(0.1)
yield {"id":"1","choices":[{"index":0,"delta":{"content":" is","role":"assistant"}}],"created":1841762283,"model":"Llama-3.2-1B-Instruct","system_fingerprint":"local","object":"chat.completion.chunk"}
await asyncio.sleep(0.1)
yield {"id":"1","choices":[{"index":0,"delta":{"content":" Paris","role":"assistant"}}],"created":1841762283,"model":"Llama-3.2-1B-Instruct","system_fingerprint":"local","object":"chat.completion.chunk"}
await asyncio.sleep(0.1)
yield {"id":"1","choices":[{"index":0,"delta":{"content":".","role":"assistant"}}],"created":1841762283,"model":"Llama-3.2-1B-Instruct","system_fingerprint":"local","object":"chat.completion.chunk"}
await asyncio.sleep(0.1)
yield {"id":"1","choices":[{"index":0,"delta":{"content":"","role":"assistant"},"finish_reason":"stop"}],"created":1841762283,"model":"Llama-3.2-1B-Instruct","system_fingerprint":"local","object":"chat.completion.chunk"}
```
2. Build
```
cargo build --release --feature python
```
3. Run
```
dynemo-run out=pystr:my_engine.py --name test
```
And here's a distributed system, with your engine:
- Node 1: `dynemo-run in=http out=dyn://test`
- Node 2: `dynemo-run in=dyn://test out=pystr:my_engine.py`
Instead of using `out=pystr:<my.py>` we can now do this:
```
dynemo-run out=pytok:/home/graham/my_python_engine.py --model-path <hf-repo-checkout>
```
That engine will receive and respond with tokens. Here's an example engine file:
```
import asyncio
async def generate(request):
yield {"token_ids":[791]}
await asyncio.sleep(0.1)
yield {"token_ids":[6864]}
await asyncio.sleep(0.1)
yield {"token_ids":[315]}
await asyncio.sleep(0.1)
yield {"token_ids":[9822]}
await asyncio.sleep(0.1)
yield {"token_ids":[374]}
await asyncio.sleep(0.1)
yield {"token_ids":[12366]}
await asyncio.sleep(0.1)
yield {"token_ids":[13]}
```
Also reduce duplication by making the bindings engine use the llm lib engine.
…ynamo#46) Co-authored-by: ptarasiewicz@nvidia.com <Piotr Tarasiewicz>
Replaces hard-coded "kv-hit-rate" string in multiple places with KV_HIT_RATE_SUBJECT constant in lib/llm.
Co-authored-by: Neelay Shah <neelays@nvidia.com>
There are two etcd keys: - The service - The model The second one is the interesting one for us. Previously we confused the two.
|
👋 Hi KaunilD! Thank you for contributing to ai-dynamo/dynamo. Just a reminder: The 🚀 |
|
|
||
| #[cfg(not(any(feature = "mistralrs", feature = "llamacpp")))] | ||
| fn print_cuda(_output: &Output) {} | ||
| fn get_acceleration_status() {} |
There was a problem hiding this comment.
The signature has to match. This should return a string.
Maybe if they are using a Python engine (i.e. not mistralrs or llamacpp) we don't display the "accelerator=" part?
| print_cuda(&out_opt); | ||
|
|
||
| tracing::info!( | ||
| "engine={},input={},accelerator={}", |
There was a problem hiding this comment.
Very nice. Could you add spaces after the comma?
engine={out_opt}, input=....
| } | ||
|
|
||
| impl Input { | ||
| pub fn available_inputs() -> Vec<String> { |
There was a problem hiding this comment.
Is this used anywhere? I don't think we need it, they are all always included, so --help will tell them (see main.rs at the top)
| // The Python engines only need it at runtime. | ||
| #[cfg(any(feature = "mistralrs", feature = "llamacpp"))] | ||
| fn print_cuda(output: &Output) { | ||
| // These engines maybe be compiled in, but are they the chosen one? |
There was a problem hiding this comment.
We do need this part. They could compile with mistralrs engine, but be running the vllm engine. That decides at runtime whether to use CUDA or not. We don't want to print accelerator=CPU when vllm will in fact use CUDA.
Overview:
Details:
Where should the reviewer start?
Related Issues: (use one of the action keywords Closes / Fixes / Resolves / Relates to)