vllm-project / vllm

A high-throughput and memory-efficient inference and serving engine for LLMs
https://docs.vllm.ai
Apache License 2.0
30.8k stars 4.68k forks source link

[Usage]: Fail to load params.json #10534

Open dequeueing opened 4 days ago

dequeueing commented 4 days ago

Your current environment

$ python collect_env.py 
Collecting environment information...
PyTorch version: 2.5.1
Is debug build: False
CUDA used to build PyTorch: 12.1
ROCM used to build PyTorch: N/A

OS: Rocky Linux release 8.6 (Green Obsidian) (x86_64)
GCC version: (GCC) 12.2.0
Clang version: Could not collect
CMake version: version 3.20.2
Libc version: glibc-2.28

Python version: 3.10.15 (main, Oct  3 2024, 07:27:34) [GCC 11.2.0] (64-bit runtime)
Python platform: Linux-4.18.0-372.32.1.el8_6.x86_64-x86_64-with-glibc2.28
Is CUDA available: False
CUDA runtime version: 12.1.66
CUDA_MODULE_LOADING set to: N/A
GPU models and configuration: Could not collect
Nvidia driver version: Could not collect
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):              32
On-line CPU(s) list: 0-31
Thread(s) per core:  1
Core(s) per socket:  16
Socket(s):           2
NUMA node(s):        2
Vendor ID:           GenuineIntel
CPU family:          6
Model:               106
Model name:          Intel(R) Xeon(R) Silver 4314 CPU @ 2.40GHz
Stepping:            6
CPU MHz:             3400.000
CPU max MHz:         3400.0000
CPU min MHz:         800.0000
BogoMIPS:            4800.00
Virtualization:      VT-x
L1d cache:           48K
L1i cache:           32K
L2 cache:            1280K
L3 cache:            24576K
NUMA node0 CPU(s):   0-15
NUMA node1 CPU(s):   16-31
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 monitor 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 hwp_epp 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] numpy==1.26.4
[pip3] nvidia-ml-py==12.560.30
[pip3] pyzmq==26.2.0
[pip3] torch==2.5.1
[pip3] torchaudio==2.5.1
[pip3] torchvision==0.20.1
[pip3] transformers==4.46.3
[pip3] triton==3.1.0
[conda] blas                      1.0                         mkl  
[conda] cuda-cudart               12.1.105                      0    nvidia
[conda] cuda-cupti                12.1.105                      0    nvidia
[conda] cuda-libraries            12.1.0                        0    nvidia
[conda] cuda-nvrtc                12.1.105                      0    nvidia
[conda] cuda-nvtx                 12.1.105                      0    nvidia
[conda] cuda-opencl               12.6.77                       0    nvidia
[conda] cuda-runtime              12.1.0                        0    nvidia
[conda] cuda-version              12.6                          3    nvidia
[conda] ffmpeg                    4.3                  hf484d3e_0    pytorch
[conda] libcublas                 12.1.0.26                     0    nvidia
[conda] libcufft                  11.0.2.4                      0    nvidia
[conda] libcufile                 1.11.1.6                      0    nvidia
[conda] libcurand                 10.3.7.77                     0    nvidia
[conda] libcusolver               11.4.4.55                     0    nvidia
[conda] libcusparse               12.0.2.55                     0    nvidia
[conda] libjpeg-turbo             2.0.0                h9bf148f_0    pytorch
[conda] libnpp                    12.0.2.50                     0    nvidia
[conda] libnvjitlink              12.1.105                      0    nvidia
[conda] libnvjpeg                 12.1.1.14                     0    nvidia
[conda] mkl                       2023.1.0         h213fc3f_46344  
[conda] mkl-service               2.4.0           py310h5eee18b_1  
[conda] mkl_fft                   1.3.11          py310h5eee18b_0  
[conda] mkl_random                1.2.8           py310h1128e8f_0  
[conda] numpy                     1.26.4                   pypi_0    pypi
[conda] nvidia-ml-py              12.560.30                pypi_0    pypi
[conda] pytorch                   2.5.1           py3.10_cuda12.1_cudnn9.1.0_0    pytorch
[conda] pytorch-cuda              12.1                 ha16c6d3_6    pytorch
[conda] pytorch-mutex             1.0                        cuda    pytorch
[conda] pyzmq                     26.2.0                   pypi_0    pypi
[conda] torchaudio                2.5.1               py310_cu121    pytorch
[conda] torchtriton               3.1.0                     py310    pytorch
[conda] torchvision               0.20.1              py310_cu121    pytorch
[conda] transformers              4.46.3                   pypi_0    pypi
ROCM Version: Could not collect
Neuron SDK Version: N/A
vLLM Version: 0.6.4.post1
vLLM Build Flags:
CUDA Archs: Not Set; ROCm: Disabled; Neuron: Disabled
GPU Topology:
Could not collect

