vllm: [Bug]: Llama3.2 tool calling OpenAI API not working

Your current environment

The output of `python collect_env.py`
Collecting environment information...                                                                                                                                                                                                                                                           
WARNING 11-04 11:59:16 cuda.py:81] Detected different devices in the system:                                                                                                                                                                                                                    
WARNING 11-04 11:59:16 cuda.py:81] NVIDIA A100 80GB PCIe                                                                                                                                                                                                                                        
WARNING 11-04 11:59:16 cuda.py:81] NVIDIA GeForce RTX 4090                                                                                                                                                                                                                                      
WARNING 11-04 11:59:16 cuda.py:81] NVIDIA GeForce RTX 4090                                                                                                                                                                                                                                      
WARNING 11-04 11:59:16 cuda.py:81] NVIDIA GeForce RTX 4090                                                                                                                                                                                                                                      
WARNING 11-04 11:59:16 cuda.py:81] Please make sure to set `CUDA_DEVICE_ORDER=PCI_BUS_ID` to avoid unexpected behavior.                                                                                                                                                                         
PyTorch version: 2.5.0+cu124                                                                                                                                                                                                                                                                    
Is debug build: False                                                                                                                                                                                                                                                                           
CUDA used to build PyTorch: 12.4                                                                                                                                                                                                                                                                
ROCM used to build PyTorch: N/A                                                                                                                                                                                                                                                                 
                                                                                                                                                                                                                                                                                                
OS: Ubuntu 22.04.4 LTS (x86_64)                                                                                                                                                                                                                                                                 
GCC version: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0                                                                                                                                                                                                                                              
Clang version: Could not collect                                                                                                                                                                                                                                                                
CMake version: version 3.30.0                                                                                                                                                                                                                                                                   
Libc version: glibc-2.35                                                                                                                                                                                                                                                                        
                                                                                                                                                                                                                                                                                                
Python version: 3.10.13 (main, Sep 11 2023, 13:44:35) [GCC 11.2.0] (64-bit runtime)                                                                                                                                                                                                             
Python platform: Linux-5.15.0-122-generic-x86_64-with-glibc2.35                                                                                                                                                                                                                                 
Is CUDA available: True                                                                                                                                                                                                                                                                         
CUDA runtime version: Could not collect                                                                                                                                                                                                                                                         
CUDA_MODULE_LOADING set to: LAZY                                                                                                                                                                                                                                                                
GPU models and configuration:                                                                                                                                                                                                                                                                   
GPU 0: NVIDIA A100 80GB PCIe                                                                                                                                                                                                                                                                    
GPU 1: NVIDIA GeForce RTX 4090                                                                                                                                                                                                                                                                  
GPU 2: NVIDIA GeForce RTX 4090                                                                                                                                                                                                                                                                  
GPU 3: NVIDIA GeForce RTX 4090                                                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                                                                                
Nvidia driver version: 535.183.01                                                                                                                                                                                                                                                               
cuDNN version: Could not collect                                                                                                                                                                                                                                                                
HIP runtime version: N/A                                                                                                                                                                                                                                                                        
MIOpen runtime version: N/A                                                                                                                                                                                                                                                                     
Is XNNPACK available: True                                                                                                                                                                                                                                                                      
                                                                                                                                                                                                                                                                                                
CPU:                                                                                                                                                                                                                                                                                            
Architecture:                         x86_64                                                                                                                                                                                                                                                    
CPU op-mode(s):                       32-bit, 64-bit                                                                                                                                                                                                                                            
Address sizes:                        46 bits physical, 48 bits virtual                                                                                                                                                                                                                         
Byte Order:                           Little Endian                                                                                                                                                                                                                                             
CPU(s):                               32                                                                                                                                                                                                                                                        
On-line CPU(s) list:                  0-31                                                                                                                                                                                                                                                      
Vendor ID:                            GenuineIntel                                                                                                                                                                                                                                              
Model name:                           13th Gen Intel(R) Core(TM) i9-13900KS                                                                                                                                                                                                                     
CPU family:                           6                                                                                                                                                                                                                                                         
Model:                                183                                                                                                                                                                                                                                                       
Thread(s) per core:                   2                                                                                                                                                                                                                                                         
Core(s) per socket:                   24                                                                                                                                                                                                                                                        
Socket(s):                            1                                                                                                                                                                                                                                                         
Stepping:                             1                                                                                                                                                                                                                                                         
CPU max MHz:                          6000.0000                                                                                                                                                                                                                                                 
CPU min MHz:                          800.0000                                                                                                                                                                                                                                                  
BogoMIPS:                             6374.40                                                                                                                                                                                                                                                   
Flags:                                fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf tsc_known
_freq pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault invpcid_single ssbd ibrs ibpb stibp ibrs_enhanced tpr_shadow vnmi flexpriority
 ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid rdseed adx smap clflushopt clwb intel_pt sha_ni xsaveopt xsavec xgetbv1 xsaves split_lock_detect avx_vnni dtherm ida arat pln pts hwp hwp_notify hwp_act_window hwp_epp hwp_pkg_req umip pku ospke waitpkg gfni vaes vpclm
