Views
No views yet
| Setting | Value |
|---|---|
| Instance type | inf2.xlarge / inf2.8xlarge (2 NeuronCores) |
| Tensor parallel | 2 |
| Batch size | 1 |
| Max sequence length | 4096 |
| Data type | BF16 |
| ISA Kernels | All OFF |
| Buckets (context) | 512, 1024, 4096 |
| Buckets (token gen) | 512, 1024, 4096 |
| Vision buckets | 512, 1024, 4096 |
| SDK | Neuron SDK 2.28 (DLAMI 20260227) |
| NxD Inference | 0.8.x |
| vLLM | 0.13.x |
/opt/aws_neuronx_venv_pytorch_inference_vllm_0_13/1# Activate environment
2source /opt/aws_neuronx_venv_pytorch_inference_vllm_0_13/bin/activate
3pip install huggingface_hub
4
5# Download original model weights (required for weight loading)
6python -c "
7from huggingface_hub import snapshot_download
8snapshot_download(repo_id='Qwen/Qwen3-VL-4B-Instruct', local_dir='Qwen3-VL-4B-Instruct')
9"
10
11# Download pre-compiled artifacts
12python -c "
13from huggingface_hub import snapshot_download
14snapshot_download(repo_id='jburtoft/Qwen3-VL-4B-Instruct-neuron-inf2-tp2', local_dir='neuron-artifacts')
15"
16
17# Set environment
18export NEURON_COMPILED_ARTIFACTS=$PWD/neuron-artifacts/bs1_tp2
19export VLLM_NEURON_FRAMEWORK=neuronx-distributed-inference1import os
2os.environ["NEURON_COMPILED_ARTIFACTS"] = "neuron-artifacts/bs1_tp2"
3os.environ["VLLM_NEURON_FRAMEWORK"] = "neuronx-distributed-inference"
4
5from vllm import LLM, SamplingParams
6
7llm = LLM(
8 model="Qwen3-VL-4B-Instruct",
9 trust_remote_code=True,
10 dtype="bfloat16",
11 tensor_parallel_size=2,
12 max_num_seqs=1,
13 max_model_len=4096,
14 swap_space=0,
15 additional_config=dict(override_neuron_config=dict(
16 text_neuron_config={
17 "batch_size": 1, "ctx_batch_size": 1, "tkg_batch_size": 1,
18 "seq_len": 4096, "max_context_length": 4096,
19 "torch_dtype": "bfloat16", "tp_degree": 2, "world_size": 2,
20 "enable_bucketing": True,
21 "context_encoding_buckets": [512, 1024, 4096],
22 "token_generation_buckets": [512, 1024, 4096],
23 "fused_qkv": True,
24 "qkv_kernel_enabled": False, "mlp_kernel_enabled": False,
25 "attn_kernel_enabled": False,
26 "logical_neuron_cores": 1, "cc_pipeline_tiling_factor": 1,
27 "rpl_reduce_dtype": "bfloat16", "attention_dtype": "bfloat16",
28 "cast_type": "as-declared",
29 },
30 vision_neuron_config={
31 "batch_size": 1, "seq_len": 4096, "max_context_length": 4096,
32 "enable_bucketing": True, "buckets": [512, 1024, 4096],
33 "world_size": 2, "tp_degree": 2,
34 "torch_dtype": "bfloat16", "rpl_reduce_dtype": "bfloat16",
35 "cast_type": "as-declared",
36 "logical_neuron_cores": 1, "cc_pipeline_tiling_factor": 1,
37 "fused_qkv": True,
38 "attn_kernel_enabled": False, "mlp_kernel_enabled": False,
39 },
40 )),
41 limit_mm_per_prompt={"image": 1},
42 enable_prefix_caching=False,
43 enable_chunked_prefill=False,
44)
45
46# Run inference
47sampling = SamplingParams(top_k=1, max_tokens=256, temperature=0.0)
48outputs = llm.generate([{"prompt": "Hello, what can you do?"}], sampling)
49print(outputs[0].outputs[0].text)Qwen/Qwen3-VL-4B-Instruct model weights on disk.tie_word_embeddings fix: The original model has tie_word_embeddings=true.
You must either add lm_head.weight to the safetensors file or apply the
monkey-patch (see the benchmark script for details).swap_space=0 to avoid
vLLM allocating swap memory. Pre-sharded checkpoints (if included) help reduce
peak memory during weight loading.