LD_LIBRARY_PATH=/work/cse-wangtj/.conda/envs/idea/lib/python3.10/site-packages/cv2/../../lib64:/opt/ibm/lsfsuite/ext/ppm/10.2/linux2.6-glibc2.3-x86_64/lib:/opt/ibm/lsfsuite/ext/ppm/10.2/linux2.6-glibc2.3-x86_64/lib:/share/base/e5/gcc/12.2.0/lib64:/share/base/e5/gcc/12.2.0/lib:/share/apps/cuda/12.1/targets/x86_64-linux/lib:/share/apps/cuda/12.1/lib64:/lib64/:/share/apps/anaconda3/lib:/opt/ibm/lsfsuite/ext/ppm/10.2/linux2.6-glibc2.3-x86_64/lib:/opt/ibm/lsfsuite/lsf/10.1/linux2.6-glibc2.3-x86_64/lib
CUDA_HOME=/share/apps/cuda/12.1
CUDA_HOME=/share/apps/cuda/12.1

How would you like to use vllm

I want to run inference of a models--mistralai--Mistral-7B-Instruct-v0.3(https://huggingface.co/mistralai/Mistral-7B-Instruct-v0.3). I download the model to local using

# download.sh
huggingface-cli download mistralai/Mistral-7B-Instruct-v0.3

And I can see that the model are indeed downloaded.

$ ls
config.json                       model-00003-of-00003.safetensors  tokenizer.json
generation_config.json            model.safetensors.index.json      tokenizer.model
model-00001-of-00003.safetensors  special_tokens_map.json
model-00002-of-00003.safetensors  tokenizer_config.json

And config.json seems to be valid:

$ cat config.json 
{
  "architectures": [
    "MistralForCausalLM"
  ],
  "attention_dropout": 0.0,
  "bos_token_id": 1,
  "eos_token_id": 2,
  "hidden_act": "silu",
  "hidden_size": 4096,
  "initializer_range": 0.02,
  "intermediate_size": 14336,
  "max_position_embeddings": 32768,
  "model_type": "mistral",
  "num_attention_heads": 32,
  "num_hidden_layers": 32,
  "num_key_value_heads": 8,
  "rms_norm_eps": 1e-05,
  "rope_theta": 1000000.0,
  "sliding_window": null,
  "tie_word_embeddings": false,
  "torch_dtype": "bfloat16",
  "transformers_version": "4.42.0.dev0",
  "use_cache": true,
  "vocab_size": 32768
}

I use the folloing code to run the model:

llm = LLM(model=model_path, tokenizer_mode="mistral", config_format="mistral", load_format="mistral")

as indicated in the hf website.

I get the following error:

Traceback (most recent call last):
  File "config.py", line 474, in load_params_config
    assert isinstance(config_dict, dict)
AssertionError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "idea.py", line 16, in <module>
    llm = LLM(model="...", tokenizer_mode="mistral", config_format="mistral", load_format="mistral")
  File "utils.py", line 1028, in inner
    return fn(*args, **kwargs)
  File "llm.py", line 210, in __init__
    self.llm_engine = self.engine_class.from_engine_args(
  File "llm_engine.py", line 582, in from_engine_args
    engine_config = engine_args.create_engine_config()
  File "arg_utils.py", line 959, in create_engine_config
    model_config = self.create_model_config()
  File "arg_utils.py", line 891, in create_model_config
    return ModelConfig(
  File "config.py", line 208, in __init__
    hf_config = get_config(self.model, trust_remote_code, revision,
  File "config.py", line 223, in get_config
    config = load_params_config(model, revision, token=token, **kwargs)
  File "config.py", line 478, in load_params_config
    raise ValueError(f"Failed to load config from {model}")
ValueError: Failed to load config from /work/cse-wangtj/.cache/huggingface/hub/models--mistralai--Mistral-7B-Instruct-v0.3/snapshots/e0bc86c23ce5aae1db576c8cca6f06f1f73af2db

I also try to print out the type of config:

 <class 'NoneType'>

Can anyone give a hint on how to solve the problem? Thanks in advance!

Before submitting a new issue...

dequeueing commented 4 days ago
def load_params_config(model: Union[str, Path],
                       revision: Optional[str],
                       token: Optional[str] = None,
                       **kwargs) -> PretrainedConfig:
    # This function loads a params.json config which
    # should be used when loading models in mistral format

It turns out that this function is looking for params.json, but I could not see it in the downloaded dir. Could it be the problem of downloading?

DarkLight1337 commented 4 days ago

You can try removing it from the cache and downloading it again. cc @patrickvonplaten

patrickvonplaten commented 4 days ago

Can you make sure to download all:

and then load locally with --tokenizer_format mistral ?