ulqdq tme rdpid movdiri movdir64b fsrm md_clear serialize pconfig arch_lbr flush_l1d arch_capabilities                                                                                                                                                                                          
Virtualization:                       VT-x
L1d cache:                            896 KiB (24 instances)
L1i cache:                            1.3 MiB (24 instances)
L2 cache:                             32 MiB (12 instances)
L3 cache:                             36 MiB (1 instance)
NUMA node(s):                         1
NUMA node0 CPU(s):                    0-31
Vulnerability Gather data sampling:   Not affected
Vulnerability Itlb multihit:          Not affected
Vulnerability Mds:                    Not affected
Vulnerability Meltdown:               Not affected
Vulnerability Mmio stale data:        Not affected
Vulnerability Reg file data sampling: Mitigation; Clear Register File
Vulnerability Retbleed:               Not affected
Vulnerability Spec rstack overflow:   Not affected
Vulnerability Spec store bypass:      Mitigation; Speculative Store Bypass disabled via prctl and seccomp
Vulnerability Spectre v1:             Mitigation; usercopy/swapgs barriers and __user pointer sanitization
Vulnerability Spectre v2:             Mitigation; Enhanced / Automatic IBRS; IBPB conditional; RSB filling; PBRSB-eIBRS SW sequence; BHI BHI_DIS_S
Vulnerability Srbds:                  Not affected
Vulnerability Tsx async abort:        Not affected

Versions of relevant libraries:
[pip3] numpy==1.26.2
[pip3] nvidia-cublas-cu12==12.4.5.8
[pip3] nvidia-cuda-cupti-cu12==12.4.127
[pip3] nvidia-cuda-nvrtc-cu12==12.4.127
[pip3] nvidia-cuda-runtime-cu12==12.4.127
[pip3] nvidia-cudnn-cu12==9.1.0.70
[pip3] nvidia-cufft-cu12==11.2.1.3
[pip3] nvidia-curand-cu12==10.3.5.147
[pip3] nvidia-cusolver-cu12==11.6.1.9
[pip3] nvidia-cusparse-cu12==12.3.1.170
[pip3] nvidia-ml-py==12.560.30
[pip3] nvidia-nccl-cu12==2.21.5
[pip3] nvidia-nvjitlink-cu12==12.4.127
[pip3] nvidia-nvtx-cu12==12.4.127
[pip3] pyzmq==26.0.3
[pip3] torch==2.5.0
[pip3] torchvision==0.20.0
[pip3] transformers==4.46.0
[pip3] triton==3.1.0
[conda] numpy                     1.26.4                   pypi_0    pypi
[conda] nvidia-cublas-cu12        12.4.5.8                 pypi_0    pypi
[conda] nvidia-cuda-cupti-cu12    12.4.127                 pypi_0    pypi
[conda] nvidia-cuda-nvrtc-cu12    12.4.127                 pypi_0    pypi
[conda] nvidia-cuda-runtime-cu12  12.4.127                 pypi_0    pypi
[conda] nvidia-cudnn-cu12         9.1.0.70                 pypi_0    pypi
[conda] nvidia-cufft-cu12         11.2.1.3                 pypi_0    pypi
[conda] nvidia-curand-cu12        10.3.5.147               pypi_0    pypi
[conda] nvidia-cusolver-cu12      11.6.1.9                 pypi_0    pypi
[conda] nvidia-cusparse-cu12      12.3.1.170               pypi_0    pypi
[conda] nvidia-ml-py              12.560.30                pypi_0    pypi
[conda] nvidia-nccl-cu12          2.21.5                   pypi_0    pypi
[conda] nvidia-nvjitlink-cu12     12.4.127                 pypi_0    pypi
[conda] nvidia-nvtx-cu12          12.4.127                 pypi_0    pypi
[conda] pyzmq                     26.0.3                   pypi_0    pypi
[conda] torch                     2.5.0                    pypi_0    pypi
[conda] torchvision               0.20.0                   pypi_0    pypi
[conda] transformers              4.46.0                   pypi_0    pypi
[conda] triton                    3.1.0                    pypi_0    pypi
ROCM Version: Could not collect
Neuron SDK Version: N/A
vLLM Version: 0.6.3.post2.dev139+g622b7ab9
vLLM Build Flags:
CUDA Archs: Not Set; ROCm: Disabled; Neuron: Disabled
GPU Topology:
GPU0    GPU1    GPU2    GPU3    CPU Affinity    NUMA Affinity   GPU NUMA ID
GPU0     X      PHB     PHB     PHB     0-31    0               N/A
GPU1    PHB      X      PHB     PHB     0-31    0               N/A
GPU2    PHB     PHB      X      PHB     0-31    0               N/A
GPU3    PHB     PHB     PHB      X      0-31    0               N/A

Legend:

  X    = Self
  SYS  = Connection traversing PCIe as well as the SMP interconnect between NUMA nodes (e.g., QPI/UPI)
  NODE = Connection traversing PCIe as well as the interconnect between PCIe Host Bridges within a NUMA node
  PHB  = Connection traversing PCIe as well as a PCIe Host Bridge (typically the CPU)
  PXB  = Connection traversing multiple PCIe bridges (without traversing the PCIe Host Bridge)
  PIX  = Connection traversing at most a single PCIe bridge
  NV#  = Connection traversing a bonded set of # NVLinks

Model Input Dumps

No response

🐛 Describe the bug

When trying to run Llama3.2 tool calling via python -m vllm.entrypoints.openai.api_server --model meta-llama/Llama-3.2-1B-Instruct --enable-auto-tool-choice --tool-call-parser llama3_json I do not get the OpenAI API function calling functionality but rather just get the tool call string:

❯ current time?
<|python_tag|>{"type": "function", "function": "get_time", "parameters": {"timezone":
"America/New_York"}}

Using the official OpenAI API with 4o and Ollama works with my code

Before submitting a new issue…

  • Make sure you already searched for relevant issues, and asked the chatbot living at the bottom right corner of the documentation page, which can answer lots of frequently asked questions.

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 1
  • Comments: 21 (11 by maintainers)

Most upvoted comments

@K-Mistele Thank you so much for all the info and advice!! I will test out everything you provided.

Could you please tell me the best working small tool calling models?