-
Notifications
You must be signed in to change notification settings - Fork 689
docs: TRTLLM Example of Llama4+Eagle3 (Speculative Decoding) #1828
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
9caa48a
basic readme.md
KrishnanPrash bf4c6bb
Copied over previous tutorial
KrishnanPrash bc39d0e
llama4+eagle3 configuration
KrishnanPrash 4a0b8c6
Test
KrishnanPrash e889649
Modified Workflow
KrishnanPrash 7b4c32a
Streamlined Example
KrishnanPrash 07a822c
Standardizing names, Fixing File paths
KrishnanPrash 070962d
Correcting Model Name and Decoding Type
KrishnanPrash d02beeb
Adding Speculative Decoding/KV Config Fields
KrishnanPrash f0a5707
Adding eagle3_one_model key-value
KrishnanPrash 48b7786
Adding eagle3_one_model key-value
KrishnanPrash 142e0ea
Adding eagle3_one_model key-value
KrishnanPrash 0985d10
Update Config
KrishnanPrash 8bd09ad
Update GPU/TP Count
KrishnanPrash a4ed3f7
Adding back disable_overlap_scheduler key-value
KrishnanPrash d054d53
Updating max_seq_len
KrishnanPrash c5fc5c8
Updating README.md
KrishnanPrash 25ba4f1
Fix wording
KrishnanPrash 1de9595
Adding to README.md
KrishnanPrash fabab46
Updates to disaggregate workflow
KrishnanPrash c27bf87
Merge branch 'main' into kprashanth/trtllm-example
KrishnanPrash File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| # SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
|
|
||
| Frontend: | ||
| # This is the client-facing model name, you can set this to anything you'd like. | ||
| served_model_name: "nvidia/Llama-4-Maverick-17B-128E-Instruct-FP8" | ||
| endpoint: dynamo.TensorRTLLMWorker.generate | ||
| port: 8000 | ||
| router: round-robin | ||
|
|
||
| TensorRTLLMWorker: | ||
| served_model_name: "nvidia/Llama-4-Maverick-17B-128E-Instruct-FP8" | ||
| model-path: "nvidia/Llama-4-Maverick-17B-128E-Instruct-FP8" | ||
| extra-engine-args: "configs/llama4/eagle/engine_configs/agg_config.yaml" | ||
| router: round-robin | ||
| ServiceArgs: | ||
| workers: 1 | ||
| resources: | ||
| gpu: 4 |
44 changes: 44 additions & 0 deletions
44
examples/tensorrt_llm/configs/llama4/eagle/eagle_disagg.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| # SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
|
|
||
| Frontend: | ||
| served_model_name: "nvidia/Llama-4-Maverick-17B-128E-Instruct-FP8" | ||
| endpoint: dynamo.TensorRTLLMWorker.generate | ||
| port: 8000 | ||
| router: round-robin | ||
|
|
||
| TensorRTLLMWorker: | ||
| served_model_name: "nvidia/Llama-4-Maverick-17B-128E-Instruct-FP8" | ||
| model-path: "nvidia/Llama-4-Maverick-17B-128E-Instruct-FP8" | ||
| # Path to a YAML file containing additional keyword arguments to pass to the TRTLLM engine. | ||
| # The fields in `extra-engine-args` holds higher priority than the above TRTLLM engine fields. | ||
| extra-engine-args: "configs/llama4/eagle/engine_configs/decode_config.yaml" | ||
| router: round-robin | ||
| enable-disagg: true | ||
| ServiceArgs: | ||
| workers: 1 | ||
| resources: | ||
| gpu: 4 | ||
|
|
||
| TensorRTLLMPrefillWorker: | ||
| model-path: "nvidia/Llama-4-Maverick-17B-128E-Instruct-FP8" | ||
| # Path to a YAML file containing additional keyword arguments to pass to the TRTLLM engine. | ||
| # The fields in `extra-engine-args` holds higher priority than the above TRTLLM engine fields. | ||
| extra-engine-args: "configs/llama4/eagle/engine_configs/prefill_config.yaml" | ||
| router: round-robin | ||
| ServiceArgs: | ||
| workers: 1 | ||
| resources: | ||
| gpu: 4 |
51 changes: 51 additions & 0 deletions
51
examples/tensorrt_llm/configs/llama4/eagle/engine_configs/agg_config.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| # SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
|
|
||
| backend: pytorch | ||
| tensor_parallel_size: 4 | ||
| moe_expert_parallel_size: 4 | ||
| max_batch_size: 256 | ||
| # When max_num_tokens set to higher values, can cause OOM issues. | ||
| # Will be investigated in the future with TRTLLM team. | ||
| max_num_tokens: 1024 | ||
| max_seq_len: 8448 | ||
| autotuner_enabled: false | ||
| disable_overlap_scheduler: true | ||
|
|
||
| # Enable Speculative Decoding in the model engine | ||
| speculative_config: | ||
| decoding_type: Eagle | ||
| max_draft_len: 1 | ||
| pytorch_weights_path: nvidia/Llama-4-Maverick-17B-128E-Eagle3 | ||
KrishnanPrash marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| eagle3_one_model: False | ||
|
|
||
| kv_cache_config: | ||
| free_gpu_memory_fraction: 0.5 | ||
| enable_block_reuse: false | ||
|
|
||
| use_cuda_graph: true | ||
| cuda_graph_padding_enabled: true | ||
| cuda_graph_batch_sizes: | ||
| - 1 | ||
| - 2 | ||
| - 4 | ||
| - 8 | ||
| - 16 | ||
| - 32 | ||
| - 64 | ||
| - 128 | ||
| - 256 | ||
| print_iter_log: true | ||
| kv_cache_dtype: fp8 | ||
50 changes: 50 additions & 0 deletions
50
examples/tensorrt_llm/configs/llama4/eagle/engine_configs/decode_config.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| # SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
|
|
||
| backend: pytorch | ||
| tensor_parallel_size: 4 | ||
| moe_expert_parallel_size: 4 | ||
| max_batch_size: 256 | ||
| max_num_tokens: 512 | ||
| # 8704 = 8192 ISL + 512 OSL | ||
| max_seq_len: 8704 | ||
| disable_overlap_scheduler: true | ||
| autotuner_enabled: false | ||
|
|
||
| # Enable Speculative Decoding in the model engine | ||
| speculative_config: | ||
| decoding_type: Eagle | ||
| max_draft_len: 1 | ||
| pytorch_weights_path: nvidia/Llama-4-Maverick-17B-128E-Eagle3 | ||
KrishnanPrash marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| eagle3_one_model: False | ||
|
|
||
| kv_cache_config: | ||
| free_gpu_memory_fraction: 0.5 | ||
| enable_block_reuse: false | ||
|
|
||
| use_cuda_graph: true | ||
| cuda_graph_padding_enabled: true | ||
| cuda_graph_batch_sizes: | ||
| - 1 | ||
| - 2 | ||
| - 4 | ||
| - 8 | ||
| - 16 | ||
| - 32 | ||
| - 64 | ||
| - 128 | ||
| - 256 | ||
| print_iter_log: true | ||
| kv_cache_dtype: fp8 | ||
36 changes: 36 additions & 0 deletions
36
examples/tensorrt_llm/configs/llama4/eagle/engine_configs/prefill_config.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| # SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
|
|
||
| backend: pytorch | ||
| tensor_parallel_size: 4 | ||
| moe_expert_parallel_size: 4 | ||
| max_batch_size: 1 | ||
| max_num_tokens: 8192 | ||
| max_seq_len: 8192 | ||
| print_iter_log: true | ||
| kv_cache_dtype: fp8 | ||
| disable_overlap_scheduler: true | ||
| autotuner_enabled: false | ||
|
|
||
| # Enable Speculative Decoding in the model engine | ||
| speculative_config: | ||
| decoding_type: Eagle | ||
| max_draft_len: 1 | ||
| pytorch_weights_path: nvidia/Llama-4-Maverick-17B-128E-Eagle3 | ||
KrishnanPrash marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| eagle3_one_model: False | ||
|
|
||
| kv_cache_config: | ||
| free_gpu_memory_fraction: 0.5 | ||
| enable_block_reuse: false | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.