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

[Bug]: Mistral 'SentencePieceTokenizer' object has no attribute 'id_to_byte_piece' #9907

Closed
1 task done
liziniu opened this issue Nov 1, 2024 · 10 comments · Fixed by #10152
Closed
1 task done

[Bug]: Mistral 'SentencePieceTokenizer' object has no attribute 'id_to_byte_piece' #9907

liziniu opened this issue Nov 1, 2024 · 10 comments · Fixed by #10152
Labels
bug Something isn't working

Comments

@liziniu
Copy link

liziniu commented Nov 1, 2024

Your current environment

The output of `python collect_env.py`
Collecting environment information...
Warning: Your installation of OpenCV appears to be broken: module 'cv2.dnn' has no attribute 'DictValue'.Please follow the instructions at https://github.com/opencv/opencv-python/issues/884 to correct your environment. The import of cv2 has been skipped.
/usr/local/lib/python3.10/dist-packages/vllm/connections.py:8: RuntimeWarning: Failed to read commit hash:
No module named 'vllm._version'
  from vllm.version import __version__ as VLLM_VERSION
PyTorch version: 2.4.0+cu121
Is debug build: False
CUDA used to build PyTorch: 12.1
ROCM used to build PyTorch: N/A

OS: Ubuntu 22.04.3 LTS (x86_64)
GCC version: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
Clang version: Could not collect
CMake version: version 3.27.6
Libc version: glibc-2.35

Python version: 3.10.12 (main, Jun 11 2023, 05:26:28) [GCC 11.4.0] (64-bit runtime)
Python platform: Linux-3.10.0-1160.el7.x86_64-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 A800-SXM4-80GB
GPU 1: NVIDIA A800-SXM4-80GB
GPU 2: NVIDIA A800-SXM4-80GB
GPU 3: NVIDIA A800-SXM4-80GB
GPU 4: NVIDIA A800-SXM4-80GB
GPU 5: NVIDIA A800-SXM4-80GB
GPU 6: NVIDIA A800-SXM4-80GB
GPU 7: NVIDIA A800-SXM4-80GB

Nvidia driver version: 535.104.12
cuDNN version: Probably one of the following:
/usr/lib/x86_64-linux-gnu/libcudnn.so.8.9.5
/usr/lib/x86_64-linux-gnu/libcudnn_adv_infer.so.8.9.5
/usr/lib/x86_64-linux-gnu/libcudnn_adv_train.so.8.9.5
/usr/lib/x86_64-linux-gnu/libcudnn_cnn_infer.so.8.9.5
/usr/lib/x86_64-linux-gnu/libcudnn_cnn_train.so.8.9.5
/usr/lib/x86_64-linux-gnu/libcudnn_ops_infer.so.8.9.5
/usr/lib/x86_64-linux-gnu/libcudnn_ops_train.so.8.9.5
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, 57 bits virtual
Byte Order:                      Little Endian
CPU(s):                          128
On-line CPU(s) list:             0-127
Vendor ID:                       GenuineIntel
Model name:                      Intel(R) Xeon(R) Platinum 8358 CPU @ 2.60GHz
CPU family:                      6
Model:                           106
Thread(s) per core:              2
Core(s) per socket:              32
Socket(s):                       2
Stepping:                        6
Frequency boost:                 enabled
CPU max MHz:                     3400.0000
CPU min MHz:                     800.0000
BogoMIPS:                        5200.00
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 aperfmperf eagerfpu 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 epb cat_l3 invpcid_single intel_pt ssbd mba ibrs ibpb stibp ibrs_enhanced tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm cqm rdt_a avx512f avx512dq rdseed adx smap avx512ifma clflushopt clwb avx512cd sha_ni avx512bw avx512vl xsaveopt xsavec xgetbv1 cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local dtherm ida arat pln pts avx512vbmi umip pku ospke avx512_vbmi2 gfni vaes vpclmulqdq avx512_vnni avx512_bitalg avx512_vpopcntdq md_clear pconfig spec_ctrl intel_stibp flush_l1d arch_capabilities
Virtualization:                  VT-x
L1d cache:                       3 MiB (64 instances)
L1i cache:                       2 MiB (64 instances)
L2 cache:                        80 MiB (64 instances)
L3 cache:                        96 MiB (2 instances)
NUMA node(s):                    2
NUMA node0 CPU(s):               0-31,64-95
NUMA node1 CPU(s):               32-63,96-127
Vulnerability Itlb multihit:     Not affected
Vulnerability L1tf:              Not affected
Vulnerability Mds:               Not affected
Vulnerability Meltdown:          Not affected
Vulnerability Spec store bypass: Mitigation; Speculative Store Bypass disabled via prctl and seccomp
Vulnerability Spectre v1:        Mitigation; Load fences, usercopy/swapgs barriers and __user pointer sanitization
Vulnerability Spectre v2:        Mitigation; Enhanced IBRS, IBPB
Vulnerability Srbds:             Not affected
Vulnerability Tsx async abort:   Not affected

