Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 47 additions & 7 deletions examples/puzzletron/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -270,19 +270,59 @@ For a quick smoke test, add `--limit 10`.
> **Alternative:** For server-based evaluation via an OpenAI-compatible endpoint,
> see [evaluation/nemo_evaluator_instructions.md](./evaluation/nemo_evaluator_instructions.md).

## Inference Performance Benchmarking
## Deploy compressed model in vLLM

Now let's evaluate how much speedup we get with the compressed model in terms of throughput and latency.
To deploy a compressed model in vLLM, install vLLM fork with AnyModel enabled:

```bash
git clone https://github.com/askliar/vllm.git
cd vllm
git checkout feature/add_anymodel_to_vllm
VLLM_USE_PRECOMPILED=1 uv pip install --editable . --torch-backend=auto
```

See [vLLM documentation](https://docs.vllm.ai/en/latest/getting_started/installation/gpu/index.html#build-wheel-from-source) for more details on installation.

**NOTE:** This is a temporary workaround pending official vLLM integration. You can track merge status [here](https://github.com/vllm-project/vllm/pull/36512).

Then, add the following to the model's `config.json` file (here we use Llama as an example):

- Install [vLLM from source](https://docs.vllm.ai/en/latest/getting_started/installation/gpu/index.html#build-wheel-from-source).
- Rearrange the model safetensors to be used for vLLM.
```json
{
...
"architectures": ["AnyModel"],
"base_architecture": "LlamaForCausalLM",
...
}
```

For new architectures that are not supported by vLLM, you additionally need to add the following to the `config.json` file (using Llama3 as an example):

```json
{
...
"anymodel_arch_info": {
"decoder_layer_module": ".<module_name>",
"decoder_layer_class": "<decoder_layer_class_name>",
"base_model_module": ".<base_model_module_name>",
"layers_path": "<layers_path>",
"init_prefix": "model",
"Layer_hf_config": "<Layer_hf_config>"
}
...
}
```
Comment on lines +299 to +314

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.

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Description: Check if AnyModel Guide contains anymodel_arch_info field documentation

rg -i "anymodel_arch_info|decoder_layer_module|decoder_layer_class" modelopt/torch/puzzletron/anymodel/README.md -C 5

Repository: NVIDIA/Model-Optimizer

Length of output: 48


Provide concrete Llama3 example values for the anymodel_arch_info configuration.

The JSON snippet uses placeholders like <module_name> and <decoder_layer_class_name>, and while line 299 mentions "using Llama3 as an example," no actual values are shown. The AnyModel Guide does not document these fields either. Include a complete example with real Llama3 configuration values so users can understand what to substitute when configuring unsupported architectures.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@examples/puzzletron/README.md` around lines 299 - 314, Replace the
placeholder fields in the anymodel_arch_info example with real Llama3 values:
set "decoder_layer_module" to the module path that contains the transformer
decoder layer class (e.g., the submodule in the Llama3 model package), set
"decoder_layer_class" to the actual class name used for each decoder layer, set
"base_model_module" to the top-level module where the model's components live,
set "layers_path" to the attribute path from the model root to the list/sequence
of layer modules, keep "init_prefix" as the model root attribute prefix
(commonly "model" or "base_model"), and set "Layer_hf_config" to the HF config
key name used by Llama3 for per-layer config; update the README snippet for
anymodel_arch_info to show these concrete Llama3 values so users can directly
copy and adjust them for their Llama3-based model.


With these changes it is now possible to load the compressed model in vLLM for inference:

```bash
cd path/to/model
mv subblocks_safetensors/* .
sed -i 's+subblocks_safetensors/++g' model.safetensors.index.json
vllm serve <model_name_or_path>
```

### Inference Performance Benchmarking

Now let's evaluate how much speedup we get with the compressed model in terms of throughput and latency.

- Benchmark latency

```bash
Expand Down
Loading