Skip to content
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

[Usage]: Is it possible to generate without detokenizing? #3635

Closed
mgerstgrasser opened this issue Mar 26, 2024 · 8 comments · Fixed by #3748 or #3749
Closed

[Usage]: Is it possible to generate without detokenizing? #3635

mgerstgrasser opened this issue Mar 26, 2024 · 8 comments · Fixed by #3748 or #3749
Labels
usage How to use vllm

Comments

@mgerstgrasser
Copy link
Contributor

Your current environment

Collecting environment information...
PyTorch version: 2.1.2+cu121
Is debug build: False
CUDA used to build PyTorch: 12.1
ROCM used to build PyTorch: N/A

OS: Rocky Linux release 8.7 (Green Obsidian) (x86_64)
GCC version: (GCC) 8.5.0 20210514 (Red Hat 8.5.0-16)
Clang version: 14.0.6 (Red Hat 14.0.6-1.module+el8.7.0+1080+d88dc670)
CMake version: version 3.28.4
Libc version: glibc-2.28

Python version: 3.11.6 | packaged by conda-forge | (main, Oct  3 2023, 10:40:35) [GCC 12.3.0] (64-bit runtime)
Python platform: Linux-4.18.0-425.10.1.el8_7.x86_64-x86_64-with-glibc2.28
Is CUDA available: True
CUDA runtime version: 12.2.91
CUDA_MODULE_LOADING set to: LAZY
GPU models and configuration: 
GPU 0: NVIDIA A100-SXM4-80GB
GPU 1: NVIDIA A100-SXM4-80GB
GPU 2: NVIDIA A100-SXM4-80GB
GPU 3: NVIDIA A100-SXM4-80GB

Nvidia driver version: 545.23.08
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
Byte Order:          Little Endian
CPU(s):              64
On-line CPU(s) list: 0-63
Thread(s) per core:  1
Core(s) per socket:  32
Socket(s):           2
NUMA node(s):        2
Vendor ID:           GenuineIntel
CPU family:          6
Model:               106
Model name:          Intel(R) Xeon(R) Platinum 8358 CPU @ 2.60GHz
Stepping:            6
CPU MHz:             3300.000
CPU max MHz:         3400.0000
CPU min MHz:         800.0000
BogoMIPS:            5200.00
Virtualization:      VT-x
L1d cache:           48K
L1i cache:           32K
L2 cache:            1280K
L3 cache:            49152K
NUMA node0 CPU(s):   0-31
NUMA node1 CPU(s):   32-63
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 pni pclmulqdq dtes64 ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb cat_l3 invpcid_single intel_ppin ssbd mba ibrs ibpb stibp ibrs_enhanced tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid cqm rdt_a avx512f avx512dq rdseed adx smap avx512ifma clflushopt clwb intel_pt avx512cd sha_ni avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local split_lock_detect wbnoinvd dtherm ida arat pln pts avx512vbmi umip pku ospke avx512_vbmi2 gfni vaes vpclmulqdq avx512_vnni avx512_bitalg tme avx512_vpopcntdq la57 rdpid fsrm md_clear pconfig flush_l1d arch_capabilities

Versions of relevant libraries:
[pip3] mypy-extensions==1.0.0
[pip3] numpy==1.26.2
[pip3] torch==2.1.2
[pip3] torchaudio==2.2.1
[pip3] torchmetrics==1.3.1
[pip3] torchvision==0.17.1
[pip3] triton==2.1.0
[conda] numpy                     1.26.2                   pypi_0    pypi
[conda] torch                     2.1.2                    pypi_0    pypi
[conda] torchaudio                2.2.1                    pypi_0    pypi
[conda] torchvision               0.17.1                   pypi_0    pypi
[conda] triton                    2.1.0                    pypi_0    pypiROCM Version: Could not collect
Neuron SDK Version: N/A
vLLM Version: 0.3.3
vLLM Build Flags:
CUDA Archs: Not Set; ROCm: Disabled; Neuron: Disabled
GPU Topology:
GPU0    GPU1    GPU2    GPU3    NIC0    NIC1    NIC2    CPU Affinity    NUMA Affinity   GPU NUMA ID
GPU0     X      NV4     NV4     NV4     SYS     SYS     SYS     1-4     0               N/A
GPU1    NV4      X      NV4     NV4     SYS     SYS     SYS     1-4     0               N/A
GPU2    NV4     NV4      X      NV4     SYS     SYS     SYS     34-37   1               N/A
GPU3    NV4     NV4     NV4      X      SYS     SYS     SYS     34-37   1               N/A
NIC0    SYS     SYS     SYS     SYS      X      SYS     SYS
NIC1    SYS     SYS     SYS     SYS     SYS      X      PIX
NIC2    SYS     SYS     SYS     SYS     SYS     PIX      X 

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

NIC Legend:

  NIC0: mlx5_0
  NIC1: mlx5_1
  NIC2: mlx5_2

How would you like to use vllm

We have a use case where we only need the output tokens, but not the detokenized text. This also happens to be using a very small model, and as far as I can tell performance is limited by CPU, not GPU - we see 100% CPU utilisation, but only around 10% GPU utilisation (something similar has been observed even with medium sized models, see #1375 ).

We haven't done detailed profiling, but one obvious optimisation would be to skip detokenisation, i.e. return only the token_ids, but not the output text. Is there a way to do this? I haven't found anything so I assume the answer is "No" out of the box, but we also don't mind making changes to the vllm source for this, if it was just a matter of commenting out a line or two.

Thanks so much!

@mgerstgrasser mgerstgrasser added the usage How to use vllm label Mar 26, 2024
@simon-mo
Copy link
Collaborator

I think this can be a good idea. Are you thinking about offline evaluation using the LLM interface or the server?

Thoughts about this? @Yard1 @zhuohan123

@mgerstgrasser
Copy link
Contributor Author

I think this can be a good idea. Are you thinking about offline evaluation using the LLM interface or the server?

Thoughts about this? @Yard1 @zhuohan123

In the use case we ran into right now we're using the API server (but mostly because we need multiple instances on different GPUs, and we didn't see a way to pin LLM to a specific cuda device). I do have another project where this could be useful where I directly use AsyncLLMEngine.

@njhill
Copy link
Member

njhill commented Mar 26, 2024

I'd also been thinking about this recently. I think it would be nice to have some kind of skip_detokenization or include_text=False option in the sampling params.

@mgerstgrasser
Copy link
Contributor Author

@simon-mo If this is something that would be useful to others, I'd be happy to help work on a PR for this! Would this mainly be a matter of skipping the two calls to self.detokenizer in LLMEngine?

@GeauxEric
Copy link
Contributor

@simon-mo If this is something that would be useful to others, I'd be happy to help work on a PR for this! Would this mainly be a matter of skipping the two calls to self.detokenizer in LLMEngine?

The initialization also needs updating.

I tried to resolve the issue #3647
Found myself patching here and there: GeauxEric@f28b198

It would be nice that someone more familiar with the code base can make this implementation cleaner.

@simon-mo
Copy link
Collaborator

@GeauxEric please feel free to open a PR so it's easier to get feedback.

@blahblahasdf
Copy link
Contributor

Just chiming in this is something I'd be interested in as well.

@mgerstgrasser
Copy link
Contributor Author

I've opened a PR that makes this optional on a per-request basis. Would be happy to get feedback! @simon-mo @njhill

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
usage How to use vllm
Projects
None yet
5 participants