Skip to content

style: rolled-up config logs to one info line. put rest of hints in debug - #444

Closed
KaunilD wants to merge 442 commits into
ai-dynamo:mainfrom
KaunilD:kdhruv/dynamo-run/concise-strtup-logs
Closed

KaunilD wants to merge 442 commits into
ai-dynamo:mainfrom
KaunilD:kdhruv/dynamo-run/concise-strtup-logs

Conversation

@KaunilD

@KaunilD KaunilD commented Mar 31, 2025

Copy link
Copy Markdown

Overview:

Details:

Where should the reviewer start?

Related Issues: (use one of the action keywords Closes / Fixes / Resolves / Relates to)

  • closes GitHub issue: #xxx

whoisj and others added 30 commits March 4, 2025 16:34
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>
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.
@copy-pr-bot

copy-pr-bot Bot commented Mar 31, 2025

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@github-actions

Copy link
Copy Markdown
Contributor

👋 Hi KaunilD! Thank you for contributing to ai-dynamo/dynamo.

Just a reminder: The NVIDIA Test Github Validation CI runs an essential subset of the testing framework to quickly catch errors.Your PR reviewers may elect to test the changes comprehensively before approving your changes.

🚀

@github-actions github-actions Bot added the external-contribution Pull request is from an external contributor label Mar 31, 2025
@KaunilD KaunilD changed the title rolled-up config logs to one info line. put rest of hints in debug fix:rolled-up config logs to one info line. put rest of hints in debug Mar 31, 2025
@KaunilD KaunilD changed the title fix:rolled-up config logs to one info line. put rest of hints in debug style:rolled-up config logs to one info line. put rest of hints in debug Mar 31, 2025
@KaunilD KaunilD changed the title style:rolled-up config logs to one info line. put rest of hints in debug style: rolled-up config logs to one info line. put rest of hints in debug Mar 31, 2025

#[cfg(not(any(feature = "mistralrs", feature = "llamacpp")))]
fn print_cuda(_output: &Output) {}
fn get_acceleration_status() {}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Comment thread launch/dynamo-run/src/main.rs Outdated
print_cuda(&out_opt);

tracing::info!(
"engine={},input={},accelerator={}",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice. Could you add spaces after the comma?

engine={out_opt}, input=....

Comment thread launch/dynamo-run/src/opt.rs Outdated
}

impl Input {
pub fn available_inputs() -> Vec<String> {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

contact-us external-contribution Pull request is from an external contributor

Projects

None yet

Development

Successfully merging this pull request may close these issues.