Versions of relevant libraries:
[pip3] mypy-extensions==1.0.0
[pip3] numpy==1.26.4
[pip3] nvidia-cublas-cu12==12.1.3.1
[pip3] nvidia-cuda-cupti-cu12==12.1.105
[pip3] nvidia-cuda-nvrtc-cu12==12.1.105
[pip3] nvidia-cuda-runtime-cu12==12.1.105
[pip3] nvidia-cudnn-cu12==9.1.0.70
[pip3] nvidia-cufft-cu12==11.0.2.54
[pip3] nvidia-curand-cu12==10.3.2.106
[pip3] nvidia-cusolver-cu12==11.4.5.107
[pip3] nvidia-cusparse-cu12==12.1.0.106
[pip3] nvidia-dali-cuda120==1.30.0
[pip3] nvidia-ml-py==12.560.30
[pip3] nvidia-nccl-cu12==2.20.5
[pip3] nvidia-nvjitlink-cu12==12.6.68
[pip3] nvidia-nvtx-cu12==12.1.105
[pip3] nvidia-pyindex==1.0.9
[pip3] onnx==1.14.0
[pip3] pytorch-lightning==2.1.1
[pip3] pytorch-quantization==2.1.2
[pip3] pyzmq==25.1.1
[pip3] sentence-transformers==3.0.1
[pip3] torch==2.4.0
[pip3] torch-tensorrt==0.0.0
[pip3] torchdata==0.7.0a0
[pip3] torchmetrics==1.2.0
[pip3] torchtext==0.16.0a0
[pip3] torchvision==0.19.0
[pip3] transformers==4.45.2
[pip3] triton==3.0.0
[conda] Could not collect
ROCM Version: Could not collect
Neuron SDK Version: N/A
vLLM Version: N/A (dev)
vLLM Build Flags:
CUDA Archs: Not Set; ROCm: Disabled; Neuron: Disabled
GPU Topology:
GPU0    GPU1    GPU2    GPU3    GPU4    GPU5    GPU6    GPU7    NIC0    NIC1    NIC2    NIC3    NIC4    NIC5    CPU AffinityNUMA Affinity   GPU NUMA ID
GPU0     X      NV8     NV8     NV8     NV8     NV8     NV8     NV8     PXB     PXB     NODE    SYS     SYS     SYS     0-31,64-95  0               N/A
GPU1    NV8      X      NV8     NV8     NV8     NV8     NV8     NV8     PXB     PXB     NODE    SYS     SYS     SYS     0-31,64-95  0               N/A
GPU2    NV8     NV8      X      NV8     NV8     NV8     NV8     NV8     NODE    NODE    PXB     SYS     SYS     SYS     0-31,64-95  0               N/A
GPU3    NV8     NV8     NV8      X      NV8     NV8     NV8     NV8     NODE    NODE    PXB     SYS     SYS     SYS     0-31,64-95  0               N/A
GPU4    NV8     NV8     NV8     NV8      X      NV8     NV8     NV8     SYS     SYS     SYS     PXB     PXB     NODE    32-63,96-127        1               N/A
GPU5    NV8     NV8     NV8     NV8     NV8      X      NV8     NV8     SYS     SYS     SYS     PXB     PXB     NODE    32-63,96-127        1               N/A
GPU6    NV8     NV8     NV8     NV8     NV8     NV8      X      NV8     SYS     SYS     SYS     NODE    NODE    PXB     32-63,96-127        1               N/A
GPU7    NV8     NV8     NV8     NV8     NV8     NV8     NV8      X      SYS     SYS     SYS     NODE    NODE    PXB     32-63,96-127        1               N/A
NIC0    PXB     PXB     NODE    NODE    SYS     SYS     SYS     SYS      X      PIX     NODE    SYS     SYS     SYS
NIC1    PXB     PXB     NODE    NODE    SYS     SYS     SYS     SYS     PIX      X      NODE    SYS     SYS     SYS
NIC2    NODE    NODE    PXB     PXB     SYS     SYS     SYS     SYS     NODE    NODE     X      SYS     SYS     SYS
NIC3    SYS     SYS     SYS     SYS     PXB     PXB     NODE    NODE    SYS     SYS     SYS      X      PIX     NODE
NIC4    SYS     SYS     SYS     SYS     PXB     PXB     NODE    NODE    SYS     SYS     SYS     PIX      X      NODE
NIC5    SYS     SYS     SYS     SYS     NODE    NODE    PXB     PXB     SYS     SYS     SYS     NODE    NODE     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
  NIC3: mlx5_3
  NIC4: mlx5_4
  NIC5: mlx5_5

Model Input Dumps

No response

🐛 Describe the bug

python code:


vllm serve mistralai/Mistral-Large-Instruct-2407 \
  --tokenizer_mode mistral \
  --config_format mistral \
  --load_format mistral

Error:

ERROR 11-01 04:59:16 multiproc_worker_utils.py:117] Worker VllmWorkerProcess pid 24169 died, exit code: 1
INFO 11-01 04:59:16 multiproc_worker_utils.py:121] Killing local vLLM worker processes
Future exception was never retrieved
future: <Future finished exception=AttributeError("Error in model execution: 'SentencePieceTokenizer' object has no attribut
e 'id_to_byte_piece'")>
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/dist-packages/vllm/worker/model_runner_base.py", line 116, in _wrapper
    return func(*args, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/vllm/worker/model_runner.py", line 1690, in execute_model
    model_input.async_callback()
  File "/usr/local/lib/python3.10/dist-packages/vllm/utils.py", line 1125, in weak_bound
    unbound(inst, *args, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/vllm/engine/llm_engine.py", line 1123, in _process_model_outputs
    self.output_processor.process_outputs(
  File "/usr/local/lib/python3.10/dist-packages/vllm/engine/output_processor/single_step.py", line 95, in process_outputs
    return self._process_sequence_group_outputs(sequence_group, outputs[0],
  File "/usr/local/lib/python3.10/dist-packages/vllm/engine/output_processor/single_step.py", line 123, in _process_sequence
_group_outputs
    new_char_count = self.detokenizer.decode_sequence_inplace(
  File "/usr/local/lib/python3.10/dist-packages/vllm/transformers_utils/detokenizer.py", line 122, in decode_sequence_inplac
e
    read_offset) = detokenize_incrementally(
  File "/usr/local/lib/python3.10/dist-packages/vllm/transformers_utils/detokenizer.py", line 285, in detokenize_incremental
ly
    new_tokens = tokenizer.convert_ids_to_tokens(
  File "/usr/local/lib/python3.10/dist-packages/vllm/transformers_utils/tokenizers/mistral.py", line 227, in convert_ids_to_
tokens
    tokens = [self.tokenizer.id_to_byte_piece(id) for id in ids]
  File "/usr/local/lib/python3.10/dist-packages/vllm/transformers_utils/tokenizers/mistral.py", line 227, in <listcomp>
    tokens = [self.tokenizer.id_to_byte_piece(id) for id in ids]
AttributeError: 'SentencePieceTokenizer' object has no attribute 'id_to_byte_piece'

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.
@liziniu
Copy link
Author

liziniu commented Nov 1, 2024

Packages version:

vllm                              0.6.4.dev31+g5e443b59.d20241017
sentencepiece                     0.2.0
mistral_common                    1.4.4

@liziniu
Copy link
Author

liziniu commented Nov 1, 2024

I realize that Mistral-Large-Instruct-2407 may use the SentencePieceTokenizer, which does not support id_to_byte_piece:

https://github.com/mistralai/mistral-common

@DarkLight1337
Copy link
Member

Perhaps it would be more appropriate to open this issue in mistral-common?

@liziniu
Copy link
Author

liziniu commented Nov 1, 2024

Thanks for this information. However, the error seems to arise from https://github.com/vllm-project/vllm/blob/main/vllm/transformers_utils/tokenizers/mistral.py#L260-L264

@DarkLight1337
Copy link
Member

DarkLight1337 commented Nov 1, 2024

I see what you mean now. cc @ywang96 @patrickvonplaten

@patrickvonplaten
Copy link
Contributor

Interesting! Sorry was off last week. Will check! Thanks for the issue!

@DarkLight1337
Copy link
Member

@liziniu can you check if this is mitigated by #10051?

@patrickvonplaten
Copy link
Contributor

Hey @liziniu,

I was not able to reproduce the bug with the above command, but this PR: #10152 should fix it nevertheless.
Note that models that use the underlying SPM tokenizer should not convert ids to bytes and instead just decode to the unknown token ("�"). However this is also a strong signal that something else is off

@cornzz
Copy link

cornzz commented Jan 8, 2025

@patrickvonplaten @DarkLight1337
Hi, I am getting this error (vllm version v0.6.2) with Mistral 7B v0.1
Don't know why, it works for a couple prompts and then it crashes...

@DarkLight1337
Copy link
Member

DarkLight1337 commented Jan 8, 2025

The fix is released in a later version. Please update your version of vLLM.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants