Skip to content

Conversation

WoosukKwon
Copy link
Collaborator

@WoosukKwon WoosukKwon commented Mar 3, 2023

This PR adds OPT memory analyzer to the system, and uses it to automatically determine the KV cache size.

Tested models:

  • OPT-125M
  • OPT-350M
  • OPT-1.3B
  • OPT-2.7B
  • OPT-6.7B
  • OPT-13B

Tested GPUs:

  • A100

@WoosukKwon WoosukKwon merged commit e9d3f2f into main Mar 12, 2023
@WoosukKwon WoosukKwon deleted the autoconfig branch March 12, 2023 07:23
xiangyuT added a commit to xiangyuT/vllm that referenced this pull request Oct 24, 2023
* finish changing scheduler

* finish merge

* fix model

* Fix (vllm-project#5)

* fix problems

* fix

* delete unused params

* remove redundant comments

---------

Co-authored-by: Xiangyu Tian <[email protected]>
hongxiayang pushed a commit to hongxiayang/vllm that referenced this pull request Feb 13, 2024
slyalin pushed a commit to slyalin/vllm that referenced this pull request Mar 21, 2024
mzusman added a commit to mzusman/vllm that referenced this pull request Apr 16, 2024
Co-authored-by: Mor Zusman <[email protected]>
dtrifiro referenced this pull request in dtrifiro/vllm Apr 26, 2024
[CI/Build] Dockerfile.ubi : Remove test stage
Starmys pushed a commit to Starmys/vllm that referenced this pull request May 20, 2024
aurickq pushed a commit to aurickq/vllm that referenced this pull request Mar 4, 2025
* print numforward

* print forward context

* print forward context

* print forward context

* print forward context

* synchronize after Ulysses in graph capture

* synchronize after Ulysses in graph capture

* synchronize NCCL operations (all-to-all) for graph capture
wuhuikx pushed a commit to wuhuikx/vllm that referenced this pull request Mar 27, 2025
### What this PR does / why we need it?

This PR is a refactoring of model runner, to decouple it from the
classes specifically designed for GPU.

The changes of model runner are generally showed below:

![iShot_2025-01-20_21 32
37](https://github.com/user-attachments/assets/e7e14e5f-5367-42cf-bc82-abff35cd73b9)

**Other changes:** I have removed the code of `cuda`, `lora` and `prompt
adapter`, because NPU doesn`t support them now.

### Does this PR introduce _any_ user-facing change?

no.

### How was this patch tested?

I have used `AI-ModelScope/gpt2` for testing
`examples/offline_inference_npu.py`, and the results showed that it
worked well.

The test logs are showed below:

```bash
INFO 02-05 09:08:46 __init__.py:30] Available plugins for group vllm.platform_plugins:
INFO 02-05 09:08:46 __init__.py:32] name=ascend, value=vllm_ascend:register
INFO 02-05 09:08:46 __init__.py:34] all available plugins for group vllm.platform_plugins will be loaded.
INFO 02-05 09:08:46 __init__.py:36] set environment variable VLLM_PLUGINS to control which plugins to load.
INFO 02-05 09:08:46 __init__.py:44] plugin ascend loaded.
INFO 02-05 09:08:46 __init__.py:177] Platform plugin ascend is activated
INFO 02-05 09:08:48 config.py:2383] Downcasting torch.float32 to torch.float16.
INFO 02-05 09:08:59 config.py:542] This model supports multiple tasks: {'generate', 'score', 'embed', 'reward', 'classify'}. Defaulting to 'generate'.
INFO 02-05 09:08:59 llm_engine.py:234] Initializing a V0 LLM engine (v0.1.dev1+gb3a0d01) with config: model='/home/sss/models/AI-ModelScope/gpt2', speculative_config=None, tokenizer='/home/sss/models/AI-ModelScope/gpt2', skip_tokenizer_init=False, tokenizer_mode=auto, revision=None, override_neuron_config=None, tokenizer_revision=None, trust_remote_code=False, dtype=torch.float16, max_seq_len=1024, download_dir=None, load_format=auto, tensor_parallel_size=1, pipeline_parallel_size=1, disable_custom_all_reduce=False, quantization=None, enforce_eager=False, kv_cache_dtype=auto,  device_config=npu, decoding_config=DecodingConfig(guided_decoding_backend='xgrammar'), observability_config=ObservabilityConfig(otlp_traces_endpoint=None, collect_model_forward_time=False, collect_model_execute_time=False), seed=0, served_model_name=/home/sss/models/AI-ModelScope/gpt2, num_scheduler_steps=1, multi_step_stream_outputs=True, enable_prefix_caching=False, chunked_prefill_enabled=False, use_async_output_proc=True, disable_mm_preprocessor_cache=False, mm_processor_kwargs=None, pooler_config=None, compilation_config={"splitting_ops":[],"compile_sizes":[],"cudagraph_capture_sizes":[256,248,240,232,224,216,208,200,192,184,176,168,160,152,144,136,128,120,112,104,96,88,80,72,64,56,48,40,32,24,16,8,4,2,1],"max_capture_size":256}, use_cached_outputs=False, 
WARNING 02-05 09:09:01 _custom_ops.py:21] Failed to import from vllm._C with ModuleNotFoundError("No module named 'vllm._C'")
INFO 02-05 09:09:01 importing.py:16] Triton not installed or not compatible; certain GPU-related functions will not be available.
Loading safetensors checkpoint shards:   0% Completed | 0/1 [00:00<?, ?it/s]
Loading safetensors checkpoint shards: 100% Completed | 1/1 [00:00<00:00,  3.18it/s]
Loading safetensors checkpoint shards: 100% Completed | 1/1 [00:00<00:00,  3.18it/s]

INFO 02-05 09:09:11 executor_base.py:110] # CPU blocks: 98557, # CPU blocks: 7281
INFO 02-05 09:09:11 executor_base.py:115] Maximum concurrency for 1024 tokens per request: 1539.95x
INFO 02-05 09:09:12 llm_engine.py:431] init engine (profile, create kv cache, warmup model) took 2.13 seconds
Processed prompts: 100%|██████████████████████████████████████████████████████████████████████████████████████| 4/4 [00:02<00:00,  1.53it/s, est. speed input: 8.41 toks/s, output: 152.97 toks/s]
Prompt: 'Hello, my name is', Generated text: " John. I'm a writer, and I'm a writer. I'm a writer. I'm a writer. I'm a writer. I'm a writer. I'm a writer. I'm a writer. I'm a writer. I'm a writer. I'm a writer. I'm a writer. I'm a writer. I'm a writer. I'm a writer. I'm a writer. I'm a writer. I'm a writer. I'm a writer. I'm"
Prompt: 'The president of the United States is', Generated text: ' States president. He is the president of the United States. He is the president of the United States. He is the president of the United States. He is the president of the United States. He is the president of the United States. He is the president of the United States. He is the president of the United States. He is the president of the United States. He is the president of the United States. He is the president of the United States. He is the president of the United'
Prompt: 'The capital of France is', Generated text: ' the capital of the French Republic, and the capital of the French Republic is the capital of the French Republic.\n\nThe French Republic is the capital of the French Republic.\n\nThe French Republic is the capital of the French Republic.\n\nThe French Republic is the capital of the French Republic.\n\nThe French Republic is the capital of the French Republic.\n\nThe French Republic is the capital of the French Republic.\n\nThe French Republic is the capital of the French Republic.'
Prompt: 'The future of AI is', Generated text: '\n\nThe future of AI is a question of how to make it work.\n\nThe future of AI is a question of how to make it work.\n\nThe future of AI is a question of how to make it work.\n\nThe future of AI is a question of how to make it work.\n\nThe future of AI is a question of how to make it work.\n\nThe future of AI is a question of how to make it work.\n\nThe future'
```

---------

Signed-off-by: Shanshan Shen <[email protected]>
lsy323 pushed a commit to lsy323/vllm that referenced this pull request Mar 31, 2025
maobaolong pushed a commit to maobaolong/vllm that referenced this pull request Apr 14, 2025
tlrmchlsmth referenced this pull request in tlrmchlsmth/vllm Apr 15, 2025
commit 406d6bf
Author: Rémi Delacourt <[email protected]>
Date:   Fri Apr 11 00:47:40 2025 +0200

    Add MLA support for v1 disagg connector (#6)

    Signed-off-by: remi <[email protected]>

commit 1d8415d
Author: [email protected] <[email protected]>
Date:   Thu Apr 10 21:59:54 2025 +0000

    rename

    Signed-off-by: [email protected] <[email protected]>

commit 9c4159c
Author: [email protected] <[email protected]>
Date:   Thu Apr 10 21:41:20 2025 +0000

    updated

    Signed-off-by: [email protected] <[email protected]>

commit 54e1491
Author: [email protected] <[email protected]>
Date:   Thu Apr 10 20:31:35 2025 +0000

    updated

    Signed-off-by: [email protected] <[email protected]>

commit 8e1eadc
Author: [email protected] <[email protected]>
Date:   Thu Apr 10 20:26:37 2025 +0000

    updated

    Signed-off-by: [email protected] <[email protected]>

commit 05349a5
Author: [email protected] <[email protected]>
Date:   Wed Apr 9 22:10:50 2025 +0000

    updated

    Signed-off-by: [email protected] <[email protected]>

commit 7f57f3c
Author: [email protected] <[email protected]>
Date:   Wed Apr 9 17:13:31 2025 +0000

    update lifecycle

    Signed-off-by: [email protected] <[email protected]>

commit 7c31e29
Author: [email protected] <[email protected]>
Date:   Wed Apr 9 17:03:55 2025 +0000

    nits

    Signed-off-by: [email protected] <[email protected]>

commit 74af233
Author: [email protected] <[email protected]>
Date:   Wed Apr 9 16:44:01 2025 +0000

    done with nits

    Signed-off-by: [email protected] <[email protected]>

commit e64f745
Author: [email protected] <[email protected]>
Date:   Wed Apr 9 16:28:51 2025 +0000

    updated

    Signed-off-by: [email protected] <[email protected]>

commit 40e5d81
Author: [email protected] <[email protected]>
Date:   Wed Apr 9 16:25:04 2025 +0000

    refactor

    Signed-off-by: [email protected] <[email protected]>

commit 25c9592
Author: [email protected] <[email protected]>
Date:   Wed Apr 9 16:20:41 2025 +0000

    updated

    Signed-off-by: [email protected] <[email protected]>

commit fc58dd5
Author: [email protected] <[email protected]>
Date:   Wed Apr 9 16:13:39 2025 +0000

    updated

    Signed-off-by: [email protected] <[email protected]>

commit 20decdf
Author: [email protected] <[email protected]>
Date:   Wed Apr 9 16:06:15 2025 +0000

    updated

    Signed-off-by: [email protected] <[email protected]>

commit 5145566
Author: [email protected] <[email protected]>
Date:   Wed Apr 9 15:52:03 2025 +0000

    updated

    Signed-off-by: [email protected] <[email protected]>

commit 62e1421
Author: [email protected] <[email protected]>
Date:   Wed Apr 9 15:47:40 2025 +0000

    updated

    Signed-off-by: [email protected] <[email protected]>

commit 689379e
Author: [email protected] <[email protected]>
Date:   Wed Apr 9 15:39:40 2025 +0000

    updaed

    Signed-off-by: [email protected] <[email protected]>

commit b1310fd
Author: [email protected] <[email protected]>
Date:   Wed Apr 9 15:36:37 2025 +0000

    updated

    Signed-off-by: [email protected] <[email protected]>

commit 7b64acb
Author: [email protected] <[email protected]>
Date:   Wed Apr 9 15:32:47 2025 +0000

    clean up code

    Signed-off-by: [email protected] <[email protected]>

commit 7766ca5
Author: [email protected] <[email protected]>
Date:   Wed Apr 9 15:31:33 2025 +0000

    updated

    Signed-off-by: [email protected] <[email protected]>

commit b0629bd
Author: [email protected] <[email protected]>
Date:   Wed Apr 9 15:27:58 2025 +0000

    updated

    Signed-off-by: [email protected] <[email protected]>

commit eca7a49
Author: [email protected] <[email protected]>
Date:   Wed Apr 9 15:25:24 2025 +0000

    cleaning

    Signed-off-by: [email protected] <[email protected]>

commit 1881aa5
Author: [email protected] <[email protected]>
Date:   Wed Apr 9 15:24:55 2025 +0000

    updated

    Signed-off-by: [email protected] <[email protected]>

commit 7833645
Author: [email protected] <[email protected]>
Date:   Wed Apr 9 15:11:18 2025 +0000

    updared

    Signed-off-by: [email protected] <[email protected]>

commit e72e5e4
Author: [email protected] <[email protected]>
Date:   Wed Apr 9 15:08:34 2025 +0000

    updated

    Signed-off-by: [email protected] <[email protected]>

commit 48c2eb2
Author: [email protected] <[email protected]>
Date:   Wed Apr 9 15:07:37 2025 +0000

    updated

    Signed-off-by: [email protected] <[email protected]>

commit de1e487
Author: [email protected] <[email protected]>
Date:   Wed Apr 9 15:01:14 2025 +0000

    fix nit

    Signed-off-by: [email protected] <[email protected]>

commit 0163070
Merge: e2ecc14 8b3f606
Author: Robert Shaw <[email protected]>
Date:   Wed Apr 9 10:39:46 2025 -0400

    Merge pull request #4 from robertgshaw2-redhat/rob-changes

    Rob changes

commit 8b3f606
Author: [email protected] <[email protected]>
Date:   Wed Apr 9 14:29:26 2025 +0000

    updated

    Signed-off-by: [email protected] <[email protected]>

commit 90e8c53
Author: [email protected] <[email protected]>
Date:   Wed Apr 9 14:29:17 2025 +0000

    updated

    Signed-off-by: [email protected] <[email protected]>

commit da019df
Author: [email protected] <[email protected]>
Date:   Wed Apr 9 14:23:47 2025 +0000

    updated

    Signed-off-by: [email protected] <[email protected]>

commit 4ebcc3e
Author: [email protected] <[email protected]>
Date:   Wed Apr 9 13:44:41 2025 +0000

    updated

    Signed-off-by: [email protected] <[email protected]>

commit 00df670
Author: [email protected] <[email protected]>
Date:   Wed Apr 9 13:20:14 2025 +0000

    updated

    Signed-off-by: [email protected] <[email protected]>

commit a73721a
Author: [email protected] <[email protected]>
Date:   Wed Apr 9 13:19:17 2025 +0000

    updated

    Signed-off-by: [email protected] <[email protected]>

commit 31d807e
Author: [email protected] <[email protected]>
Date:   Tue Apr 8 20:58:28 2025 +0000

    stash

    Signed-off-by: [email protected] <[email protected]>

commit 5accb53
Author: [email protected] <[email protected]>
Date:   Tue Apr 8 16:00:29 2025 +0000

    stash

    Signed-off-by: [email protected] <[email protected]>

Signed-off-by: ApostaC <[email protected]>
tlrmchlsmth referenced this pull request in tlrmchlsmth/vllm Apr 15, 2025
commit 3a24897
Author: ApostaC <[email protected]>
Date:   Thu Apr 10 18:31:47 2025 -0700

    [Fix] memory leak problem by proper clean up

    Signed-off-by: ApostaC <[email protected]>

commit 406d6bf
Author: Rémi Delacourt <[email protected]>
Date:   Fri Apr 11 00:47:40 2025 +0200

    Add MLA support for v1 disagg connector (#6)

    Signed-off-by: remi <[email protected]>

commit 1d8415d
Author: [email protected] <[email protected]>
Date:   Thu Apr 10 21:59:54 2025 +0000

    rename

    Signed-off-by: [email protected] <[email protected]>

commit 9c4159c
Author: [email protected] <[email protected]>
Date:   Thu Apr 10 21:41:20 2025 +0000

    updated

    Signed-off-by: [email protected] <[email protected]>

commit 54e1491
Author: [email protected] <[email protected]>
Date:   Thu Apr 10 20:31:35 2025 +0000

    updated

    Signed-off-by: [email protected] <[email protected]>

commit 8e1eadc
Author: [email protected] <[email protected]>
Date:   Thu Apr 10 20:26:37 2025 +0000

    updated

    Signed-off-by: [email protected] <[email protected]>

commit 05349a5
Author: [email protected] <[email protected]>
Date:   Wed Apr 9 22:10:50 2025 +0000

    updated

    Signed-off-by: [email protected] <[email protected]>

commit 7f57f3c
Author: [email protected] <[email protected]>
Date:   Wed Apr 9 17:13:31 2025 +0000

    update lifecycle

    Signed-off-by: [email protected] <[email protected]>

commit 7c31e29
Author: [email protected] <[email protected]>
Date:   Wed Apr 9 17:03:55 2025 +0000

    nits

    Signed-off-by: [email protected] <[email protected]>

commit 74af233
Author: [email protected] <[email protected]>
Date:   Wed Apr 9 16:44:01 2025 +0000

    done with nits

    Signed-off-by: [email protected] <[email protected]>

commit e64f745
Author: [email protected] <[email protected]>
Date:   Wed Apr 9 16:28:51 2025 +0000

    updated

    Signed-off-by: [email protected] <[email protected]>

commit 40e5d81
Author: [email protected] <[email protected]>
Date:   Wed Apr 9 16:25:04 2025 +0000

    refactor

    Signed-off-by: [email protected] <[email protected]>

commit 25c9592
Author: [email protected] <[email protected]>
Date:   Wed Apr 9 16:20:41 2025 +0000

    updated

    Signed-off-by: [email protected] <[email protected]>

commit fc58dd5
Author: [email protected] <[email protected]>
Date:   Wed Apr 9 16:13:39 2025 +0000

    updated

    Signed-off-by: [email protected] <[email protected]>

commit 20decdf
Author: [email protected] <[email protected]>
Date:   Wed Apr 9 16:06:15 2025 +0000

    updated

    Signed-off-by: [email protected] <[email protected]>

commit 5145566
Author: [email protected] <[email protected]>
Date:   Wed Apr 9 15:52:03 2025 +0000

    updated

    Signed-off-by: [email protected] <[email protected]>

commit 62e1421
Author: [email protected] <[email protected]>
Date:   Wed Apr 9 15:47:40 2025 +0000

    updated

    Signed-off-by: [email protected] <[email protected]>

commit 689379e
Author: [email protected] <[email protected]>
Date:   Wed Apr 9 15:39:40 2025 +0000

    updaed

    Signed-off-by: [email protected] <[email protected]>

commit b1310fd
Author: [email protected] <[email protected]>
Date:   Wed Apr 9 15:36:37 2025 +0000

    updated

    Signed-off-by: [email protected] <[email protected]>

commit 7b64acb
Author: [email protected] <[email protected]>
Date:   Wed Apr 9 15:32:47 2025 +0000

    clean up code

    Signed-off-by: [email protected] <[email protected]>

commit 7766ca5
Author: [email protected] <[email protected]>
Date:   Wed Apr 9 15:31:33 2025 +0000

    updated

    Signed-off-by: [email protected] <[email protected]>

commit b0629bd
Author: [email protected] <[email protected]>
Date:   Wed Apr 9 15:27:58 2025 +0000

    updated

    Signed-off-by: [email protected] <[email protected]>

commit eca7a49
Author: [email protected] <[email protected]>
Date:   Wed Apr 9 15:25:24 2025 +0000

    cleaning

    Signed-off-by: [email protected] <[email protected]>

commit 1881aa5
Author: [email protected] <[email protected]>
Date:   Wed Apr 9 15:24:55 2025 +0000

    updated

    Signed-off-by: [email protected] <[email protected]>

commit 7833645
Author: [email protected] <[email protected]>
Date:   Wed Apr 9 15:11:18 2025 +0000

    updared

    Signed-off-by: [email protected] <[email protected]>

commit e72e5e4
Author: [email protected] <[email protected]>
Date:   Wed Apr 9 15:08:34 2025 +0000

    updated

    Signed-off-by: [email protected] <[email protected]>

commit 48c2eb2
Author: [email protected] <[email protected]>
Date:   Wed Apr 9 15:07:37 2025 +0000

    updated

    Signed-off-by: [email protected] <[email protected]>

commit de1e487
Author: [email protected] <[email protected]>
Date:   Wed Apr 9 15:01:14 2025 +0000

    fix nit

    Signed-off-by: [email protected] <[email protected]>

commit 0163070
Merge: e2ecc14 8b3f606
Author: Robert Shaw <[email protected]>
Date:   Wed Apr 9 10:39:46 2025 -0400

    Merge pull request #4 from robertgshaw2-redhat/rob-changes

    Rob changes

commit 8b3f606
Author: [email protected] <[email protected]>
Date:   Wed Apr 9 14:29:26 2025 +0000

    updated

    Signed-off-by: [email protected] <[email protected]>

commit 90e8c53
Author: [email protected] <[email protected]>
Date:   Wed Apr 9 14:29:17 2025 +0000

    updated

    Signed-off-by: [email protected] <[email protected]>

commit da019df
Author: [email protected] <[email protected]>
Date:   Wed Apr 9 14:23:47 2025 +0000

    updated

    Signed-off-by: [email protected] <[email protected]>

commit 4ebcc3e
Author: [email protected] <[email protected]>
Date:   Wed Apr 9 13:44:41 2025 +0000

    updated

    Signed-off-by: [email protected] <[email protected]>

commit 00df670
Author: [email protected] <[email protected]>
Date:   Wed Apr 9 13:20:14 2025 +0000

    updated

    Signed-off-by: [email protected] <[email protected]>

commit a73721a
Author: [email protected] <[email protected]>
Date:   Wed Apr 9 13:19:17 2025 +0000

    updated

    Signed-off-by: [email protected] <[email protected]>

commit 31d807e
Author: [email protected] <[email protected]>
Date:   Tue Apr 8 20:58:28 2025 +0000

    stash

    Signed-off-by: [email protected] <[email protected]>

commit 5accb53
Author: [email protected] <[email protected]>
Date:   Tue Apr 8 16:00:29 2025 +0000

    stash

    Signed-off-by: [email protected] <[email protected]>

Signed-off-by: ApostaC <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant